diff --git a/CHANGELOG.md b/CHANGELOG.md index b271a518f68d3..676d44735a082 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,27 +1,126 @@ -## 1.6.0 (Unreleased) +## 1.9.0 (Unreleased) -UPGRADE NOTES: +FEATURES: -* `azurerm_scheduler_job_collection` - the property `max_retry_interval` has been deprecated in favour of `max_recurrence_interval` to better match Azure [GH-1218] +* **New Resource:** `azurerm_scheduler_job` [GH-1172] +* **New Resource:** `azurerm_user_assigned_identity` [GH-1448] + +IMPROVEMENTS: + +* dependencies: updating the `containerservice` SDK to `2018-03-31` to support AKS GA [GH-1474] +* `azurerm_cdn_profile` - support for `Standard_ChinaCdn` and `Standard_Microsoft` SKU's [GH-1465] +* `azurerm_cosmosdb_account` - checking to see if the name is in use before creating [GH-1464] +* `azurerm_cosmosdb_account` - fixing the validation on the `ip_range_filter` field [GH-1463] +* `azurerm_dns_zone` - support for Private DNS Zones [GH-1404] +* `azurerm_image` - change os_disk property to a list and add addtional property validation [GH-1443] +* `azurerm_lb` - allow `private_ip_address` to be set to an empty value [GH-1481] +* `azurerm_servicebus_queue` - `enable_partitioning` can now be enabled for `Basic` and `Standard` tiers [GH-1391] +* `azurerm_virtual_machine` - support for specifying user assigned identities [GH-1448] +* `azurerm_virtual_machine` - making the `content` field in the `additional_unattend_config` block (within `os_profile_windows_config`) sensitive [GH-1471] +* `azurerm_virtual_machine_data_disk_attachment` - adding support for `write_accelerator_enabled` [GH-1473] +* `azurerm_virtual_machine_scale_set` - ensuring we set the `vhd_containers` field to fix a crash [GH-1411] +* `azurerm_virtual_machine_scale_set` - support for specifying user assigned identities [GH-1448] +* `azurerm_virtual_machine_scale_set` - making the `content` field in the `additional_unattend_config` block (within `os_profile_windows_config`) sensitive [GH-1471] + +## 1.8.0 (June 28, 2018) FEATURES: -* **New Resource:** `azurerm_data_lake_store` [GH-1219] -* **New Resource:** `azurerm_storage_account_sas` [GH-1011] -* **New Resource:** `azurerm_relay_namespace` [GH-1233] +* **New Resource:** `azurerm_dns_caa_record` support ([#1450](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1450)) +* **New Resource:** `azurerm_virtual_machine_data_disk_attachment` ([#1207](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1207)) + +IMPROVEMENTS: + +* dependencies: upgrading to v10.11.4 of `Azure/go-autorest` ([#1418](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1418)) +* dependencies: upgrading to v17.4.0 of `Azure/azure-sdk-for-go` ([#1418](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1418)) +* `azurerm_lb` - addtional validation on properties ([#1403](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1403)) +* `azurerm_application_gateway` - support for the `match` block for Probes ([#1446](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1446)) +* `azurerm_log_analytics_solution` - support for Sovereign Clouds ([#1410](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1410)) +* `azurerm_log_analytics_workspace` - support for Sovereign Clouds ([#1410](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1410)) +* `azurerm_log_analytics_workspace` - support for the `PerGB2018` SKU ([#1079](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1079)) +* `azurerm_mysql_server` - `GeneralPurpose` and `MemoryOptimized` sku tiers now allow 4tb for the `storage_mb` property ([#1449](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1449)) +* `azurerm_network_interface` - addtional validation on properties ([#1403](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1403)) +* `azurerm_postgresql_server` - `GeneralPurpose` and `MemoryOptimized` sku tiers now allow 4tb for the `storage_mb` property ([#1449](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1449)) +* `azurerm_postgresql_server` - adding support for version 10.0 ([#1457](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1457)) +* `azurerm_route_table` - adding the disable BGP propagation property ([#1435](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1435)) +* `azurerm_sql_database` - support for importing from a bacpac backup ([#972](https://github.com/terraform-providers/terraform-provider-azurerm/issues/972)) +* `azurerm_virtual_machine` - support for setting the TimeZone on Windows ([#1265](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1265)) + +BUG FIXES: + +* validation: ensuring IPv4/MAC addresses are detected correctly ([#1431](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1431)) + +## 1.7.0 (June 16, 2018) + +UPGRADE NOTES: + +~> **Please Note:** The field `overprovision` on the `azurerm_virtual_machine_scale_set` resource has changed from `false` to `true` to match the behaviour of Azure in this release. ([#1322](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1322)) BUG FIXES: -* across data-sources and resources: making Connection Strings, Keys and Passwords sensitive fields [GH-1242] -* `azurerm_virtual_machine_scale_set` - an empty `os_profile_windows_config` block no longer causes a panic [GH-1224] +* `azurerm_key_vault` - respecting the proxy environment varibles terraform does and now can create vaults when behind a proxy ([#1393](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1393)) +* `azurerm_kubernetes_cluster` - `dns_prefix` is now required ([#1333](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1333)) +* `azurerm_network_interface` - ensuring that Public IP's/Private IP Addresses can be removed once assigned ([#1295](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1295)) +* `azurerm_public_ip` - setting the `domain_name_label` property into state ([#1287](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1287)) +* `azurerm_storage_account` - file and blob encryption is now explicity `true` by default ([#1380](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1380)) +* `azurerm_servicebus_namespace` - the `capacity` propety no longer unnecessarily forces a new resource when changed ([#1382](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1382)) +* `azurerm_virtual_machine_scale_set` - the field `overprovision` is now `true` by default ([#1322](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1322)) +* `azurerm_app_service_plan` - the `name` property validation now allows understores ([#1351](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1351)) IMPROVEMENTS: -* `azurerm_app_service` - adding support for `ip_restriction`'s [GH-1231] -* `azurerm_dns_zone` - datasource's `resource_group` field is now optional [GH-1180] -* `azurerm_public_ip` - computed values now default to an empy string [GH-1247] -* `azurerm_servicebus_queue` - adding `dead_lettering_on_message_expiration` [GH-1235] +* `azurerm_automation_schedule` - adding the `interval` property and supporting recurring schedules ([#1384](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1384)) +* `azurerm_dns_ns_record` - deprecated `record` properties in favor of a `records` list ([#991](https://github.com/terraform-providers/terraform-provider-azurerm/issues/991)) +* `azurerm_function_app` - adding the `identity` property ([#1369](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1369)) +* `azurerm_role_definition` - the `role_definition_id` property is now optional. The resource will now generate a random UUID if it is ommited ([#1378](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1378)) +* `azurerm_storage_account` - adding the `network_rules` property ([#1334](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1334)) +* `azurerm_storage_account` - adding the `identity` property ([#1323](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1323)) +* `azurerm_storage_blob` - adding the `content_type` property ([#1304](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1304)) +* `azurerm_virtual_machine` - support for `write_accelerator_enabled` property on Premium disks attached to MS-series machines ([#964](https://github.com/terraform-providers/terraform-provider-azurerm/issues/964)) +* `azurerm_virtual_machine_scale_set` - adding the `dns_settings` and `dns_servers` property ([#1209](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1209)) +* `azurerm_virtual_machine_scale_set` - adding the `ip_forwarding` property ([#1209](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1209)) +* `azurerm_virtual_network_gateway` - adding the properties `vpn_client_protocols`, `radius_server_address` and `radius_server_secret` ([#946](https://github.com/terraform-providers/terraform-provider-azurerm/issues/946)) +* dependencies: migrating to the un-deprecated Preview's for Container Instance, EventGrid, Log Analytics and SQL ([#1322](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1322)) +* dependencies: upgrading to `2018-01-01` of the EventGrid API ([#1322](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1322)) +* dependencies: upgrading to `2018-03-01` of the Monitor API ([#1322](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1322)) + +## 1.6.0 (May 24, 2018) + +UPGRADE NOTES: + +~> **Please Note:** The `azurerm_mysql_server` resource has been updated from the Preview API's to the GA API's - which requires code changes in your Terraform Configuration to use the new Pricing SKU's. Upon updating to v1.6.0 - you'll need to update the configuration from the Preview SKU's to the GA SKU's. + +~> **Please Note:** The `azurerm_postgresql_server` resource has been updated from the Preview API's to the GA API's - which requires code changes in your Terraform Configuration to use the new Pricing SKU's. Upon updating to v1.6.0 - you'll need to update the configuration from the Preview SKU's to the GA SKU's. + +* `azurerm_scheduler_job_collection` - the property `max_retry_interval` on both the resource and datasource has been deprecated in favour of `max_recurrence_interval` to better match Azure ([#1218](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1218)) + +FEATURES: + +* **New Data Source:** `azurerm_storage_account_sas` ([#1011](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1011)) +* **New Resource:** `azurerm_data_lake_store` ([#1219](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1219)) +* **New Resource:** `azurerm_relay_namespace` ([#1233](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1233)) + +BUG FIXES: + +* across data-sources and resources: making Connection Strings, Keys and Passwords sensitive fields ([#1242](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1242)) +* `azurerm_virtual_machine_scale_set` - an empty `os_profile_windows_config` block no longer causes a panic ([#1224](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1224)) + +IMPROVEMENTS: +* authorization: upgrading to API version `2018-01-01-preview` +* `azurerm_app_service` - adding support for `ip_restriction`'s ([#1231](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1231)) +* `azurerm_app_service_slot` - adding support for `ip_restriction`'s ([#1246](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1246)) +* `azurerm_container_registry` - no longer forces a new resource on SKU change ([#1264](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1264)) +* `azurerm_dns_zone` - datasource's `resource_group` field is now optional ([#1180](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1180)) +* `azurerm_mysql_database` - ignoring casing for the `charset` field ([#1281](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1281)) +* `azurerm_mysql_server` - support for the new GA Pricing SKU's ([#1154](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1154)) +* `azurerm_postgresql_database` - ignoring the casing on the `collation` field ([#1255](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1255)) +* `azurerm_postgresql_server` - support for the new GA Pricing SKU's ([#1190](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1190)) +* `azurerm_public_ip` - computed values now default to an empy string ([#1247](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1247)) +* `azurerm_role_assignment` - support for roles containing DataActions ([#1284](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1284)) +* `azurerm_servicebus_queue` - adding `dead_lettering_on_message_expiration` ([#1235](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1235)) +* `azurerm_virtual_machine_scale_set` - adding the `licence_type` property ([#1245](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1245)) +* `azurerm_virtual_machine_scale_set` - adding the `priority` property ([#1250](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1250)) ## 1.5.0 (May 14, 2018) @@ -138,7 +237,7 @@ IMPROVEMENTS: * `azurerm_app_service` - allow changing `client_affinity_enabled` without requiring a resource recreation ([#993](https://github.com/terraform-providers/terraform-provider-azurerm/issues/993)) * `azurerm_app_service` - support for configuring `LocalSCM` source control ([#826](https://github.com/terraform-providers/terraform-provider-azurerm/issues/826)) * `azurerm_app_service` - returning a clearer error message when the name (which needs to be globally unique) is in use ([#1037](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1037)) -* `azurerm_cosmosdb_account` - increasing the maximum value for `max_interval_in_seconds` from 100s to 86400s (1 day) [[#1000](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1000)] +* `azurerm_cosmosdb_account` - increasing the maximum value for `max_interval_in_seconds` from 100s to 86400s (1 day) ([#1000](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1000)) * `azurerm_function_app` - returning a clearer error message when the name (which needs to be globally unique) is in use ([#1037](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1037)) * `azurerm_network_interface` - support for attaching to Application Gateways ([#1027](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1027)) * `azurerm_traffic_manager_endpoint` - adding support for `geo_mappings` ([#986](https://github.com/terraform-providers/terraform-provider-azurerm/issues/986)) @@ -316,4 +415,4 @@ IMPROVEMENTS: * core - Upgrading `Azure/azure-sdk-for-go` to v11.2.2-beta ([#594](https://github.com/terraform-providers/terraform-provider-azurerm/issues/594)) * core - upgrading `Azure/go-autorest` to v9.5.2 ([#617](https://github.com/terraform-providers/terraform-provider-azurerm/issues/617)) * core - skipping Resource Provider Registration in AutoRest when opted-out ([#630](https://github.com/terraform-providers/terraform-provider-azurerm/issues/630)) -* `azurerm_app_service` - exposing the Default Hostname as a Computed field +* `azurerm_app_service` - exposing the Default Hostname as a Computed field diff --git a/GNUmakefile b/GNUmakefile index cd15d2ccdad48..203a0fd71fca1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,6 +8,13 @@ default: build build: fmtcheck go install +build-docker: + mkdir -p bin + docker run --rm -v $$(pwd)/bin:/go/bin -v $$(pwd):/go/src/github.com/terraform-providers/terraform-provider-azurerm -w /go/src/github.com/terraform-providers/terraform-provider-azurerm -e GOOS golang:1.10 make build + +test-docker: + docker run --rm -v $$(pwd):/go/src/github.com/terraform-providers/terraform-provider-azurerm -w /go/src/github.com/terraform-providers/terraform-provider-azurerm golang:1.10 make test + test: fmtcheck go test -i $(TEST) || exit 1 echo $(TEST) | \ @@ -62,5 +69,5 @@ ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) endif @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) -.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test +.PHONY: build build-docker test test-docker testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test diff --git a/azurerm/config.go b/azurerm/config.go index e0e435585e20c..d6c9f083e6e8b 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -11,28 +11,30 @@ import ( "time" appinsights "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" - "github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization" "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-04-02/cdn" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-02-01-preview/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-04-01/containerinstance" "github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry" - "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2017-09-30/containerservice" + "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2018-03-31/containerservice" "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb" "github.com/Azure/azure-sdk-for-go/services/datalake/store/mgmt/2016-11-01/account" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" - "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid" + "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid" "github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub" "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices" keyVault "github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault" "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault" - "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" - "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights" - "github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql" + "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights" + "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" + "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi" + "github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights" + "github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2016-06-01/recoveryservices" "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis" "github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay" @@ -43,7 +45,6 @@ import ( "github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler" "github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search" "github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus" - "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage" "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2017-05-01/trafficmanager" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web" @@ -150,6 +151,9 @@ type ArmClient struct { // Monitor monitorAlertRulesClient insights.AlertRulesClient + // MSI + userAssignedIdentitiesClient msi.UserAssignedIdentitiesClient + // Networking applicationGatewayClient network.ApplicationGatewaysClient applicationSecurityGroupsClient network.ApplicationSecurityGroupsClient @@ -187,6 +191,10 @@ type ArmClient struct { resourceGroupsClient resources.GroupsClient subscriptionsClient subscriptions.Client + //Scheduler + schedulerJobCollectionsClient scheduler.JobCollectionsClient + schedulerJobsClient scheduler.JobsClient + // Search searchServicesClient search.ServicesClient @@ -197,9 +205,6 @@ type ArmClient struct { serviceBusSubscriptionsClient servicebus.SubscriptionsClient serviceBusSubscriptionRulesClient servicebus.RulesClient - //Scheduler - schedulerJobCollectionsClient scheduler.JobCollectionsClient - // Storage storageServiceClient storage.AccountsClient storageUsageClient storage.UsageClient @@ -801,17 +806,21 @@ func (c *ArmClient) registerNetworkingClients(endpoint, subscriptionId string, a c.configureClient(&subnetsClient.Client, auth) c.subnetClient = subnetsClient + userAssignedIdentitiesClient := msi.NewUserAssignedIdentitiesClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&userAssignedIdentitiesClient.Client, auth) + c.userAssignedIdentitiesClient = userAssignedIdentitiesClient + watchersClient := network.NewWatchersClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&watchersClient.Client, auth) c.watcherClient = watchersClient } func (c *ArmClient) registerOperationalInsightsClients(endpoint, subscriptionId string, auth autorest.Authorizer, sender autorest.Sender) { - opwc := operationalinsights.NewWorkspacesClient(subscriptionId) + opwc := operationalinsights.NewWorkspacesClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&opwc.Client, auth) c.workspacesClient = opwc - solutionsClient := operationsmanagement.NewSolutionsClient(subscriptionId, "Microsoft.OperationsManagement", "solutions", "testing") + solutionsClient := operationsmanagement.NewSolutionsClientWithBaseURI(endpoint, subscriptionId, "Microsoft.OperationsManagement", "solutions", "testing") c.configureClient(&solutionsClient.Client, auth) c.solutionsClient = solutionsClient } @@ -868,6 +877,16 @@ func (c *ArmClient) registerResourcesClients(endpoint, subscriptionId string, au c.subscriptionsClient = subscriptionsClient } +func (c *ArmClient) registerSchedulerClients(endpoint, subscriptionId string, auth autorest.Authorizer) { + jobCollectionsClient := scheduler.NewJobCollectionsClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&jobCollectionsClient.Client, auth) + c.schedulerJobCollectionsClient = jobCollectionsClient + + jobsClient := scheduler.NewJobsClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&jobsClient.Client, auth) + c.schedulerJobsClient = jobsClient +} + func (c *ArmClient) registerSearchClients(endpoint, subscriptionId string, auth autorest.Authorizer) { searchClient := search.NewServicesClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&searchClient.Client, auth) @@ -896,12 +915,6 @@ func (c *ArmClient) registerServiceBusClients(endpoint, subscriptionId string, a c.serviceBusSubscriptionRulesClient = subscriptionRulesClient } -func (c *ArmClient) registerSchedulerClients(endpoint, subscriptionId string, auth autorest.Authorizer) { - jobsClient := scheduler.NewJobCollectionsClientWithBaseURI(endpoint, subscriptionId) - c.configureClient(&jobsClient.Client, auth) - c.schedulerJobCollectionsClient = jobsClient -} - func (c *ArmClient) registerStorageClients(endpoint, subscriptionId string, auth autorest.Authorizer) { accountsClient := storage.NewAccountsClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&accountsClient.Client, auth) diff --git a/azurerm/data_source_app_service.go b/azurerm/data_source_app_service.go index ab575d8206acb..bf751dc24d4d7 100644 --- a/azurerm/data_source_app_service.go +++ b/azurerm/data_source_app_service.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/hashicorp/terraform/helper/schema" + azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -27,125 +28,19 @@ func dataSourceArmAppService() *schema.Resource { Computed: true, }, - "site_config": { - Type: schema.TypeList, - Computed: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "always_on": { - Type: schema.TypeBool, - Computed: true, - }, - - "default_documents": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - "dotnet_framework_version": { - Type: schema.TypeString, - Computed: true, - }, - - "http2_enabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "java_version": { - Type: schema.TypeString, - Computed: true, - }, - - "java_container": { - Type: schema.TypeString, - Computed: true, - }, - - "java_container_version": { - Type: schema.TypeString, - Computed: true, - }, - - "local_mysql_enabled": { - Type: schema.TypeBool, - Computed: true, - }, - - "managed_pipeline_mode": { - Type: schema.TypeString, - Computed: true, - }, - - "php_version": { - Type: schema.TypeString, - Computed: true, - }, - - "python_version": { - Type: schema.TypeString, - Computed: true, - }, - - "remote_debugging_enabled": { - Type: schema.TypeBool, - Computed: true, - }, - - "remote_debugging_version": { - Type: schema.TypeString, - Computed: true, - }, - - "scm_type": { - Type: schema.TypeString, - Computed: true, - }, - - "use_32_bit_worker_process": { - Type: schema.TypeBool, - Computed: true, - }, - - "websockets_enabled": { - Type: schema.TypeBool, - Computed: true, - }, - }, - }, - }, + "site_config": azSchema.AppServiceSiteConfigSchema(), "client_affinity_enabled": { Type: schema.TypeBool, Computed: true, }, - "ip_restriction": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ip_address": { - Type: schema.TypeString, - Computed: true, - }, - "subnet_mask": { - Type: schema.TypeString, - Computed: true, - }, - }, - }, - }, - - "https_only": { + "enabled": { Type: schema.TypeBool, Computed: true, }, - "enabled": { + "https_only": { Type: schema.TypeBool, Computed: true, }, @@ -205,6 +100,7 @@ func dataSourceArmAppService() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "source_control": { Type: schema.TypeList, Computed: true, @@ -296,16 +192,11 @@ func dataSourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error return err } - siteConfig := flattenAppServiceSiteConfig(configResp.SiteConfig) + siteConfig := azSchema.FlattenAppServiceSiteConfig(configResp.SiteConfig) if err := d.Set("site_config", siteConfig); err != nil { return err } - restrictions := flattenAppServiceIpRestrictions(configResp.SiteConfig.IPSecurityRestrictions) - if err := d.Set("ip_restriction", restrictions); err != nil { - return fmt.Errorf("Error setting `ip_restriction`: %s", err) - } - scm := flattenAppServiceSourceControl(scmResp.SiteSourceControlProperties) if err := d.Set("source_control", scm); err != nil { return err diff --git a/azurerm/data_source_app_service_test.go b/azurerm/data_source_app_service_test.go index e6cd6788ba9f1..6066636bb6bf5 100644 --- a/azurerm/data_source_app_service_test.go +++ b/azurerm/data_source_app_service_test.go @@ -138,8 +138,8 @@ func TestAccDataSourceAzureRMAppService_ipRestriction(t *testing.T) { { Config: testAccDataSourceAppService_ipRestriction(rInt, location), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "ip_restriction.0.ip_address", "10.10.10.10"), - resource.TestCheckResourceAttr(dataSourceName, "ip_restriction.0.subnet_mask", "255.255.255.255"), + resource.TestCheckResourceAttr(dataSourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10"), + resource.TestCheckResourceAttr(dataSourceName, "site_config.0.ip_restriction.0.subnet_mask", "255.255.255.255"), ), }, }, diff --git a/azurerm/data_source_builtin_role_definition.go b/azurerm/data_source_builtin_role_definition.go index 7638b09ecdc50..47f84469df1ce 100644 --- a/azurerm/data_source_builtin_role_definition.go +++ b/azurerm/data_source_builtin_role_definition.go @@ -83,10 +83,10 @@ func dataSourceArmBuiltInRoleDefinitionRead(d *schema.ResourceData, meta interfa return fmt.Errorf("Error loading Role Definition: %+v", err) } - if props := role.Properties; props != nil { + if props := role.RoleDefinitionProperties; props != nil { d.Set("name", props.RoleName) d.Set("description", props.Description) - d.Set("type", props.Type) + d.Set("type", props.RoleType) permissions := flattenRoleDefinitionPermissions(props.Permissions) if err := d.Set("permissions", permissions); err != nil { diff --git a/azurerm/data_source_builtin_role_definition_test.go b/azurerm/data_source_builtin_role_definition_test.go index 325c641e53013..868fe1e534944 100644 --- a/azurerm/data_source_builtin_role_definition_test.go +++ b/azurerm/data_source_builtin_role_definition_test.go @@ -22,10 +22,12 @@ func TestAccDataSourceAzureRMBuiltInRoleDefinition_contributor(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "permissions.#", "1"), resource.TestCheckResourceAttr(dataSourceName, "permissions.0.actions.#", "1"), resource.TestCheckResourceAttr(dataSourceName, "permissions.0.actions.0", "*"), - resource.TestCheckResourceAttr(dataSourceName, "permissions.0.not_actions.#", "3"), + resource.TestCheckResourceAttr(dataSourceName, "permissions.0.not_actions.#", "5"), resource.TestCheckResourceAttr(dataSourceName, "permissions.0.not_actions.0", "Microsoft.Authorization/*/Delete"), resource.TestCheckResourceAttr(dataSourceName, "permissions.0.not_actions.1", "Microsoft.Authorization/*/Write"), resource.TestCheckResourceAttr(dataSourceName, "permissions.0.not_actions.2", "Microsoft.Authorization/elevateAccess/Action"), + resource.TestCheckResourceAttr(dataSourceName, "permissions.0.not_actions.3", "Microsoft.Blueprint/blueprintAssignments/write"), + resource.TestCheckResourceAttr(dataSourceName, "permissions.0.not_actions.4", "Microsoft.Blueprint/blueprintAssignments/delete"), ), }, }, diff --git a/azurerm/data_source_cosmos_db_account.go b/azurerm/data_source_cosmos_db_account.go index 1ecaacfb10a3c..bd98ea4162148 100644 --- a/azurerm/data_source_cosmos_db_account.go +++ b/azurerm/data_source_cosmos_db_account.go @@ -93,6 +93,14 @@ func dataSourceArmCosmosDBAccount() *schema.Resource { }, }, + "capabilities": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "endpoint": { Type: schema.TypeString, Computed: true, @@ -190,6 +198,10 @@ func dataSourceArmCosmosDBAccountRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error setting `geo_location`: %+v", err) } + if err := d.Set("capabilities", flattenAzureRmCosmosDBAccountCapabilities(resp.Capabilities)); err != nil { + return fmt.Errorf("Error setting `capabilities`: %+v", err) + } + readEndpoints := make([]string, 0) if locations := props.ReadLocations; locations != nil { for _, l := range *locations { diff --git a/azurerm/data_source_data_lake_store_test.go b/azurerm/data_source_data_lake_store_test.go index cb1ec86e3266a..ea5bfdc489712 100644 --- a/azurerm/data_source_data_lake_store_test.go +++ b/azurerm/data_source_data_lake_store_test.go @@ -54,7 +54,7 @@ func TestAccDataSourceAzureRMDataLakeStore_tier(t *testing.T) { func testAccDataSourceDataLakeStore_basic(rInt int, rs string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -74,7 +74,7 @@ data "azurerm_data_lake_store" "test" { func testAccDataSourceDataLakeStore_tier(rInt int, rs string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/data_source_dns_zone.go b/azurerm/data_source_dns_zone.go index 909a0431a3b82..bf31fd504f4b0 100644 --- a/azurerm/data_source_dns_zone.go +++ b/azurerm/data_source_dns_zone.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -43,6 +43,23 @@ func dataSourceArmDnsZone() *schema.Resource { Set: schema.HashString, }, + "zone_type": { + Type: schema.TypeString, + Computed: true, + }, + + "registration_virtual_network_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "resolution_virtual_network_ids": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "tags": tagsForDataSourceSchema(), }, } @@ -87,15 +104,36 @@ func dataSourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error { if props := resp.ZoneProperties; props != nil { d.Set("number_of_record_sets", props.NumberOfRecordSets) d.Set("max_number_of_record_sets", props.MaxNumberOfRecordSets) + d.Set("zone_type", props.ZoneType) + registrationVNets := make([]string, 0) + if rvns := props.RegistrationVirtualNetworks; rvns != nil { + for _, rvn := range *rvns { + registrationVNets = append(registrationVNets, *rvn.ID) + } + } + if err := d.Set("registration_virtual_network_ids", registrationVNets); err != nil { + return err + } + + resolutionVNets := make([]string, 0) + if rvns := props.ResolutionVirtualNetworks; rvns != nil { + for _, rvn := range *rvns { + resolutionVNets = append(resolutionVNets, *rvn.ID) + } + } + if err := d.Set("resolution_virtual_network_ids", resolutionVNets); err != nil { + return err + } + + nameServers := make([]string, 0) if ns := props.NameServers; ns != nil { - nameServers := make([]string, 0, len(*ns)) for _, ns := range *ns { nameServers = append(nameServers, ns) } - if err := d.Set("name_servers", nameServers); err != nil { - return err - } + } + if err := d.Set("name_servers", nameServers); err != nil { + return err } } diff --git a/azurerm/data_source_dns_zone_test.go b/azurerm/data_source_dns_zone_test.go index fc3a63db741c3..2b75d623aad5a 100644 --- a/azurerm/data_source_dns_zone_test.go +++ b/azurerm/data_source_dns_zone_test.go @@ -73,7 +73,7 @@ func TestAccDataSourceAzureRMDNSZone_withoutResourceGroupName(t *testing.T) { func testAccDataSourceDNSZone_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -92,7 +92,7 @@ data "azurerm_dns_zone" "test" { func testAccDataSourceDNSZone_tags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/data_source_image_test.go b/azurerm/data_source_image_test.go index 2ce1c5d79e3fc..139392b48a700 100644 --- a/azurerm/data_source_image_test.go +++ b/azurerm/data_source_image_test.go @@ -68,7 +68,7 @@ func TestAccDataSourceAzureRMImage_localFilter(t *testing.T) { func testAccDataSourceAzureRMImageBasic(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -198,7 +198,7 @@ output "location" { func testAccDataSourceAzureRMImageLocalFilter(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/data_source_kubernetes_cluster.go b/azurerm/data_source_kubernetes_cluster.go index 90b05c7f94afe..c8c1ee1444e67 100644 --- a/azurerm/data_source_kubernetes_cluster.go +++ b/azurerm/data_source_kubernetes_cluster.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2017-09-30/containerservice" + "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2018-03-31/containerservice" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/kubernetes" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -183,7 +183,7 @@ func dataSourceArmKubernetesClusterRead(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error making Read request on AKS Managed Cluster %q (resource group %q): %+v", name, resourceGroup, err) } - profile, err := kubernetesClustersClient.GetAccessProfiles(ctx, resourceGroup, name, "clusterUser") + profile, err := kubernetesClustersClient.GetAccessProfile(ctx, resourceGroup, name, "clusterUser") if err != nil { return fmt.Errorf("Error getting access profile while making Read request on AKS Managed Cluster %q (resource group %q): %+v", name, resourceGroup, err) } @@ -256,7 +256,7 @@ func flattenKubernetesClusterDataSourceLinuxProfile(input *containerservice.Linu return []interface{}{values} } -func flattenKubernetesClusterDataSourceAgentPoolProfiles(input *[]containerservice.AgentPoolProfile) []interface{} { +func flattenKubernetesClusterDataSourceAgentPoolProfiles(input *[]containerservice.ManagedClusterAgentPoolProfile) []interface{} { agentPoolProfiles := make([]interface{}, 0) if input == nil { diff --git a/azurerm/data_source_public_ips.go b/azurerm/data_source_public_ips.go index b4664cd77d812..cdeea6c232874 100644 --- a/azurerm/data_source_public_ips.go +++ b/azurerm/data_source_public_ips.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" ) diff --git a/azurerm/data_source_public_ips_test.go b/azurerm/data_source_public_ips_test.go index bd4111353b95e..25bc82e0b476c 100644 --- a/azurerm/data_source_public_ips_test.go +++ b/azurerm/data_source_public_ips_test.go @@ -104,7 +104,7 @@ func TestAccDataSourceAzureRMPublicIPs_allocationType(t *testing.T) { func testAccDataSourceAzureRMPublicIPs_attached(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -155,7 +155,7 @@ data "azurerm_public_ips" "attached" { func testAccDataSourceAzureRMPublicIPs_prefix(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -202,7 +202,7 @@ data "azurerm_public_ips" "test" { func testAccDataSourceAzureRMPublicIPs_allocationType(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/data_source_role_definition.go b/azurerm/data_source_role_definition.go index 686dd0b3fe84b..bf2c94bfaeca6 100644 --- a/azurerm/data_source_role_definition.go +++ b/azurerm/data_source_role_definition.go @@ -79,10 +79,10 @@ func dataSourceArmRoleDefinitionRead(d *schema.ResourceData, meta interface{}) e d.SetId(*role.ID) - if props := role.Properties; props != nil { + if props := role.RoleDefinitionProperties; props != nil { d.Set("name", props.RoleName) d.Set("description", props.Description) - d.Set("type", props.Type) + d.Set("type", props.RoleType) permissions := flattenRoleDefinitionPermissions(props.Permissions) if err := d.Set("permissions", permissions); err != nil { diff --git a/azurerm/data_source_route_table.go b/azurerm/data_source_route_table.go index 0afea7306b705..08d6c18af18c9 100644 --- a/azurerm/data_source_route_table.go +++ b/azurerm/data_source_route_table.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/data_source_scheduler_job_collection.go b/azurerm/data_source_scheduler_job_collection.go index 6141e5379c8df..8ec72ea0e6aef 100644 --- a/azurerm/data_source_scheduler_job_collection.go +++ b/azurerm/data_source_scheduler_job_collection.go @@ -54,9 +54,15 @@ func dataSourceArmSchedulerJobCollection() *schema.Resource { Computed: true, }, - //this is MaxRecurrance.Interval, property is named this as the documentation in the api states: - // Gets or sets the interval between retries. + // API documentation states the MaxRecurrence.Interval "Gets or sets the interval between retries." + // however it does appear it is the max interval allowed for recurrences "max_retry_interval": { + Type: schema.TypeInt, + Deprecated: "Renamed to `max_recurrence_interval` to match azure", + Computed: true, + }, + + "max_recurrence_interval": { Type: schema.TypeInt, Computed: true, }, diff --git a/azurerm/data_source_snapshot_test.go b/azurerm/data_source_snapshot_test.go index c21c3a9d2da5f..7d79ffc9ab6ad 100644 --- a/azurerm/data_source_snapshot_test.go +++ b/azurerm/data_source_snapshot_test.go @@ -51,7 +51,7 @@ func TestAccDataSourceAzureRMSnapshot_importEncryption(t *testing.T) { func testAccDataSourceAzureRMSnapshot_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -84,7 +84,7 @@ func testAccDataSourceAzureRMSnapshot_encryption(rInt int, rString string, locat data "azurerm_client_config" "current" {} resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/data_source_virtual_network.go b/azurerm/data_source_virtual_network.go index 4e9f221ecfeeb..53b0e1996c56e 100644 --- a/azurerm/data_source_virtual_network.go +++ b/azurerm/data_source_virtual_network.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/express_route_circuit.go b/azurerm/express_route_circuit.go index b383f15e72cf8..67204e81c8299 100644 --- a/azurerm/express_route_circuit.go +++ b/azurerm/express_route_circuit.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/helpers/azure/resourceid.go b/azurerm/helpers/azure/resourceid.go new file mode 100644 index 0000000000000..0609cd381967a --- /dev/null +++ b/azurerm/helpers/azure/resourceid.go @@ -0,0 +1,154 @@ +package azure + +import ( + "fmt" + "net/url" + "sort" + "strings" +) + +// ResourceID represents a parsed long-form Azure Resource Manager ID +// with the Subscription ID, Resource Group and the Provider as top- +// level fields, and other key-value pairs available via a map in the +// Path field. +type ResourceID struct { + SubscriptionID string + ResourceGroup string + Provider string + Path map[string]string +} + +// parseAzureResourceID converts a long-form Azure Resource Manager ID +// into a ResourceID. We make assumptions about the structure of URLs, +// which is obviously not good, but the best thing available given the +// SDK. +func ParseAzureResourceID(id string) (*ResourceID, error) { + idURL, err := url.ParseRequestURI(id) + if err != nil { + return nil, fmt.Errorf("Cannot parse Azure ID: %s", err) + } + + path := idURL.Path + + path = strings.TrimSpace(path) + if strings.HasPrefix(path, "/") { + path = path[1:] + } + + if strings.HasSuffix(path, "/") { + path = path[:len(path)-1] + } + + components := strings.Split(path, "/") + + // We should have an even number of key-value pairs. + if len(components)%2 != 0 { + return nil, fmt.Errorf("The number of path segments is not divisible by 2 in %q", path) + } + + var subscriptionID string + + // Put the constituent key-value pairs into a map + componentMap := make(map[string]string, len(components)/2) + for current := 0; current < len(components); current += 2 { + key := components[current] + value := components[current+1] + + // Check key/value for empty strings. + if key == "" || value == "" { + return nil, fmt.Errorf("Key/Value cannot be empty strings. Key: '%s', Value: '%s'", key, value) + } + + // Catch the subscriptionID before it can be overwritten by another "subscriptions" + // value in the ID which is the case for the Service Bus subscription resource + if key == "subscriptions" && subscriptionID == "" { + subscriptionID = value + } else { + componentMap[key] = value + } + } + + // Build up a ResourceID from the map + idObj := &ResourceID{} + idObj.Path = componentMap + + if subscriptionID != "" { + idObj.SubscriptionID = subscriptionID + } else { + return nil, fmt.Errorf("No subscription ID found in: %q", path) + } + + if resourceGroup, ok := componentMap["resourceGroups"]; ok { + idObj.ResourceGroup = resourceGroup + delete(componentMap, "resourceGroups") + } else { + // Some Azure APIs are weird and provide things in lower case... + // However it's not clear whether the casing of other elements in the URI + // matter, so we explicitly look for that case here. + if resourceGroup, ok := componentMap["resourcegroups"]; ok { + idObj.ResourceGroup = resourceGroup + delete(componentMap, "resourcegroups") + } else { + return nil, fmt.Errorf("No resource group name found in: %q", path) + } + } + + // It is OK not to have a provider in the case of a resource group + if provider, ok := componentMap["providers"]; ok { + idObj.Provider = provider + delete(componentMap, "providers") + } + + return idObj, nil +} + +func composeAzureResourceID(idObj *ResourceID) (id string, err error) { + if idObj.SubscriptionID == "" || idObj.ResourceGroup == "" { + return "", fmt.Errorf("SubscriptionID and ResourceGroup cannot be empty") + } + + id = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s", idObj.SubscriptionID, idObj.ResourceGroup) + + if idObj.Provider != "" { + if len(idObj.Path) < 1 { + return "", fmt.Errorf("ResourceID.Path should have at least one item when ResourceID.Provider is specified") + } + + id += fmt.Sprintf("/providers/%s", idObj.Provider) + + // sort the path keys so our output is deterministic + var pathKeys []string + for k := range idObj.Path { + pathKeys = append(pathKeys, k) + } + sort.Strings(pathKeys) + + for _, k := range pathKeys { + v := idObj.Path[k] + if k == "" || v == "" { + return "", fmt.Errorf("ResourceID.Path cannot contain empty strings") + } + id += fmt.Sprintf("/%s/%s", k, v) + } + } + + return +} + +func ParseNetworkSecurityGroupName(networkSecurityGroupId string) (string, error) { + id, err := ParseAzureResourceID(networkSecurityGroupId) + if err != nil { + return "", fmt.Errorf("[ERROR] Unable to Parse Network Security Group ID '%s': %+v", networkSecurityGroupId, err) + } + + return id.Path["networkSecurityGroups"], nil +} + +func ParseRouteTableName(routeTableId string) (string, error) { + id, err := ParseAzureResourceID(routeTableId) + if err != nil { + return "", fmt.Errorf("[ERROR] Unable to parse Route Table ID '%s': %+v", routeTableId, err) + } + + return id.Path["routeTables"], nil +} diff --git a/azurerm/resourceid_test.go b/azurerm/helpers/azure/resourceid_test.go similarity index 98% rename from azurerm/resourceid_test.go rename to azurerm/helpers/azure/resourceid_test.go index 6857f181811da..e7a03fa4fba27 100644 --- a/azurerm/resourceid_test.go +++ b/azurerm/helpers/azure/resourceid_test.go @@ -1,4 +1,4 @@ -package azurerm +package azure import ( "reflect" @@ -130,7 +130,7 @@ func TestParseAzureResourceID(t *testing.T) { } for _, test := range testCases { - parsed, err := parseAzureResourceID(test.id) + parsed, err := ParseAzureResourceID(test.id) if test.expectError && err != nil { continue } diff --git a/azurerm/helpers/azure/validate.go b/azurerm/helpers/azure/validate.go new file mode 100644 index 0000000000000..ff56279807d55 --- /dev/null +++ b/azurerm/helpers/azure/validate.go @@ -0,0 +1,34 @@ +package azure + +import ( + "fmt" +) + +func ValidateResourceID(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if _, err := ParseAzureResourceID(v); err != nil { + errors = append(errors, fmt.Errorf("Can not parse %q as a resource id: %v", k, err)) + } + + return +} + +//true for a resource ID or an empty string +func ValidateResourceIDOrEmpty(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if v == "" { + return + } + + return ValidateResourceID(i, k) +} diff --git a/azurerm/helpers/azure/validate_test.go b/azurerm/helpers/azure/validate_test.go new file mode 100644 index 0000000000000..b8b17ab474f0a --- /dev/null +++ b/azurerm/helpers/azure/validate_test.go @@ -0,0 +1,92 @@ +package azure + +import "testing" + +func TestHelper_AzureResourceID(t *testing.T) { + cases := []struct { + ID string + Errors int + }{ + { + ID: "", + Errors: 1, + }, + { + ID: "nonsense", + Errors: 1, + }, + { + ID: "/slash", + Errors: 1, + }, + { + ID: "/path/to/nothing", + Errors: 1, + }, + { + ID: "/subscriptions", + Errors: 1, + }, + { + ID: "/providers", + Errors: 1, + }, + { + ID: "/subscriptions/not-a-guid", + Errors: 0, + }, + { + ID: "/providers/test", + Errors: 0, + }, + { + ID: "/subscriptions/00000000-0000-0000-0000-00000000000/", + Errors: 0, + }, + { + ID: "/providers/provider.name/", + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.ID, func(t *testing.T) { + _, errors := ValidateResourceID(tc.ID, "test") + + if len(errors) < tc.Errors { + t.Fatalf("Expected ValidateResourceID to have %d not %d errors for %q", tc.Errors, len(errors), tc.ID) + } + }) + } +} + +func TestAzureResourceIDOrEmpty(t *testing.T) { + cases := []struct { + ID string + Errors int + }{ + { + ID: "", + Errors: 0, + }, + { + ID: "nonsense", + Errors: 1, + }, + //as this function just calls TestAzureResourceId lets not be as comprehensive + { + ID: "/providers/provider.name/", + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.ID, func(t *testing.T) { + _, errors := ValidateResourceIDOrEmpty(tc.ID, "test") + + if len(errors) < tc.Errors { + t.Fatalf("Expected TestAzureResourceIdOrEmpty to have %d not %d errors for %q", tc.Errors, len(errors), tc.ID) + } + }) + } +} diff --git a/azurerm/helpers/schema/app_service.go b/azurerm/helpers/schema/app_service.go new file mode 100644 index 0000000000000..243f9fbfe5770 --- /dev/null +++ b/azurerm/helpers/schema/app_service.go @@ -0,0 +1,366 @@ +package schema + +import ( + "log" + + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web" + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func AppServiceSiteConfigSchema() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "always_on": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + + "default_documents": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "dotnet_framework_version": { + Type: schema.TypeString, + Optional: true, + Default: "v4.0", + ValidateFunc: validation.StringInSlice([]string{ + "v2.0", + "v4.0", + }, true), + DiffSuppressFunc: IgnoreCaseDiffSuppressFunc, + }, + + "http2_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + + "ip_restriction": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ip_address": { + Type: schema.TypeString, + Required: true, + }, + "subnet_mask": { + Type: schema.TypeString, + Optional: true, + Default: "255.255.255.255", + }, + }, + }, + }, + + "java_version": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "1.7", + "1.8", + }, false), + }, + + "java_container": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "JETTY", + "TOMCAT", + }, true), + DiffSuppressFunc: IgnoreCaseDiffSuppressFunc, + }, + + "java_container_version": { + Type: schema.TypeString, + Optional: true, + }, + + "local_mysql_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + + "managed_pipeline_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + string(web.Classic), + string(web.Integrated), + }, true), + DiffSuppressFunc: IgnoreCaseDiffSuppressFunc, + }, + + "php_version": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "5.5", + "5.6", + "7.0", + "7.1", + }, false), + }, + + "python_version": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "2.7", + "3.4", + }, false), + }, + + "remote_debugging_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + + "remote_debugging_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "VS2012", + "VS2013", + "VS2015", + "VS2017", + }, true), + DiffSuppressFunc: IgnoreCaseDiffSuppressFunc, + }, + + "scm_type": { + Type: schema.TypeString, + Optional: true, + Default: string(web.ScmTypeNone), + ValidateFunc: validation.StringInSlice([]string{ + string(web.ScmTypeNone), + string(web.ScmTypeLocalGit), + }, false), + }, + + "use_32_bit_worker_process": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + + "websockets_enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + }, + }, + } +} + +func ExpandAppServiceSiteConfig(input interface{}) web.SiteConfig { + configs := input.([]interface{}) + siteConfig := web.SiteConfig{} + + if len(configs) == 0 { + return siteConfig + } + + config := configs[0].(map[string]interface{}) + + if v, ok := config["always_on"]; ok { + siteConfig.AlwaysOn = utils.Bool(v.(bool)) + } + + if v, ok := config["default_documents"]; ok { + input := v.([]interface{}) + + documents := make([]string, 0) + for _, document := range input { + documents = append(documents, document.(string)) + } + + siteConfig.DefaultDocuments = &documents + } + + if v, ok := config["dotnet_framework_version"]; ok { + siteConfig.NetFrameworkVersion = utils.String(v.(string)) + } + + if v, ok := config["java_version"]; ok { + siteConfig.JavaVersion = utils.String(v.(string)) + } + + if v, ok := config["java_container"]; ok { + siteConfig.JavaContainer = utils.String(v.(string)) + } + + if v, ok := config["java_container_version"]; ok { + siteConfig.JavaContainerVersion = utils.String(v.(string)) + } + + if v, ok := config["http2_enabled"]; ok { + siteConfig.HTTP20Enabled = utils.Bool(v.(bool)) + } + + if v, ok := config["ip_restriction"]; ok { + ipSecurityRestrictions := v.([]interface{}) + restrictions := make([]web.IPSecurityRestriction, 0) + + for _, ipSecurityRestriction := range ipSecurityRestrictions { + restriction := ipSecurityRestriction.(map[string]interface{}) + + ipAddress := restriction["ip_address"].(string) + mask := restriction["subnet_mask"].(string) + + restrictions = append(restrictions, web.IPSecurityRestriction{ + IPAddress: &ipAddress, + SubnetMask: &mask, + }) + } + siteConfig.IPSecurityRestrictions = &restrictions + } + + if v, ok := config["local_mysql_enabled"]; ok { + siteConfig.LocalMySQLEnabled = utils.Bool(v.(bool)) + } + + if v, ok := config["managed_pipeline_mode"]; ok { + siteConfig.ManagedPipelineMode = web.ManagedPipelineMode(v.(string)) + } + + if v, ok := config["php_version"]; ok { + siteConfig.PhpVersion = utils.String(v.(string)) + } + + if v, ok := config["python_version"]; ok { + siteConfig.PythonVersion = utils.String(v.(string)) + } + + if v, ok := config["remote_debugging_enabled"]; ok { + siteConfig.RemoteDebuggingEnabled = utils.Bool(v.(bool)) + } + + if v, ok := config["remote_debugging_version"]; ok { + siteConfig.RemoteDebuggingVersion = utils.String(v.(string)) + } + + if v, ok := config["use_32_bit_worker_process"]; ok { + siteConfig.Use32BitWorkerProcess = utils.Bool(v.(bool)) + } + + if v, ok := config["websockets_enabled"]; ok { + siteConfig.WebSocketsEnabled = utils.Bool(v.(bool)) + } + + if v, ok := config["scm_type"]; ok { + siteConfig.ScmType = web.ScmType(v.(string)) + } + + return siteConfig +} + +func FlattenAppServiceSiteConfig(input *web.SiteConfig) []interface{} { + results := make([]interface{}, 0) + result := make(map[string]interface{}, 0) + + if input == nil { + log.Printf("[DEBUG] SiteConfig is nil") + return results + } + + if input.AlwaysOn != nil { + result["always_on"] = *input.AlwaysOn + } + + if input.DefaultDocuments != nil { + documents := make([]string, 0) + for _, document := range *input.DefaultDocuments { + documents = append(documents, document) + } + + result["default_documents"] = documents + } + + if input.NetFrameworkVersion != nil { + result["dotnet_framework_version"] = *input.NetFrameworkVersion + } + + if input.JavaVersion != nil { + result["java_version"] = *input.JavaVersion + } + + if input.JavaContainer != nil { + result["java_container"] = *input.JavaContainer + } + + if input.JavaContainerVersion != nil { + result["java_container_version"] = *input.JavaContainerVersion + } + + if input.LocalMySQLEnabled != nil { + result["local_mysql_enabled"] = *input.LocalMySQLEnabled + } + + if input.HTTP20Enabled != nil { + result["http2_enabled"] = *input.HTTP20Enabled + } + + restrictions := make([]interface{}, 0) + if vs := input.IPSecurityRestrictions; vs != nil { + for _, v := range *vs { + result := make(map[string]interface{}, 0) + if ip := v.IPAddress; ip != nil { + result["ip_address"] = *ip + } + if subnet := v.SubnetMask; subnet != nil { + result["subnet_mask"] = *subnet + } + restrictions = append(restrictions, result) + } + } + result["ip_restriction"] = restrictions + + result["managed_pipeline_mode"] = string(input.ManagedPipelineMode) + + if input.PhpVersion != nil { + result["php_version"] = *input.PhpVersion + } + + if input.PythonVersion != nil { + result["python_version"] = *input.PythonVersion + } + + if input.RemoteDebuggingEnabled != nil { + result["remote_debugging_enabled"] = *input.RemoteDebuggingEnabled + } + + if input.RemoteDebuggingVersion != nil { + result["remote_debugging_version"] = *input.RemoteDebuggingVersion + } + + if input.Use32BitWorkerProcess != nil { + result["use_32_bit_worker_process"] = *input.Use32BitWorkerProcess + } + + if input.WebSocketsEnabled != nil { + result["websockets_enabled"] = *input.WebSocketsEnabled + } + + result["scm_type"] = string(input.ScmType) + + return append(results, result) +} diff --git a/azurerm/helpers/schema/diff_suppress_func.go b/azurerm/helpers/schema/diff_suppress_func.go new file mode 100644 index 0000000000000..a622ff7f74c08 --- /dev/null +++ b/azurerm/helpers/schema/diff_suppress_func.go @@ -0,0 +1,19 @@ +package schema + +import ( + "strings" + + "github.com/hashicorp/terraform/helper/schema" +) + +// ignoreCaseDiffSuppressFunc is a DiffSuppressFunc from helper/schema that is +// used to ignore any case-changes in a return value. +func IgnoreCaseDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { + return strings.ToLower(old) == strings.ToLower(new) +} + +// ignoreCaseStateFunc is a StateFunc from helper/schema that converts the +// supplied value to lower before saving to state for consistency. +func IgnoreCaseStateFunc(val interface{}) string { + return strings.ToLower(val.(string)) +} diff --git a/azurerm/helpers/set/set.go b/azurerm/helpers/set/set.go new file mode 100644 index 0000000000000..0968ad23de284 --- /dev/null +++ b/azurerm/helpers/set/set.go @@ -0,0 +1,35 @@ +package set + +import ( + "strconv" + "strings" + + "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/schema" +) + +func HashInt(v interface{}) int { + return hashcode.String(strconv.Itoa(v.(int))) +} + +func HashStringIgnoreCase(v interface{}) int { + return hashcode.String(strings.ToLower(v.(string))) +} + +func FromInt32Slice(slice []int32) *schema.Set { + set := &schema.Set{F: HashInt} + for _, v := range slice { + set.Add(int(v)) + } + + return set +} + +func ToSliceInt32P(set *schema.Set) *[]int32 { + var slice []int32 + for _, m := range set.List() { + slice = append(slice, int32(m.(int))) + } + + return &slice +} diff --git a/azurerm/helpers/suppress/string.go b/azurerm/helpers/suppress/string.go new file mode 100644 index 0000000000000..0726f7026fd8b --- /dev/null +++ b/azurerm/helpers/suppress/string.go @@ -0,0 +1,10 @@ +package suppress + +import ( + "github.com/hashicorp/terraform/helper/schema" + "strings" +) + +func CaseDifference(_, old, new string, _ *schema.ResourceData) bool { + return strings.ToLower(old) == strings.ToLower(new) +} diff --git a/azurerm/helpers/suppress/string_test.go b/azurerm/helpers/suppress/string_test.go new file mode 100644 index 0000000000000..805d9752d8912 --- /dev/null +++ b/azurerm/helpers/suppress/string_test.go @@ -0,0 +1,51 @@ +package suppress + +import "testing" + +func TestCaseDifference(t *testing.T) { + cases := []struct { + Name string + StringA string + StringB string + Suppress bool + }{ + { + Name: "empty", + StringA: "", + StringB: "", + Suppress: true, + }, + { + Name: "empty vs text", + StringA: "ye old text", + StringB: "", + Suppress: false, + }, + { + Name: "different text", + StringA: "ye old text?", + StringB: "ye different text", + Suppress: false, + }, + { + Name: "same text", + StringA: "ye same text!", + StringB: "ye same text!", + Suppress: true, + }, + { + Name: "same text different case", + StringA: "ye old text?", + StringB: "Ye OLD texT?", + Suppress: true, + }, + } + + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + if CaseDifference("test", tc.StringA, tc.StringB, nil) != tc.Suppress { + t.Fatalf("Expected CaseDifference to return %t for '%q' == '%q'", tc.Suppress, tc.StringA, tc.StringB) + } + }) + } +} diff --git a/azurerm/helpers/suppress/time.go b/azurerm/helpers/suppress/time.go new file mode 100644 index 0000000000000..95b3c8325e696 --- /dev/null +++ b/azurerm/helpers/suppress/time.go @@ -0,0 +1,18 @@ +package suppress + +import ( + "time" + + "github.com/hashicorp/terraform/helper/schema" +) + +func RFC3339Time(_, old, new string, _ *schema.ResourceData) bool { + ot, oerr := time.Parse(time.RFC3339, old) + nt, nerr := time.Parse(time.RFC3339, new) + + if oerr != nil || nerr != nil { + return false + } + + return nt.Equal(ot) +} diff --git a/azurerm/helpers/suppress/time_test.go b/azurerm/helpers/suppress/time_test.go new file mode 100644 index 0000000000000..2ada258212922 --- /dev/null +++ b/azurerm/helpers/suppress/time_test.go @@ -0,0 +1,57 @@ +package suppress + +import "testing" + +func TestRFC3339Time(t *testing.T) { + cases := []struct { + Name string + TimeA string + TimeB string + Suppress bool + }{ + { + Name: "empty", + TimeA: "", + TimeB: "", + Suppress: false, + }, + { + Name: "neither are time", + TimeA: "this is not a time", + TimeB: "neither is this", + Suppress: false, + }, + { + Name: "time vs text", + TimeA: "2000-01-01T01:23:45+00:00", + TimeB: "that is a valid time", + Suppress: false, + }, + { + Name: "two different times", + TimeA: "2000-01-01T01:23:45+00:00", + TimeB: "1984-07-07T01:23:45+00:00", + Suppress: false, + }, + { + Name: "same time, different zone 1", + TimeA: "2000-01-01T01:23:45+00:00", + TimeB: "2000-01-01T01:23:45Z", + Suppress: true, + }, + { + Name: "same time, different zone 2", + TimeA: "2000-01-01T01:23:45-08:00", + TimeB: "2000-01-01T09:23:45Z", + Suppress: true, + }, + } + + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + if RFC3339Time("test", tc.TimeA, tc.TimeB, nil) != tc.Suppress { + t.Fatalf("Expected RFC3339Time to return %t for '%q' == '%q'", tc.Suppress, tc.TimeA, tc.TimeB) + } + }) + } +} diff --git a/azurerm/helpers/validate/network.go b/azurerm/helpers/validate/network.go new file mode 100644 index 0000000000000..65d4fcec39bdf --- /dev/null +++ b/azurerm/helpers/validate/network.go @@ -0,0 +1,47 @@ +package validate + +import ( + "fmt" + "net" +) + +func IPv4Address(i interface{}, k string) (_ []string, errors []error) { + return validateIpv4Address(i, k, false) +} + +func IPv4AddressOrEmpty(i interface{}, k string) (_ []string, errors []error) { + return validateIpv4Address(i, k, true) +} + +func validateIpv4Address(i interface{}, k string, allowEmpty bool) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if v == "" && allowEmpty { + return + } + + ip := net.ParseIP(v) + if four := ip.To4(); four == nil { + errors = append(errors, fmt.Errorf("%q is not a valid IP4 address: %q", k, v)) + } + + return +} + +func MACAddress(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if _, err := net.ParseMAC(v); err != nil { + errors = append(errors, fmt.Errorf("%q is not a valid MAC address: %q (%v)", k, i, err)) + } + + return +} diff --git a/azurerm/helpers/validate/network_test.go b/azurerm/helpers/validate/network_test.go new file mode 100644 index 0000000000000..2e6e8ac55d9c3 --- /dev/null +++ b/azurerm/helpers/validate/network_test.go @@ -0,0 +1,149 @@ +package validate + +import "testing" + +func TestIPv4Address(t *testing.T) { + cases := []struct { + IP string + Errors int + }{ + { + IP: "", + Errors: 1, + }, + { + IP: "0.0.0.0", + Errors: 0, + }, + { + IP: "1.2.3.no", + Errors: 1, + }, + { + IP: "text", + Errors: 1, + }, + { + IP: "1.2.3.4", + Errors: 0, + }, + { + IP: "12.34.43.21", + Errors: 0, + }, + { + IP: "100.123.199.0", + Errors: 0, + }, + { + IP: "255.255.255.255", + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.IP, func(t *testing.T) { + _, errors := IPv4Address(tc.IP, "test") + + if len(errors) != tc.Errors { + t.Fatalf("Expected IPv4Address to return %d error(s) not %d", len(errors), tc.Errors) + } + }) + } +} + +func TestIPv4AddressOrEmpty(t *testing.T) { + cases := []struct { + IP string + Errors int + }{ + { + IP: "", + Errors: 0, + }, + { + IP: "0.0.0.0", + Errors: 0, + }, + { + IP: "1.2.3.no", + Errors: 1, + }, + { + IP: "text", + Errors: 1, + }, + { + IP: "1.2.3.4", + Errors: 0, + }, + { + IP: "12.34.43.21", + Errors: 0, + }, + { + IP: "100.123.199.0", + Errors: 0, + }, + { + IP: "255.255.255.255", + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.IP, func(t *testing.T) { + _, errors := IPv4AddressOrEmpty(tc.IP, "test") + + if len(errors) != tc.Errors { + t.Fatalf("Expected IPv4AddressOrEmpty to return %d error(s) not %d", len(errors), tc.Errors) + } + }) + } +} + +func TestMACAddress(t *testing.T) { + cases := []struct { + MAC string + Errors int + }{ + { + MAC: "", + Errors: 1, + }, + { + MAC: "text d", + Errors: 1, + }, + { + MAC: "12:34:no", + Errors: 1, + }, + { + MAC: "123:34:56:78:90:ab", + Errors: 1, + }, + { + MAC: "12:34:56:78:90:NO", + Errors: 1, + }, + { + MAC: "12:34:56:78:90:ab", + Errors: 0, + }, + { + MAC: "ab:cd:ef:AB:CD:EF", + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.MAC, func(t *testing.T) { + _, errors := MACAddress(tc.MAC, "test") + + if len(errors) != tc.Errors { + t.Fatalf("Expected MACAddress to return %d error(s) not %d", len(errors), tc.Errors) + } + }) + } +} diff --git a/azurerm/helpers/validate/time.go b/azurerm/helpers/validate/time.go new file mode 100644 index 0000000000000..01c960da7951a --- /dev/null +++ b/azurerm/helpers/validate/time.go @@ -0,0 +1,48 @@ +package validate + +import ( + "fmt" + "time" + + "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/terraform/helper/schema" +) + +//todo, now in terraform helper, switch over once vended +// -> https://github.com/hashicorp/terraform/blob/master/helper/validation/validation.go#L263 +func RFC3339Time(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if _, err := date.ParseTime(time.RFC3339, v); err != nil { + errors = append(errors, fmt.Errorf("%q has the invalid RFC3339 date format %q: %+v", k, i, err)) + } + + return +} + +// RFC3339 date is duration d or greater into the future +func RFC3339DateInFutureBy(d time.Duration) schema.SchemaValidateFunc { + return func(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + t, err := date.ParseTime(time.RFC3339, v) + if err != nil { + errors = append(errors, fmt.Errorf("%q has the invalid RFC3339 date format %q: %+v", k, i, err)) + return + } + + if time.Until(t) < d { + errors = append(errors, fmt.Errorf("%q is %q and should be at least %q in the future", k, i, d)) + } + + return + } +} diff --git a/azurerm/helpers/validate/time_test.go b/azurerm/helpers/validate/time_test.go new file mode 100644 index 0000000000000..7daf5a0ca5453 --- /dev/null +++ b/azurerm/helpers/validate/time_test.go @@ -0,0 +1,104 @@ +package validate + +import ( + "testing" + "time" +) + +func TestRFC3339Time(t *testing.T) { + cases := []struct { + Time string + Errors int + }{ + { + Time: "", + Errors: 1, + }, + { + Time: "this is not a date", + Errors: 1, + }, + { + Time: "2000-01-01", + Errors: 1, + }, + { + Time: "2000-01-01T01:23:45", + Errors: 1, + }, + { + Time: "2000-01-01T01:23:45Z", + Errors: 0, + }, + { + Time: "2000-01-01T01:23:45+00:00", + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.Time, func(t *testing.T) { + _, errors := RFC3339Time(tc.Time, "test") + + if len(errors) != tc.Errors { + t.Fatalf("Expected RFC3339Time to have %d not %d errors for %q", tc.Errors, len(errors), tc.Time) + } + }) + } +} + +func TestRfc3339DateInFutureBy(t *testing.T) { + cases := []struct { + Name string + Time string + Duration time.Duration + Errors int + }{ + { + Name: "empty", + Time: "", + Duration: time.Hour, + Errors: 1, + }, + { + Name: "not a time", + Time: "not a time", + Duration: time.Hour, + Errors: 1, + }, + { + Name: "now is not 1 hour ahead", + Time: time.Now().String(), + Duration: time.Hour, + Errors: 1, + }, + { + Name: "now + 7 hours is not 1 hour ahead", + Time: time.Now().Add(time.Hour * 7).String(), + Duration: time.Hour, + Errors: 1, + }, + { + Name: "now + 7 min is 7 min ahead", + Time: time.Now().Add(time.Minute).String(), + Duration: time.Minute * 7, + Errors: 0, + }, + { + Name: "now + 8 min is at least 7 min ahead", + Time: time.Now().Add(time.Minute).String(), + Duration: time.Minute * 7, + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + _, errors := RFC3339DateInFutureBy(tc.Duration)(tc.Time, "test") + + if len(errors) < tc.Errors { + t.Fatalf("Expected RFC3339DateInFutureBy to have %d not %d errors for %q in future by %q", tc.Errors, len(errors), tc.Time, tc.Duration.String()) + } + }) + } +} diff --git a/azurerm/helpers/validate/url.go b/azurerm/helpers/validate/url.go new file mode 100644 index 0000000000000..2fbacdcd27330 --- /dev/null +++ b/azurerm/helpers/validate/url.go @@ -0,0 +1,48 @@ +package validate + +import ( + "fmt" + "net/url" + "strings" + + "github.com/hashicorp/terraform/helper/schema" +) + +func URLIsHTTPOrHTTPS(i interface{}, k string) (_ []string, errors []error) { + return URLWithScheme([]string{"http", "https"})(i, k) +} + +func URLWithScheme(validSchemes []string) schema.SchemaValidateFunc { + return func(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if v == "" { + errors = append(errors, fmt.Errorf("expected %q url to not be empty", k)) + return + } + + url, err := url.Parse(v) + if err != nil { + errors = append(errors, fmt.Errorf("%q url is in an invalid format: %q (%+v)", k, v, err)) + return + } + + if url.Host == "" { + errors = append(errors, fmt.Errorf("%q url has no host: %q", k, v)) + return + } + + for _, s := range validSchemes { + if url.Scheme == s { + return //last check so just return + } + } + + errors = append(errors, fmt.Errorf("expected %q url %q to have a schema of: %q", k, v, strings.Join(validSchemes, ","))) + return + } +} diff --git a/azurerm/helpers/validate/url_test.go b/azurerm/helpers/validate/url_test.go new file mode 100644 index 0000000000000..e75e589dd07a1 --- /dev/null +++ b/azurerm/helpers/validate/url_test.go @@ -0,0 +1,47 @@ +package validate + +import ( + "testing" +) + +func TestURLIsHTTPOrHTTPS(t *testing.T) { + cases := []struct { + Url string + Errors int + }{ + { + Url: "", + Errors: 1, + }, + { + Url: "this is not a url", + Errors: 1, + }, + { + Url: "www.example.com", + Errors: 1, + }, + { + Url: "ftp://www.example.com", + Errors: 1, + }, + { + Url: "http://www.example.com", + Errors: 0, + }, + { + Url: "https://www.example.com", + Errors: 0, + }, + } + + for _, tc := range cases { + t.Run(tc.Url, func(t *testing.T) { + _, errors := URLIsHTTPOrHTTPS(tc.Url, "test") + + if len(errors) != tc.Errors { + t.Fatalf("Expected URLIsHTTPOrHTTPS to have %d not %d errors for %q", tc.Errors, len(errors), tc.Url) + } + }) + } +} diff --git a/azurerm/helpers/validate/validate.go b/azurerm/helpers/validate/validate.go new file mode 100644 index 0000000000000..1fde2d3a9e01b --- /dev/null +++ b/azurerm/helpers/validate/validate.go @@ -0,0 +1,71 @@ +package validate + +import ( + "fmt" + "net/url" + + "strings" + + "github.com/hashicorp/terraform/helper/schema" +) + +func IntBetweenAndNot(min, max, not int) schema.SchemaValidateFunc { + return func(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(int) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be int", k)) + return + } + + if v < min || v > max { + errors = append(errors, fmt.Errorf("expected %s to be in the range (%d - %d), got %d", k, min, max, v)) + return + } + + if v == not { + errors = append(errors, fmt.Errorf("expected %s to not be %d, got %d", k, not, v)) + return + } + + return + } +} + +func UrlIsHttpOrHttps() schema.SchemaValidateFunc { + return UrlWithScheme([]string{"http", "https"}) +} + +func UrlWithScheme(validSchemes []string) schema.SchemaValidateFunc { + return func(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + url, err := url.Parse(v) + if err != nil { + errors = append(errors, fmt.Errorf("%q url is in an invalid format: %q (%+v)", k, i, err)) + return + } + + if url.Host == "" { + errors = append(errors, fmt.Errorf("%q url has no host: %q", k, url)) + } + + found := false + for _, s := range validSchemes { + if strings.EqualFold(url.Scheme, s) { + found = true + break + } + } + + if !found { + schemes := strings.Join(validSchemes, ",") + errors = append(errors, fmt.Errorf("URL scheme %q isn't valid - supported scheme's are %q", url.Scheme, schemes)) + } + + return + } +} diff --git a/azurerm/helpers/validate/validate_test.go b/azurerm/helpers/validate/validate_test.go new file mode 100644 index 0000000000000..4011884c879f9 --- /dev/null +++ b/azurerm/helpers/validate/validate_test.go @@ -0,0 +1,45 @@ +package validate + +import "testing" + +func TestUrlWithScheme(t *testing.T) { + validSchemes := []string{"example"} + testCases := []struct { + Url string + ShouldHaveError bool + }{ + { + Url: "example://mysite.com", + ShouldHaveError: false, + }, + { + Url: "http://mysite.com", + ShouldHaveError: true, + }, + { + Url: "example://", + ShouldHaveError: true, + }, + { + Url: "example://validhost", + ShouldHaveError: false, + }, + } + + t.Run("TestUrlWithScheme", func(t *testing.T) { + for _, v := range testCases { + _, errors := UrlWithScheme(validSchemes)(v.Url, "field_name") + + hasErrors := len(errors) > 0 + if v.ShouldHaveError && !hasErrors { + t.Fatalf("Expected an error but didn't get one for %q", v.Url) + return + } + + if !v.ShouldHaveError && hasErrors { + t.Fatalf("Expected %q to return no errors, but got some %+v", v.Url, errors) + return + } + } + }) +} diff --git a/azurerm/import_arm_automation_credential_test.go b/azurerm/import_arm_automation_credential_test.go deleted file mode 100644 index 0fbc3a382a40b..0000000000000 --- a/azurerm/import_arm_automation_credential_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package azurerm - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccAzureRMAutomationCredential_importCredential(t *testing.T) { - resourceName := "azurerm_automation_credential.test" - - ri := acctest.RandInt() - config := testAccAzureRMAutomationCredential_complete(ri, testLocation()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testCheckAzureRMAutomationCredentialDestroy, - Steps: []resource.TestStep{ - { - Config: config, - }, - - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, - }, - }, - }) -} diff --git a/azurerm/import_arm_automation_runbook_test.go b/azurerm/import_arm_automation_runbook_test.go deleted file mode 100644 index d4d464948b460..0000000000000 --- a/azurerm/import_arm_automation_runbook_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package azurerm - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccAzureRMAutomationRunbook_importRunbookPSWorkflow(t *testing.T) { - resourceName := "azurerm_automation_runbook.test" - - ri := acctest.RandInt() - config := testAccAzureRMAutomationRunbook_PSWorkflow(ri, testLocation()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testCheckAzureRMAutomationRunbookDestroy, - Steps: []resource.TestStep{ - { - Config: config, - }, - - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"publish_content_link"}, - }, - }, - }) -} diff --git a/azurerm/import_arm_automation_account_test.go b/azurerm/import_arm_dns_caa_record_test.go similarity index 61% rename from azurerm/import_arm_automation_account_test.go rename to azurerm/import_arm_dns_caa_record_test.go index 780b9860130db..68a114305e6bc 100644 --- a/azurerm/import_arm_automation_account_test.go +++ b/azurerm/import_arm_dns_caa_record_test.go @@ -7,21 +7,20 @@ import ( "github.com/hashicorp/terraform/helper/resource" ) -func TestAccAzureRMAutomationAccount_importBasic(t *testing.T) { - resourceName := "azurerm_automation_account.test" +func TestAccAzureRMDnsCaaRecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_caa_record.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationAccount_basic(ri, testLocation()) + config := testAccAzureRMDnsCaaRecord_basic(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testCheckAzureRMAutomationAccountDestroy, + CheckDestroy: testCheckAzureRMDnsCaaRecordDestroy, Steps: []resource.TestStep{ { Config: config, }, - { ResourceName: resourceName, ImportState: true, @@ -31,21 +30,20 @@ func TestAccAzureRMAutomationAccount_importBasic(t *testing.T) { }) } -func TestAccAzureRMAutomationAccount_importComplete(t *testing.T) { - resourceName := "azurerm_automation_account.test" +func TestAccAzureRMDnsCaaRecord_importWithTags(t *testing.T) { + resourceName := "azurerm_dns_caa_record.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationAccount_complete(ri, testLocation()) + config := testAccAzureRMDnsCaaRecord_withTags(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testCheckAzureRMAutomationAccountDestroy, + CheckDestroy: testCheckAzureRMDnsCaaRecordDestroy, Steps: []resource.TestStep{ { Config: config, }, - { ResourceName: resourceName, ImportState: true, diff --git a/azurerm/import_arm_dns_zone_test.go b/azurerm/import_arm_dns_zone_test.go index c5e2a8ad0e4f3..58b6a943c94d7 100644 --- a/azurerm/import_arm_dns_zone_test.go +++ b/azurerm/import_arm_dns_zone_test.go @@ -30,6 +30,29 @@ func TestAccAzureRMDnsZone_importBasic(t *testing.T) { }) } +func TestAccAzureRMDnsZone_importBasicWithVNets(t *testing.T) { + resourceName := "azurerm_dns_zone.test" + + ri := acctest.RandInt() + config := testAccAzureRMDnsZone_withVNets(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsZoneDestroy, + Steps: []resource.TestStep{ + { + Config: config, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAzureRMDnsZone_importBasicWithTags(t *testing.T) { resourceName := "azurerm_dns_zone.test" diff --git a/azurerm/import_arm_mysql_server_test.go b/azurerm/import_arm_mysql_server_test.go index 4e4decfc64d30..c3d0ce6115c6f 100644 --- a/azurerm/import_arm_mysql_server_test.go +++ b/azurerm/import_arm_mysql_server_test.go @@ -59,11 +59,37 @@ func TestAccAzureRMMySQLServer_importBasicFiveSeven(t *testing.T) { }) } -func TestAccAzureRMMySQLServer_importStandard(t *testing.T) { +func TestAccAzureRMMySQLServer_importGeneralPurpose(t *testing.T) { resourceName := "azurerm_mysql_server.test" ri := acctest.RandInt() - config := testAccAzureRMMySQLServer_standard(ri, testLocation()) + config := testAccAzureRMMySQLServer_generalPurpose(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMMySQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: config, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "administrator_login_password", // not returned as sensitive + }, + }, + }, + }) +} + +func TestAccAzureRMMySqlServer_importMemoryOptimized(t *testing.T) { + resourceName := "azurerm_mysql_server.test" + + ri := acctest.RandInt() + config := testAccAzureRMMySQLServer_memoryOptimized(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, diff --git a/azurerm/import_arm_postgresql_server_test.go b/azurerm/import_arm_postgresql_server_test.go index 6a178b8ae8605..b349e7759f0af 100644 --- a/azurerm/import_arm_postgresql_server_test.go +++ b/azurerm/import_arm_postgresql_server_test.go @@ -59,11 +59,37 @@ func TestAccAzureRMPostgreSQLServer_importBasicNinePointSix(t *testing.T) { }) } -func TestAccAzureRMPostgreSQLServer_importStandard(t *testing.T) { +func TestAccAzureRMPostgreSQLServer_importGeneralPurpose(t *testing.T) { resourceName := "azurerm_postgresql_server.test" ri := acctest.RandInt() - config := testAccAzureRMPostgreSQLServer_standard(ri, testLocation()) + config := testAccAzureRMPostgreSQLServer_generalPurpose(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: config, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "administrator_login_password", // not returned as sensitive + }, + }, + }, + }) +} + +func TestAccAzureRMPostgreSQLServer_importMemoryOptimized(t *testing.T) { + resourceName := "azurerm_postgresql_server.test" + + ri := acctest.RandInt() + config := testAccAzureRMPostgreSQLServer_memoryOptimized(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, diff --git a/azurerm/import_arm_public_ip_test.go b/azurerm/import_arm_public_ip_test.go index 77020be7dec66..629bd531e2a39 100644 --- a/azurerm/import_arm_public_ip_test.go +++ b/azurerm/import_arm_public_ip_test.go @@ -56,6 +56,30 @@ func TestAccAzureRMPublicIpStatic_importBasic_withZone(t *testing.T) { }) } +func TestAccAzureRMPublicIpStatic_importBasic_withDNSLabel(t *testing.T) { + resourceName := "azurerm_public_ip.test" + + ri := acctest.RandInt() + dnl := fmt.Sprintf("acctestdnl-%d", ri) + config := testAccAzureRMPublicIPStatic_basic_withDNSLabel(ri, testLocation(), dnl) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPublicIpDestroy, + Steps: []resource.TestStep{ + { + Config: config, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAzureRMPublicIpStatic_importIdError(t *testing.T) { resourceName := "azurerm_public_ip.test" diff --git a/azurerm/import_arm_storage_account_test.go b/azurerm/import_arm_storage_account_test.go index 652d4f73db1e9..2dfb535b09707 100644 --- a/azurerm/import_arm_storage_account_test.go +++ b/azurerm/import_arm_storage_account_test.go @@ -155,3 +155,28 @@ func TestAccAzureRMStorageAccount_importEnableHttpsTrafficOnly(t *testing.T) { }, }) } + +func TestAccAzureRMStorageAccount_importNetworkRules(t *testing.T) { + resourceName := "azurerm_storage_account.testsa" + + ri := acctest.RandInt() + rs := acctest.RandString(4) + config := testAccAzureRMStorageAccount_networkRules(ri, rs, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMStorageAccountDestroy, + Steps: []resource.TestStep{ + { + Config: config, + }, + + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/azurerm/import_arm_automation_schedule_test.go b/azurerm/import_arm_user_assigned_identity_test.go similarity index 59% rename from azurerm/import_arm_automation_schedule_test.go rename to azurerm/import_arm_user_assigned_identity_test.go index e814c09b5cefc..325ca34d86abd 100644 --- a/azurerm/import_arm_automation_schedule_test.go +++ b/azurerm/import_arm_user_assigned_identity_test.go @@ -7,21 +7,22 @@ import ( "github.com/hashicorp/terraform/helper/resource" ) -func TestAccAzureRMAutomationSchedule_importScheduleOneTime(t *testing.T) { - resourceName := "azurerm_automation_schedule.test" +func TestAccAzureRMUserAssignedIdentity_importBasic(t *testing.T) { + resourceName := "azurerm_user_assigned_identity.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationSchedule_oneTime(ri, testLocation()) + location := testLocation() + rs := acctest.RandString(14) + config := testAccAzureRMUserAssignedIdentity_basic(ri, location, rs) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, + CheckDestroy: testCheckAzureRMUserAssignedIdentityDestroy, Steps: []resource.TestStep{ { Config: config, }, - { ResourceName: resourceName, ImportState: true, @@ -30,3 +31,5 @@ func TestAccAzureRMAutomationSchedule_importScheduleOneTime(t *testing.T) { }, }) } + +// diff --git a/azurerm/import_arm_virtual_machine_data_disk_attachment_test.go b/azurerm/import_arm_virtual_machine_data_disk_attachment_test.go new file mode 100644 index 0000000000000..e11cb4bb1b6a2 --- /dev/null +++ b/azurerm/import_arm_virtual_machine_data_disk_attachment_test.go @@ -0,0 +1,58 @@ +package azurerm + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMVirtualMachineDataDiskAttachment_importBasic(t *testing.T) { + resourceName := "azurerm_virtual_machine_data_disk_attachment.test" + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMVirtualMachineDataDiskAttachment_basic(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDataDiskAttachmentDestroy, + Steps: []resource.TestStep{ + { + Config: config, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineDataDiskAttachment_importMultipleDisks(t *testing.T) { + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMVirtualMachineDataDiskAttachment_multipleDisks(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDataDiskAttachmentDestroy, + Steps: []resource.TestStep{ + { + Config: config, + }, + { + ResourceName: "azurerm_virtual_machine_data_disk_attachment.first", + ImportState: true, + ImportStateVerify: true, + }, + { + ResourceName: "azurerm_virtual_machine_data_disk_attachment.second", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/azurerm/loadbalancer.go b/azurerm/loadbalancer.go index ed2e8e48d9efb..53f83da8abf26 100644 --- a/azurerm/loadbalancer.go +++ b/azurerm/loadbalancer.go @@ -7,7 +7,7 @@ import ( "regexp" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" diff --git a/azurerm/provider.go b/azurerm/provider.go index b854fe93029de..5a3a6d52c0400 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/authentication" + azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/schema" ) // Provider returns a terraform.ResourceProvider. @@ -115,121 +116,125 @@ func Provider() terraform.ResourceProvider { }, ResourcesMap: map[string]*schema.Resource{ - "azurerm_azuread_application": resourceArmActiveDirectoryApplication(), - "azurerm_application_gateway": resourceArmApplicationGateway(), - "azurerm_application_insights": resourceArmApplicationInsights(), - "azurerm_application_security_group": resourceArmApplicationSecurityGroup(), - "azurerm_app_service": resourceArmAppService(), - "azurerm_app_service_plan": resourceArmAppServicePlan(), - "azurerm_app_service_active_slot": resourceArmAppServiceActiveSlot(), - "azurerm_app_service_custom_hostname_binding": resourceArmAppServiceCustomHostnameBinding(), - "azurerm_app_service_slot": resourceArmAppServiceSlot(), - "azurerm_automation_account": resourceArmAutomationAccount(), - "azurerm_automation_credential": resourceArmAutomationCredential(), - "azurerm_automation_runbook": resourceArmAutomationRunbook(), - "azurerm_automation_schedule": resourceArmAutomationSchedule(), - "azurerm_availability_set": resourceArmAvailabilitySet(), - "azurerm_cdn_endpoint": resourceArmCdnEndpoint(), - "azurerm_cdn_profile": resourceArmCdnProfile(), - "azurerm_container_registry": resourceArmContainerRegistry(), - "azurerm_container_service": resourceArmContainerService(), - "azurerm_container_group": resourceArmContainerGroup(), - "azurerm_cosmosdb_account": resourceArmCosmosDBAccount(), - "azurerm_data_lake_store": resourceArmDataLakeStore(), - "azurerm_dns_a_record": resourceArmDnsARecord(), - "azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(), - "azurerm_dns_cname_record": resourceArmDnsCNameRecord(), - "azurerm_dns_mx_record": resourceArmDnsMxRecord(), - "azurerm_dns_ns_record": resourceArmDnsNsRecord(), - "azurerm_dns_ptr_record": resourceArmDnsPtrRecord(), - "azurerm_dns_srv_record": resourceArmDnsSrvRecord(), - "azurerm_dns_txt_record": resourceArmDnsTxtRecord(), - "azurerm_dns_zone": resourceArmDnsZone(), - "azurerm_eventgrid_topic": resourceArmEventGridTopic(), - "azurerm_eventhub": resourceArmEventHub(), - "azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(), - "azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(), - "azurerm_eventhub_namespace": resourceArmEventHubNamespace(), - "azurerm_express_route_circuit": resourceArmExpressRouteCircuit(), - "azurerm_express_route_circuit_authorization": resourceArmExpressRouteCircuitAuthorization(), - "azurerm_express_route_circuit_peering": resourceArmExpressRouteCircuitPeering(), - "azurerm_function_app": resourceArmFunctionApp(), - "azurerm_image": resourceArmImage(), - "azurerm_iothub": resourceArmIotHub(), - "azurerm_key_vault": resourceArmKeyVault(), - "azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(), - "azurerm_key_vault_key": resourceArmKeyVaultKey(), - "azurerm_key_vault_secret": resourceArmKeyVaultSecret(), - "azurerm_kubernetes_cluster": resourceArmKubernetesCluster(), - "azurerm_lb": resourceArmLoadBalancer(), - "azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(), - "azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(), - "azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(), - "azurerm_lb_probe": resourceArmLoadBalancerProbe(), - "azurerm_lb_rule": resourceArmLoadBalancerRule(), - "azurerm_local_network_gateway": resourceArmLocalNetworkGateway(), - "azurerm_log_analytics_solution": resourceArmLogAnalyticsSolution(), - "azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(), - "azurerm_managed_disk": resourceArmManagedDisk(), - "azurerm_management_lock": resourceArmManagementLock(), - "azurerm_metric_alertrule": resourceArmMetricAlertRule(), - "azurerm_mysql_configuration": resourceArmMySQLConfiguration(), - "azurerm_mysql_database": resourceArmMySqlDatabase(), - "azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(), - "azurerm_mysql_server": resourceArmMySqlServer(), - "azurerm_network_interface": resourceArmNetworkInterface(), - "azurerm_network_security_group": resourceArmNetworkSecurityGroup(), - "azurerm_network_security_rule": resourceArmNetworkSecurityRule(), - "azurerm_network_watcher": resourceArmNetworkWatcher(), - "azurerm_packet_capture": resourceArmPacketCapture(), - "azurerm_policy_assignment": resourceArmPolicyAssignment(), - "azurerm_policy_definition": resourceArmPolicyDefinition(), - "azurerm_postgresql_configuration": resourceArmPostgreSQLConfiguration(), - "azurerm_postgresql_database": resourceArmPostgreSQLDatabase(), - "azurerm_postgresql_firewall_rule": resourceArmPostgreSQLFirewallRule(), - "azurerm_postgresql_server": resourceArmPostgreSQLServer(), - "azurerm_public_ip": resourceArmPublicIp(), - "azurerm_relay_namespace": resourceArmRelayNamespace(), - "azurerm_recovery_services_vault": resourceArmRecoveryServicesVault(), - "azurerm_redis_cache": resourceArmRedisCache(), - "azurerm_redis_firewall_rule": resourceArmRedisFirewallRule(), - "azurerm_resource_group": resourceArmResourceGroup(), - "azurerm_role_assignment": resourceArmRoleAssignment(), - "azurerm_role_definition": resourceArmRoleDefinition(), - "azurerm_route": resourceArmRoute(), - "azurerm_route_table": resourceArmRouteTable(), - "azurerm_search_service": resourceArmSearchService(), - "azurerm_servicebus_namespace": resourceArmServiceBusNamespace(), - "azurerm_servicebus_queue": resourceArmServiceBusQueue(), - "azurerm_servicebus_subscription": resourceArmServiceBusSubscription(), - "azurerm_servicebus_subscription_rule": resourceArmServiceBusSubscriptionRule(), - "azurerm_servicebus_topic": resourceArmServiceBusTopic(), - "azurerm_servicebus_topic_authorization_rule": resourceArmServiceBusTopicAuthorizationRule(), - "azurerm_snapshot": resourceArmSnapshot(), - "azurerm_scheduler_job_collection": resourceArmSchedulerJobCollection(), - "azurerm_sql_database": resourceArmSqlDatabase(), - "azurerm_sql_elasticpool": resourceArmSqlElasticPool(), - "azurerm_sql_firewall_rule": resourceArmSqlFirewallRule(), - "azurerm_sql_active_directory_administrator": resourceArmSqlAdministrator(), - "azurerm_sql_server": resourceArmSqlServer(), - "azurerm_sql_virtual_network_rule": resourceArmSqlVirtualNetworkRule(), - "azurerm_storage_account": resourceArmStorageAccount(), - "azurerm_storage_blob": resourceArmStorageBlob(), - "azurerm_storage_container": resourceArmStorageContainer(), - "azurerm_storage_share": resourceArmStorageShare(), - "azurerm_storage_queue": resourceArmStorageQueue(), - "azurerm_storage_table": resourceArmStorageTable(), - "azurerm_subnet": resourceArmSubnet(), - "azurerm_template_deployment": resourceArmTemplateDeployment(), - "azurerm_traffic_manager_endpoint": resourceArmTrafficManagerEndpoint(), - "azurerm_traffic_manager_profile": resourceArmTrafficManagerProfile(), - "azurerm_virtual_machine_extension": resourceArmVirtualMachineExtensions(), - "azurerm_virtual_machine": resourceArmVirtualMachine(), - "azurerm_virtual_machine_scale_set": resourceArmVirtualMachineScaleSet(), - "azurerm_virtual_network": resourceArmVirtualNetwork(), - "azurerm_virtual_network_gateway": resourceArmVirtualNetworkGateway(), - "azurerm_virtual_network_gateway_connection": resourceArmVirtualNetworkGatewayConnection(), - "azurerm_virtual_network_peering": resourceArmVirtualNetworkPeering(), + "azurerm_application_gateway": resourceArmApplicationGateway(), + "azurerm_application_insights": resourceArmApplicationInsights(), + "azurerm_application_security_group": resourceArmApplicationSecurityGroup(), + "azurerm_app_service": resourceArmAppService(), + "azurerm_app_service_plan": resourceArmAppServicePlan(), + "azurerm_app_service_active_slot": resourceArmAppServiceActiveSlot(), + "azurerm_app_service_custom_hostname_binding": resourceArmAppServiceCustomHostnameBinding(), + "azurerm_app_service_slot": resourceArmAppServiceSlot(), + "azurerm_automation_account": resourceArmAutomationAccount(), + "azurerm_automation_credential": resourceArmAutomationCredential(), + "azurerm_automation_runbook": resourceArmAutomationRunbook(), + "azurerm_automation_schedule": resourceArmAutomationSchedule(), + "azurerm_availability_set": resourceArmAvailabilitySet(), + "azurerm_azuread_application": resourceArmActiveDirectoryApplication(), + "azurerm_cdn_endpoint": resourceArmCdnEndpoint(), + "azurerm_cdn_profile": resourceArmCdnProfile(), + "azurerm_container_registry": resourceArmContainerRegistry(), + "azurerm_container_service": resourceArmContainerService(), + "azurerm_container_group": resourceArmContainerGroup(), + "azurerm_cosmosdb_account": resourceArmCosmosDBAccount(), + "azurerm_data_lake_store": resourceArmDataLakeStore(), + "azurerm_dns_a_record": resourceArmDnsARecord(), + "azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(), + "azurerm_dns_caa_record": resourceArmDnsCaaRecord(), + "azurerm_dns_cname_record": resourceArmDnsCNameRecord(), + "azurerm_dns_mx_record": resourceArmDnsMxRecord(), + "azurerm_dns_ns_record": resourceArmDnsNsRecord(), + "azurerm_dns_ptr_record": resourceArmDnsPtrRecord(), + "azurerm_dns_srv_record": resourceArmDnsSrvRecord(), + "azurerm_dns_txt_record": resourceArmDnsTxtRecord(), + "azurerm_dns_zone": resourceArmDnsZone(), + "azurerm_eventgrid_topic": resourceArmEventGridTopic(), + "azurerm_eventhub": resourceArmEventHub(), + "azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(), + "azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(), + "azurerm_eventhub_namespace": resourceArmEventHubNamespace(), + "azurerm_express_route_circuit": resourceArmExpressRouteCircuit(), + "azurerm_express_route_circuit_authorization": resourceArmExpressRouteCircuitAuthorization(), + "azurerm_express_route_circuit_peering": resourceArmExpressRouteCircuitPeering(), + "azurerm_function_app": resourceArmFunctionApp(), + "azurerm_image": resourceArmImage(), + "azurerm_iothub": resourceArmIotHub(), + "azurerm_key_vault": resourceArmKeyVault(), + "azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(), + "azurerm_key_vault_key": resourceArmKeyVaultKey(), + "azurerm_key_vault_secret": resourceArmKeyVaultSecret(), + "azurerm_kubernetes_cluster": resourceArmKubernetesCluster(), + "azurerm_lb": resourceArmLoadBalancer(), + "azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(), + "azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(), + "azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(), + "azurerm_lb_probe": resourceArmLoadBalancerProbe(), + "azurerm_lb_rule": resourceArmLoadBalancerRule(), + "azurerm_local_network_gateway": resourceArmLocalNetworkGateway(), + "azurerm_log_analytics_solution": resourceArmLogAnalyticsSolution(), + "azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(), + "azurerm_managed_disk": resourceArmManagedDisk(), + "azurerm_management_lock": resourceArmManagementLock(), + "azurerm_metric_alertrule": resourceArmMetricAlertRule(), + "azurerm_mysql_configuration": resourceArmMySQLConfiguration(), + "azurerm_mysql_database": resourceArmMySqlDatabase(), + "azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(), + "azurerm_mysql_server": resourceArmMySqlServer(), + "azurerm_network_interface": resourceArmNetworkInterface(), + "azurerm_network_security_group": resourceArmNetworkSecurityGroup(), + "azurerm_network_security_rule": resourceArmNetworkSecurityRule(), + "azurerm_network_watcher": resourceArmNetworkWatcher(), + "azurerm_packet_capture": resourceArmPacketCapture(), + "azurerm_policy_assignment": resourceArmPolicyAssignment(), + "azurerm_policy_definition": resourceArmPolicyDefinition(), + "azurerm_postgresql_configuration": resourceArmPostgreSQLConfiguration(), + "azurerm_postgresql_database": resourceArmPostgreSQLDatabase(), + "azurerm_postgresql_firewall_rule": resourceArmPostgreSQLFirewallRule(), + "azurerm_postgresql_server": resourceArmPostgreSQLServer(), + "azurerm_public_ip": resourceArmPublicIp(), + "azurerm_relay_namespace": resourceArmRelayNamespace(), + "azurerm_recovery_services_vault": resourceArmRecoveryServicesVault(), + "azurerm_redis_cache": resourceArmRedisCache(), + "azurerm_redis_firewall_rule": resourceArmRedisFirewallRule(), + "azurerm_resource_group": resourceArmResourceGroup(), + "azurerm_role_assignment": resourceArmRoleAssignment(), + "azurerm_role_definition": resourceArmRoleDefinition(), + "azurerm_route": resourceArmRoute(), + "azurerm_route_table": resourceArmRouteTable(), + "azurerm_search_service": resourceArmSearchService(), + "azurerm_servicebus_namespace": resourceArmServiceBusNamespace(), + "azurerm_servicebus_queue": resourceArmServiceBusQueue(), + "azurerm_servicebus_subscription": resourceArmServiceBusSubscription(), + "azurerm_servicebus_subscription_rule": resourceArmServiceBusSubscriptionRule(), + "azurerm_servicebus_topic": resourceArmServiceBusTopic(), + "azurerm_servicebus_topic_authorization_rule": resourceArmServiceBusTopicAuthorizationRule(), + "azurerm_snapshot": resourceArmSnapshot(), + "azurerm_scheduler_job": resourceArmSchedulerJob(), + "azurerm_scheduler_job_collection": resourceArmSchedulerJobCollection(), + "azurerm_sql_database": resourceArmSqlDatabase(), + "azurerm_sql_elasticpool": resourceArmSqlElasticPool(), + "azurerm_sql_firewall_rule": resourceArmSqlFirewallRule(), + "azurerm_sql_active_directory_administrator": resourceArmSqlAdministrator(), + "azurerm_sql_server": resourceArmSqlServer(), + "azurerm_sql_virtual_network_rule": resourceArmSqlVirtualNetworkRule(), + "azurerm_storage_account": resourceArmStorageAccount(), + "azurerm_storage_blob": resourceArmStorageBlob(), + "azurerm_storage_container": resourceArmStorageContainer(), + "azurerm_storage_share": resourceArmStorageShare(), + "azurerm_storage_queue": resourceArmStorageQueue(), + "azurerm_storage_table": resourceArmStorageTable(), + "azurerm_subnet": resourceArmSubnet(), + "azurerm_template_deployment": resourceArmTemplateDeployment(), + "azurerm_traffic_manager_endpoint": resourceArmTrafficManagerEndpoint(), + "azurerm_traffic_manager_profile": resourceArmTrafficManagerProfile(), + "azurerm_user_assigned_identity": resourceArmUserAssignedIdentity(), + "azurerm_virtual_machine": resourceArmVirtualMachine(), + "azurerm_virtual_machine_data_disk_attachment": resourceArmVirtualMachineDataDiskAttachment(), + "azurerm_virtual_machine_extension": resourceArmVirtualMachineExtensions(), + "azurerm_virtual_machine_scale_set": resourceArmVirtualMachineScaleSet(), + "azurerm_virtual_network": resourceArmVirtualNetwork(), + "azurerm_virtual_network_gateway": resourceArmVirtualNetworkGateway(), + "azurerm_virtual_network_gateway_connection": resourceArmVirtualNetworkGatewayConnection(), + "azurerm_virtual_network_peering": resourceArmVirtualNetworkPeering(), }, } @@ -346,6 +351,7 @@ func determineAzureResourceProvidersToRegister(providerList []resources.Provider "Microsoft.EventHub": {}, "Microsoft.KeyVault": {}, "microsoft.insights": {}, + "Microsoft.ManagedIdentity": {}, "Microsoft.Network": {}, "Microsoft.OperationalInsights": {}, "Microsoft.Relay": {}, @@ -400,10 +406,9 @@ func registerAzureResourceProvidersWithSubscription(ctx context.Context, provide // armMutexKV is the instance of MutexKV for ARM resources var armMutexKV = mutexkv.NewMutexKV() -// ignoreCaseDiffSuppressFunc is a DiffSuppressFunc from helper/schema that is -// used to ignore any case-changes in a return value. +// Deprecated - use `azschema.IgnoreCaseDiffSuppressFunc` instead func ignoreCaseDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - return strings.ToLower(old) == strings.ToLower(new) + return azSchema.IgnoreCaseDiffSuppressFunc(k, old, new, d) } // ignoreCaseStateFunc is a StateFunc from helper/schema that converts the diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 193f9a063d69f..875ee712771c4 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -8,6 +8,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -66,147 +67,7 @@ func resourceArmAppService() *schema.Resource { ForceNew: true, }, - // TODO: reusable schema - "site_config": { - Type: schema.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "always_on": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "default_documents": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - "dotnet_framework_version": { - Type: schema.TypeString, - Optional: true, - Default: "v4.0", - ValidateFunc: validation.StringInSlice([]string{ - "v2.0", - "v4.0", - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "http2_enabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "java_version": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "1.7", - "1.8", - }, false), - }, - - "java_container": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "JETTY", - "TOMCAT", - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "java_container_version": { - Type: schema.TypeString, - Optional: true, - }, - - "local_mysql_enabled": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, - - "managed_pipeline_mode": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - string(web.Classic), - string(web.Integrated), - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "php_version": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "5.5", - "5.6", - "7.0", - "7.1", - }, false), - }, - - "python_version": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "2.7", - "3.4", - }, false), - }, - - "remote_debugging_enabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "remote_debugging_version": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "VS2012", - "VS2013", - "VS2015", - "VS2017", - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "scm_type": { - Type: schema.TypeString, - Optional: true, - Default: string(web.ScmTypeNone), - ValidateFunc: validation.StringInSlice([]string{ - string(web.ScmTypeNone), - string(web.ScmTypeLocalGit), - }, false), - }, - - "use_32_bit_worker_process": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, - - "websockets_enabled": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, - }, - }, - }, + "site_config": azSchema.AppServiceSiteConfigSchema(), "client_affinity_enabled": { Type: schema.TypeBool, @@ -214,25 +75,6 @@ func resourceArmAppService() *schema.Resource { Computed: true, }, - "ip_restriction": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ip_address": { - Type: schema.TypeString, - Required: true, - }, - "subnet_mask": { - Type: schema.TypeString, - Optional: true, - Default: "255.255.255.255", - }, - }, - }, - }, - "https_only": { Type: schema.TypeBool, Optional: true, @@ -366,7 +208,7 @@ func resourceArmAppServiceCreate(d *schema.ResourceData, meta interface{}) error httpsOnly := d.Get("https_only").(bool) tags := d.Get("tags").(map[string]interface{}) - siteConfig := expandAppServiceSiteConfig(d) + siteConfig := azSchema.ExpandAppServiceSiteConfig(d.Get("site_config")) siteEnvelope := web.Site{ Location: &location, @@ -430,7 +272,7 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error httpsOnly := d.Get("https_only").(bool) tags := d.Get("tags").(map[string]interface{}) - siteConfig := expandAppServiceSiteConfig(d) + siteConfig := azSchema.ExpandAppServiceSiteConfig(d.Get("site_config")) siteEnvelope := web.Site{ Location: &location, Tags: expandTags(tags), @@ -452,9 +294,9 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error return err } - if d.HasChange("site_config") || d.HasChange("ip_restriction") { + if d.HasChange("site_config") { // update the main configuration - siteConfig := expandAppServiceSiteConfig(d) + siteConfig := azSchema.ExpandAppServiceSiteConfig(d.Get("site_config")) siteConfigResource := web.SiteConfigResource{ SiteConfig: &siteConfig, } @@ -609,16 +451,11 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { return err } - siteConfig := flattenAppServiceSiteConfig(configResp.SiteConfig) + siteConfig := azSchema.FlattenAppServiceSiteConfig(configResp.SiteConfig) if err := d.Set("site_config", siteConfig); err != nil { return err } - restrictions := flattenAppServiceIpRestrictions(configResp.SiteConfig.IPSecurityRestrictions) - if err := d.Set("ip_restriction", restrictions); err != nil { - return fmt.Errorf("Error flattening `ip_restrictions`: %s", err) - } - scm := flattenAppServiceSourceControl(scmResp.SiteSourceControlProperties) if err := d.Set("source_control", scm); err != nil { return err @@ -664,170 +501,6 @@ func resourceArmAppServiceDelete(d *schema.ResourceData, meta interface{}) error return nil } -func expandAppServiceSiteConfig(d *schema.ResourceData) web.SiteConfig { - configs := d.Get("site_config").([]interface{}) - siteConfig := web.SiteConfig{} - - ipRestrictions := expandIpRestrictions(d) - siteConfig.IPSecurityRestrictions = ipRestrictions - - if len(configs) == 0 { - return siteConfig - } - - config := configs[0].(map[string]interface{}) - - if v, ok := config["always_on"]; ok { - siteConfig.AlwaysOn = utils.Bool(v.(bool)) - } - - if v, ok := config["default_documents"]; ok { - input := v.([]interface{}) - - documents := make([]string, 0) - for _, document := range input { - documents = append(documents, document.(string)) - } - - siteConfig.DefaultDocuments = &documents - } - - if v, ok := config["dotnet_framework_version"]; ok { - siteConfig.NetFrameworkVersion = utils.String(v.(string)) - } - - if v, ok := config["java_version"]; ok { - siteConfig.JavaVersion = utils.String(v.(string)) - } - - if v, ok := config["java_container"]; ok { - siteConfig.JavaContainer = utils.String(v.(string)) - } - - if v, ok := config["java_container_version"]; ok { - siteConfig.JavaContainerVersion = utils.String(v.(string)) - } - - if v, ok := config["http2_enabled"]; ok { - siteConfig.HTTP20Enabled = utils.Bool(v.(bool)) - } - - if v, ok := config["local_mysql_enabled"]; ok { - siteConfig.LocalMySQLEnabled = utils.Bool(v.(bool)) - } - - if v, ok := config["managed_pipeline_mode"]; ok { - siteConfig.ManagedPipelineMode = web.ManagedPipelineMode(v.(string)) - } - - if v, ok := config["php_version"]; ok { - siteConfig.PhpVersion = utils.String(v.(string)) - } - - if v, ok := config["python_version"]; ok { - siteConfig.PythonVersion = utils.String(v.(string)) - } - - if v, ok := config["remote_debugging_enabled"]; ok { - siteConfig.RemoteDebuggingEnabled = utils.Bool(v.(bool)) - } - - if v, ok := config["remote_debugging_version"]; ok { - siteConfig.RemoteDebuggingVersion = utils.String(v.(string)) - } - - if v, ok := config["use_32_bit_worker_process"]; ok { - siteConfig.Use32BitWorkerProcess = utils.Bool(v.(bool)) - } - - if v, ok := config["websockets_enabled"]; ok { - siteConfig.WebSocketsEnabled = utils.Bool(v.(bool)) - } - - if v, ok := config["scm_type"]; ok { - siteConfig.ScmType = web.ScmType(v.(string)) - } - - return siteConfig -} - -func flattenAppServiceSiteConfig(input *web.SiteConfig) []interface{} { - results := make([]interface{}, 0) - result := make(map[string]interface{}, 0) - - if input == nil { - log.Printf("[DEBUG] SiteConfig is nil") - return results - } - - if input.AlwaysOn != nil { - result["always_on"] = *input.AlwaysOn - } - - if input.DefaultDocuments != nil { - documents := make([]string, 0) - for _, document := range *input.DefaultDocuments { - documents = append(documents, document) - } - - result["default_documents"] = documents - } - - if input.NetFrameworkVersion != nil { - result["dotnet_framework_version"] = *input.NetFrameworkVersion - } - - if input.JavaVersion != nil { - result["java_version"] = *input.JavaVersion - } - - if input.JavaContainer != nil { - result["java_container"] = *input.JavaContainer - } - - if input.JavaContainerVersion != nil { - result["java_container_version"] = *input.JavaContainerVersion - } - - if input.LocalMySQLEnabled != nil { - result["local_mysql_enabled"] = *input.LocalMySQLEnabled - } - - if input.HTTP20Enabled != nil { - result["http2_enabled"] = *input.HTTP20Enabled - } - - result["managed_pipeline_mode"] = string(input.ManagedPipelineMode) - - if input.PhpVersion != nil { - result["php_version"] = *input.PhpVersion - } - - if input.PythonVersion != nil { - result["python_version"] = *input.PythonVersion - } - - if input.RemoteDebuggingEnabled != nil { - result["remote_debugging_enabled"] = *input.RemoteDebuggingEnabled - } - - if input.RemoteDebuggingVersion != nil { - result["remote_debugging_version"] = *input.RemoteDebuggingVersion - } - - if input.Use32BitWorkerProcess != nil { - result["use_32_bit_worker_process"] = *input.Use32BitWorkerProcess - } - - if input.WebSocketsEnabled != nil { - result["websockets_enabled"] = *input.WebSocketsEnabled - } - - result["scm_type"] = string(input.ScmType) - - return append(results, result) -} - func flattenAppServiceSourceControl(input *web.SiteSourceControlProperties) []interface{} { results := make([]interface{}, 0) result := make(map[string]interface{}, 0) @@ -880,25 +553,6 @@ func expandAppServiceConnectionStrings(d *schema.ResourceData) map[string]*web.C return output } -func expandIpRestrictions(d *schema.ResourceData) *[]web.IPSecurityRestriction { - ipSecurityRestrictions := d.Get("ip_restriction").([]interface{}) - restrictions := make([]web.IPSecurityRestriction, 0) - - for _, ipSecurityRestriction := range ipSecurityRestrictions { - restriction := ipSecurityRestriction.(map[string]interface{}) - - ip_address := restriction["ip_address"].(string) - subnet_mask := restriction["subnet_mask"].(string) - - restrictions = append(restrictions, web.IPSecurityRestriction{ - IPAddress: &ip_address, - SubnetMask: &subnet_mask, - }) - } - - return &restrictions -} - func flattenAppServiceConnectionStrings(input map[string]*web.ConnStringValueTypePair) interface{} { results := make([]interface{}, 0) @@ -913,21 +567,6 @@ func flattenAppServiceConnectionStrings(input map[string]*web.ConnStringValueTyp return results } -func flattenAppServiceIpRestrictions(input *[]web.IPSecurityRestriction) interface{} { - results := make([]interface{}, 0) - - if input != nil { - for _, v := range *input { - result := make(map[string]interface{}, 0) - result["ip_address"] = *v.IPAddress - result["subnet_mask"] = *v.SubnetMask - results = append(results, result) - } - } - - return results -} - func flattenAppServiceAppSettings(input map[string]*string) map[string]string { output := make(map[string]string, 0) for k, v := range input { @@ -967,8 +606,8 @@ func flattenAzureRmAppServiceMachineIdentity(identity *web.ManagedServiceIdentit func validateAppServiceName(v interface{}, k string) (ws []string, es []error) { value := v.(string) - if matched := regexp.MustCompile(`^[0-9a-zA-Z-]+$`).Match([]byte(value)); !matched { - es = append(es, fmt.Errorf("%q may only contain alphanumeric characters and dashes", k)) + if matched := regexp.MustCompile(`^[0-9a-zA-Z-]{1,60}$`).Match([]byte(value)); !matched { + es = append(es, fmt.Errorf("%q may only contain alphanumeric characters and dashes and up to 60 characters in length", k)) } return diff --git a/azurerm/resource_arm_app_service_plan.go b/azurerm/resource_arm_app_service_plan.go index da0247c72d3ad..31c2732518844 100644 --- a/azurerm/resource_arm_app_service_plan.go +++ b/azurerm/resource_arm_app_service_plan.go @@ -314,8 +314,8 @@ func flattenAppServiceProperties(props *web.AppServicePlanProperties) []interfac func validateAppServicePlanName(v interface{}, k string) (ws []string, es []error) { value := v.(string) - if matched := regexp.MustCompile(`^[0-9a-zA-Z-]+$`).Match([]byte(value)); !matched { - es = append(es, fmt.Errorf("%q may only contain alphanumeric characters and dashes", k)) + if matched := regexp.MustCompile(`^[0-9a-zA-Z-_]{1,60}$`).Match([]byte(value)); !matched { + es = append(es, fmt.Errorf("%q may only contain alphanumeric characters, dashes and underscores up to 60 characters in length", k)) } return diff --git a/azurerm/resource_arm_app_service_plan_test.go b/azurerm/resource_arm_app_service_plan_test.go index 74628a84c1ee8..08745d4080e02 100644 --- a/azurerm/resource_arm_app_service_plan_test.go +++ b/azurerm/resource_arm_app_service_plan_test.go @@ -33,7 +33,7 @@ func TestAzureRMAppServicePlanName_validation(t *testing.T) { }, { Value: "hello_world", - ErrCount: 1, + ErrCount: 0, }, { Value: "helloworld21!", diff --git a/azurerm/resource_arm_app_service_slot.go b/azurerm/resource_arm_app_service_slot.go index 43a77f188b840..d57df006476f3 100644 --- a/azurerm/resource_arm_app_service_slot.go +++ b/azurerm/resource_arm_app_service_slot.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -44,147 +45,7 @@ func resourceArmAppServiceSlot() *schema.Resource { ForceNew: true, }, - // TODO: reusable schema - "site_config": { - Type: schema.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "always_on": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "default_documents": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - "dotnet_framework_version": { - Type: schema.TypeString, - Optional: true, - Default: "v4.0", - ValidateFunc: validation.StringInSlice([]string{ - "v2.0", - "v4.0", - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "http2_enabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "java_version": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "1.7", - "1.8", - }, false), - }, - - "java_container": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "JETTY", - "TOMCAT", - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "java_container_version": { - Type: schema.TypeString, - Optional: true, - }, - - "local_mysql_enabled": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, - - "managed_pipeline_mode": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - string(web.Classic), - string(web.Integrated), - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "php_version": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "5.5", - "5.6", - "7.0", - "7.1", - }, false), - }, - - "python_version": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "2.7", - "3.4", - }, false), - }, - - "remote_debugging_enabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - - "remote_debugging_version": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "VS2012", - "VS2013", - "VS2015", - "VS2017", - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - - "use_32_bit_worker_process": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, - - "websockets_enabled": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, - - "scm_type": { - Type: schema.TypeString, - Optional: true, - Default: string(web.ScmTypeNone), - ValidateFunc: validation.StringInSlice([]string{ - string(web.ScmTypeNone), - string(web.ScmTypeLocalGit), - }, false), - }, - }, - }, - }, + "site_config": azSchema.AppServiceSiteConfigSchema(), "client_affinity_enabled": { Type: schema.TypeBool, @@ -285,8 +146,7 @@ func resourceArmAppServiceSlotCreate(d *schema.ResourceData, meta interface{}) e httpsOnly := d.Get("https_only").(bool) tags := d.Get("tags").(map[string]interface{}) - siteConfig := expandAppServiceSiteConfig(d) - + siteConfig := azSchema.ExpandAppServiceSiteConfig(d.Get("site_config")) siteEnvelope := web.Site{ Location: &location, Tags: expandTags(tags), @@ -357,7 +217,7 @@ func resourceArmAppServiceSlotUpdate(d *schema.ResourceData, meta interface{}) e if d.HasChange("site_config") { // update the main configuration - siteConfig := expandAppServiceSiteConfig(d) + siteConfig := azSchema.ExpandAppServiceSiteConfig(d.Get("site_config")) siteConfigResource := web.SiteConfigResource{ SiteConfig: &siteConfig, } @@ -456,7 +316,7 @@ func resourceArmAppServiceSlotRead(d *schema.ResourceData, meta interface{}) err return err } - siteConfig := flattenAppServiceSiteConfig(configResp.SiteConfig) + siteConfig := azSchema.FlattenAppServiceSiteConfig(configResp.SiteConfig) if err := d.Set("site_config", siteConfig); err != nil { return err } diff --git a/azurerm/resource_arm_app_service_slot_test.go b/azurerm/resource_arm_app_service_slot_test.go index 2f427dbc5f639..bcf73038af54e 100644 --- a/azurerm/resource_arm_app_service_slot_test.go +++ b/azurerm/resource_arm_app_service_slot_test.go @@ -223,6 +223,54 @@ func TestAccAzureRMAppServiceSlot_http2Enabled(t *testing.T) { }) } +func TestAccAzureRMAppServiceSlot_oneIpRestriction(t *testing.T) { + resourceName := "azurerm_app_service_slot.test" + ri := acctest.RandInt() + config := testAccAzureRMAppServiceSlot_oneIpRestriction(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAppServiceSlotDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceSlotExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.subnet_mask", "255.255.255.255"), + ), + }, + }, + }) +} + +func TestAccAzureRMAppServiceSlot_manyIpRestrictions(t *testing.T) { + resourceName := "azurerm_app_service_slot.test" + ri := acctest.RandInt() + config := testAccAzureRMAppServiceSlot_manyIpRestrictions(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAppServiceSlotDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceSlotExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.subnet_mask", "255.255.255.255"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.1.ip_address", "20.20.20.0"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.1.subnet_mask", "255.255.255.0"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.2.ip_address", "30.30.0.0"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.2.subnet_mask", "255.255.0.0"), + ), + }, + }, + }) +} + func TestAccAzureRMAppServiceSlot_localMySql(t *testing.T) { resourceName := "azurerm_app_service_slot.test" ri := acctest.RandInt() @@ -984,6 +1032,98 @@ resource "azurerm_app_service_slot" "test" { `, rInt, location, rInt, rInt, rInt) } +func testAccAzureRMAppServiceSlot_oneIpRestriction(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_app_service_plan" "test" { + name = "acctestASP-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + tier = "Standard" + size = "S1" + } +} + +resource "azurerm_app_service" "test" { + name = "acctestAS-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" +} + +resource "azurerm_app_service_slot" "test" { + name = "acctestASSlot-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" + app_service_name = "${azurerm_app_service.test.name}" + + site_config { + ip_restriction { + ip_address = "10.10.10.10" + } + } +} +`, rInt, location, rInt, rInt, rInt) +} + +func testAccAzureRMAppServiceSlot_manyIpRestrictions(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_app_service_plan" "test" { + name = "acctestASP-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + tier = "Standard" + size = "S1" + } +} + +resource "azurerm_app_service" "test" { + name = "acctestAS-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" +} + +resource "azurerm_app_service_slot" "test" { + name = "acctestASSlot-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" + app_service_name = "${azurerm_app_service.test.name}" + + site_config { + ip_restriction { + ip_address = "10.10.10.10" + } + + ip_restriction { + ip_address = "20.20.20.0" + subnet_mask = "255.255.255.0" + } + + ip_restriction { + ip_address = "30.30.0.0" + subnet_mask = "255.255.0.0" + } + } +} +`, rInt, location, rInt, rInt, rInt) +} + func testAccAzureRMAppServiceSlot_localMySql(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/azurerm/resource_arm_app_service_test.go b/azurerm/resource_arm_app_service_test.go index ddeed68f14be7..2f48c459072c4 100644 --- a/azurerm/resource_arm_app_service_test.go +++ b/azurerm/resource_arm_app_service_test.go @@ -385,8 +385,8 @@ func TestAccAzureRMAppService_oneIpRestriction(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMAppServiceExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.0.ip_address", "10.10.10.10"), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.0.subnet_mask", "255.255.255.255"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.subnet_mask", "255.255.255.255"), ), }, }, @@ -407,12 +407,12 @@ func TestAccAzureRMAppService_manyIpRestrictions(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMAppServiceExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.0.ip_address", "10.10.10.10"), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.0.subnet_mask", "255.255.255.255"), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.1.ip_address", "20.20.20.0"), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.1.subnet_mask", "255.255.255.0"), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.2.ip_address", "30.30.0.0"), - resource.TestCheckResourceAttr(resourceName, "ip_restriction.2.subnet_mask", "255.255.0.0"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.0.subnet_mask", "255.255.255.255"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.1.ip_address", "20.20.20.0"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.1.subnet_mask", "255.255.255.0"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.2.ip_address", "30.30.0.0"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.ip_restriction.2.subnet_mask", "255.255.0.0"), ), }, }, @@ -1225,8 +1225,10 @@ resource "azurerm_app_service" "test" { resource_group_name = "${azurerm_resource_group.test.name}" app_service_plan_id = "${azurerm_app_service_plan.test.id}" - ip_restriction { - ip_address = "10.10.10.10" + site_config { + ip_restriction { + ip_address = "10.10.10.10" + } } } `, rInt, location, rInt, rInt) @@ -1256,18 +1258,20 @@ resource "azurerm_app_service" "test" { resource_group_name = "${azurerm_resource_group.test.name}" app_service_plan_id = "${azurerm_app_service_plan.test.id}" - ip_restriction { - ip_address = "10.10.10.10" - } - - ip_restriction { - ip_address = "20.20.20.0" - subnet_mask = "255.255.255.0" - } - - ip_restriction { - ip_address = "30.30.0.0" - subnet_mask = "255.255.0.0" + site_config { + ip_restriction { + ip_address = "10.10.10.10" + } + + ip_restriction { + ip_address = "20.20.20.0" + subnet_mask = "255.255.255.0" + } + + ip_restriction { + ip_address = "30.30.0.0" + subnet_mask = "255.255.0.0" + } } } `, rInt, location, rInt, rInt) diff --git a/azurerm/resource_arm_application_gateway.go b/azurerm/resource_arm_application_gateway.go index 31ffe0810b5e1..910b42b588a79 100644 --- a/azurerm/resource_arm_application_gateway.go +++ b/azurerm/resource_arm_application_gateway.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" @@ -457,6 +457,29 @@ func resourceArmApplicationGateway() *schema.Resource { Type: schema.TypeInt, Required: true, }, + + "match": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "body": { + Type: schema.TypeString, + Optional: true, + Default: "*", + }, + + "status_code": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, }, }, }, @@ -1162,6 +1185,22 @@ func expandApplicationGatewayProbes(d *schema.ResourceData) *[]network.Applicati }, } + matchConfigs := data["match"].([]interface{}) + if len(matchConfigs) > 0 { + match := matchConfigs[0].(map[string]interface{}) + matchBody := match["body"].(string) + + statusCodes := make([]string, 0) + for _, statusCode := range match["status_code"].([]interface{}) { + statusCodes = append(statusCodes, statusCode.(string)) + } + + setting.ApplicationGatewayProbePropertiesFormat.Match = &network.ApplicationGatewayProbeHealthResponseMatch{ + Body: &matchBody, + StatusCodes: &statusCodes, + } + } + backendSettings = append(backendSettings, setting) } @@ -1608,6 +1647,22 @@ func flattenApplicationGatewayProbes(input *[]network.ApplicationGatewayProbe) [ if threshold := props.UnhealthyThreshold; threshold != nil { settings["unhealthy_threshold"] = int(*threshold) } + + if match := props.Match; match != nil { + matchConfig := map[string]interface{}{} + if body := match.Body; body != nil { + matchConfig["body"] = *body + } + + statusCodes := make([]interface{}, 0) + if match.StatusCodes != nil { + for _, status := range *match.StatusCodes { + statusCodes = append(statusCodes, status) + } + matchConfig["status_code"] = statusCodes + } + settings["match"] = matchConfig + } } result = append(result, settings) diff --git a/azurerm/resource_arm_application_gateway_test.go b/azurerm/resource_arm_application_gateway_test.go index 4936723b82864..b71a63c73af3c 100644 --- a/azurerm/resource_arm_application_gateway_test.go +++ b/azurerm/resource_arm_application_gateway_test.go @@ -178,7 +178,7 @@ func TestAccAzureRMApplicationGateway_waf(t *testing.T) { subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") gwID := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/applicationGateways/acctestgw-%d", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/applicationGateways/acctestgw-%d", subscriptionID, ri, ri) resource.Test(t, resource.TestCase{ @@ -198,6 +198,32 @@ func TestAccAzureRMApplicationGateway_waf(t *testing.T) { }) } +func TestAccAzureRMApplicationGateway_probeResponseMatch(t *testing.T) { + resourceName := "azurerm_application_gateway.test" + ri := acctest.RandInt() + + subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") + gwID := fmt.Sprintf( + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/applicationGateways/acctestgw-%d", + subscriptionID, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApplicationGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMApplicationGateway_probeResponseMatch(ri, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApplicationGatewayExists(resourceName), + testCheckAzureRMApplicationGatewayProbeResponseMatchAssigned(resourceName, "probe-1"), + resource.TestCheckResourceAttr(resourceName, "id", gwID), + ), + }, + }, + }) +} + func testCheckAzureRMApplicationGatewayExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -325,6 +351,43 @@ func testCheckAzureRMApplicationGatewayAuthenticationCertificateAssigned(name st } } +func testCheckAzureRMApplicationGatewayProbeResponseMatchAssigned(name string, probeName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[name] + if !ok { + return fmt.Errorf("Not found: %s", name) + } + + gatewayName := rs.Primary.Attributes["name"] + resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] + if !hasResourceGroup { + return fmt.Errorf("Bad: no resource group found in state for App Gateway: %q", gatewayName) + } + + conn := testAccProvider.Meta().(*ArmClient).applicationGatewayClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + resp, err := conn.Get(ctx, resourceGroup, gatewayName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Bad: App Gateway %q (resource group: %q) does not exist", gatewayName, resourceGroup) + } + + return fmt.Errorf("Bad: Get on ApplicationGatewayClient: %+v", err) + } + + for _, probe := range *resp.Probes { + if *probe.Name == probeName { + if match := probe.Match; match != nil { + return nil + } + } + } + + return fmt.Errorf("Bad: Probe Response match was not found: %s", probeName) + } +} + func testCheckAzureRMApplicationGatewayDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*ArmClient).applicationGatewayClient ctx := testAccProvider.Meta().(*ArmClient).StopContext @@ -356,7 +419,7 @@ func testCheckAzureRMApplicationGatewayDestroy(s *terraform.State) error { func testAccAzureRMApplicationGateway_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -539,7 +602,7 @@ resource "azurerm_application_gateway" "test" { func testAccAzureRMApplicationGateway_basic_changeSslCert(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -722,7 +785,7 @@ resource "azurerm_application_gateway" "test" { func testAccAzureRMApplicationGateway_basic_authCert(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -923,7 +986,7 @@ resource "azurerm_application_gateway" "test" { func testAccAzureRMApplicationGateway_basic_changeAuthCert(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -1124,7 +1187,7 @@ resource "azurerm_application_gateway" "test" { func testAccAzureRMApplicationGateway_waf(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -1310,3 +1373,194 @@ resource "azurerm_application_gateway" "test" { } `, rInt, location, rInt, rInt, rInt, rInt) } + +func testAccAzureRMApplicationGateway_probeResponseMatch(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-vnet-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + address_space = ["10.254.0.0/16"] + location = "${azurerm_resource_group.test.location}" +} + +resource "azurerm_subnet" "test" { + name = "subnet-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.254.0.0/24" +} + +resource "azurerm_public_ip" "test" { + name = "acctest-pubip-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "dynamic" +} + +resource "azurerm_application_gateway" "test" { + name = "acctestgw-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "Standard_Medium" + tier = "Standard" + capacity = 1 + } + + disabled_ssl_protocols = [ + "TLSv1_0", + ] + + gateway_ip_configuration { + # id = computed + name = "gw-ip-config1" + subnet_id = "${azurerm_subnet.test.id}" + } + + frontend_ip_configuration { + # id = computed + name = "ip-config-public" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } + + frontend_ip_configuration { + # id = computed + name = "ip-config-private" + subnet_id = "${azurerm_subnet.test.id}" + + # private_ip_address = computed + private_ip_address_allocation = "Dynamic" + } + + frontend_port { + # id = computed + name = "port-8080" + port = 8080 + } + + backend_address_pool { + # id = computed + name = "pool-1" + + fqdn_list = [ + "terraform.io", + ] + } + + backend_http_settings { + # id = computed + name = "backend-http-1" + port = 8010 + protocol = "Https" + cookie_based_affinity = "Enabled" + request_timeout = 30 + + # probe_id = computed + probe_name = "probe-1" + } + + http_listener { + # id = computed + name = "listener-1" + + # frontend_ip_configuration_id = computed + frontend_ip_configuration_name = "ip-config-public" + + # frontend_ip_port_id = computed + frontend_port_name = "port-8080" + protocol = "Http" + } + + http_listener { + name = "listener-2" + frontend_ip_configuration_name = "ip-config-public" + frontend_port_name = "port-8080" + protocol = "Https" + + # ssl_certificate_id = computed + ssl_certificate_name = "ssl-1" + host_name = "terraform.io" + require_sni = true + } + + probe { + # id = computed + name = "probe-1" + protocol = "Https" + path = "/test" + host = "azure.com" + timeout = 120 + interval = 300 + unhealthy_threshold = 8 + match = { + body = "*" + status_code = [ + "200", + "201", + "205-210", + ] + } + } + + url_path_map { + # id = computed + name = "path-map-1" + default_backend_address_pool_name = "pool-1" + default_backend_http_settings_name = "backend-http-1" + + path_rule { + # id = computed + name = "path-rule-1" + backend_address_pool_name = "pool-1" + backend_http_settings_name = "backend-http-1" + + paths = [ + "/test", + ] + } + } + + request_routing_rule { + # id = computed + name = "rule-basic-1" + rule_type = "Basic" + + # http_listener_id = computed + http_listener_name = "listener-1" + + # backend_address_pool_id = computed + backend_address_pool_name = "pool-1" + + # backend_http_settings_id = computed + backend_http_settings_name = "backend-http-1" + } + + request_routing_rule { + # id = computed + name = "rule-path-1" + rule_type = "PathBasedRouting" + url_path_map_name = "path-map-1" + + # http_listener_id = computed + http_listener_name = "listener-2" + } + + ssl_certificate { + # id = computed + name = "ssl-1" + data = "${file("testdata/application_gateway_test.pfx")}" + password = "terraform" + } + + tags { + environment = "tf01" + } +} +`, rInt, location, rInt, rInt, rInt, rInt) +} diff --git a/azurerm/resource_arm_application_security_group.go b/azurerm/resource_arm_application_security_group.go index 083d0e7f0162b..59944e13a7e53 100644 --- a/azurerm/resource_arm_application_security_group.go +++ b/azurerm/resource_arm_application_security_group.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_automation_account.go b/azurerm/resource_arm_automation_account.go index 30145a900ddce..52ad4c512ff38 100644 --- a/azurerm/resource_arm_automation_account.go +++ b/azurerm/resource_arm_automation_account.go @@ -3,6 +3,7 @@ package azurerm import ( "fmt" "log" + "regexp" "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation" "github.com/hashicorp/terraform/helper/schema" @@ -16,6 +17,7 @@ func resourceArmAutomationAccount() *schema.Resource { Read: resourceArmAutomationAccountRead, Update: resourceArmAutomationAccountCreateUpdate, Delete: resourceArmAutomationAccountDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -25,6 +27,11 @@ func resourceArmAutomationAccount() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + ValidateFunc: validation.StringMatch( + //todo this will not allow single character names, even thou they are valid + regexp.MustCompile(`^[0-9a-zA-Z]([-0-9a-zA-Z]{0,48}[0-9a-zA-Z])?$`), + `The account name must not be empty, and must not exceed 50 characters in length. The account name must start with a letter or number. The account name can contain letters, numbers, and dashes. The final character must be a letter or a number.`, + ), }, "location": locationSchema(), @@ -58,6 +65,7 @@ func resourceArmAutomationAccount() *schema.Resource { func resourceArmAutomationAccountCreateUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationAccountClient ctx := meta.(*ArmClient).StopContext + log.Printf("[INFO] preparing arguments for AzureRM Automation Account creation.") name := d.Get("name").(string) @@ -98,6 +106,7 @@ func resourceArmAutomationAccountCreateUpdate(d *schema.ResourceData, meta inter func resourceArmAutomationAccountRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationAccountClient ctx := meta.(*ArmClient).StopContext + id, err := parseAzureResourceID(d.Id()) if err != nil { return err diff --git a/azurerm/resource_arm_automation_account_test.go b/azurerm/resource_arm_automation_account_test.go index bfd880cd7a8f4..9cfbe654108ae 100644 --- a/azurerm/resource_arm_automation_account_test.go +++ b/azurerm/resource_arm_automation_account_test.go @@ -11,9 +11,8 @@ import ( ) func TestAccAzureRMAutomationAccount_basic(t *testing.T) { - ri := acctest.RandInt() resourceName := "azurerm_automation_account.test" - config := testAccAzureRMAutomationAccount_basic(ri, testLocation()) + ri := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -21,20 +20,24 @@ func TestAccAzureRMAutomationAccount_basic(t *testing.T) { CheckDestroy: testCheckAzureRMAutomationAccountDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMAutomationAccount_basic(ri, testLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMAutomationAccountExists(resourceName), resource.TestCheckResourceAttr(resourceName, "sku.0.name", "Basic"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } func TestAccAzureRMAutomationAccount_complete(t *testing.T) { - ri := acctest.RandInt() resourceName := "azurerm_automation_account.test" - config := testAccAzureRMAutomationAccount_complete(ri, testLocation()) + ri := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -42,13 +45,18 @@ func TestAccAzureRMAutomationAccount_complete(t *testing.T) { CheckDestroy: testCheckAzureRMAutomationAccountDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMAutomationAccount_complete(ri, testLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMAutomationAccountExists(resourceName), resource.TestCheckResourceAttr(resourceName, "sku.0.name", "Basic"), resource.TestCheckResourceAttr(resourceName, "tags.hello", "world"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/azurerm/resource_arm_automation_credential.go b/azurerm/resource_arm_automation_credential.go index cbd92c4706be9..3767bef02fdd2 100644 --- a/azurerm/resource_arm_automation_credential.go +++ b/azurerm/resource_arm_automation_credential.go @@ -15,6 +15,7 @@ func resourceArmAutomationCredential() *schema.Resource { Read: resourceArmAutomationCredentialRead, Update: resourceArmAutomationCredentialCreateUpdate, Delete: resourceArmAutomationCredentialDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -25,7 +26,9 @@ func resourceArmAutomationCredential() *schema.Resource { Required: true, ForceNew: true, }, + "resource_group_name": resourceGroupNameSchema(), + "account_name": { Type: schema.TypeString, Required: true, @@ -42,6 +45,7 @@ func resourceArmAutomationCredential() *schema.Resource { Required: true, Sensitive: true, }, + "description": { Type: schema.TypeString, Optional: true, @@ -53,6 +57,7 @@ func resourceArmAutomationCredential() *schema.Resource { func resourceArmAutomationCredentialCreateUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationCredentialClient ctx := meta.(*ArmClient).StopContext + log.Printf("[INFO] preparing arguments for AzureRM Automation Credential creation.") name := d.Get("name").(string) @@ -87,12 +92,13 @@ func resourceArmAutomationCredentialCreateUpdate(d *schema.ResourceData, meta in d.SetId(*read.ID) - return resourceArmAutomationAccountRead(d, meta) + return resourceArmAutomationCredentialRead(d, meta) } func resourceArmAutomationCredentialRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationCredentialClient ctx := meta.(*ArmClient).StopContext + id, err := parseAzureResourceID(d.Id()) if err != nil { return err diff --git a/azurerm/resource_arm_automation_credential_test.go b/azurerm/resource_arm_automation_credential_test.go index 6ff53bbadd9cf..6ffb7ac946657 100644 --- a/azurerm/resource_arm_automation_credential_test.go +++ b/azurerm/resource_arm_automation_credential_test.go @@ -13,7 +13,6 @@ import ( func TestAccAzureRMAutomationCredential_basic(t *testing.T) { resourceName := "azurerm_automation_credential.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationCredential_basic(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -21,12 +20,18 @@ func TestAccAzureRMAutomationCredential_basic(t *testing.T) { CheckDestroy: testCheckAzureRMAutomationCredentialDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMAutomationCredential_basic(ri, testLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMAutomationCredentialExists(resourceName), resource.TestCheckResourceAttr(resourceName, "username", "test_user"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"password"}, + }, }, }) } @@ -34,7 +39,6 @@ func TestAccAzureRMAutomationCredential_basic(t *testing.T) { func TestAccAzureRMAutomationCredential_complete(t *testing.T) { resourceName := "azurerm_automation_credential.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationCredential_complete(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -42,13 +46,19 @@ func TestAccAzureRMAutomationCredential_complete(t *testing.T) { CheckDestroy: testCheckAzureRMAutomationCredentialDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMAutomationCredential_complete(ri, testLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMAutomationCredentialExists(resourceName), resource.TestCheckResourceAttr(resourceName, "username", "test_user"), resource.TestCheckResourceAttr(resourceName, "description", "This is a test credential for terraform acceptance test"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"password"}, + }, }, }) } diff --git a/azurerm/resource_arm_automation_runbook.go b/azurerm/resource_arm_automation_runbook.go index 1b2d7d2219f89..914cddf5a7d79 100644 --- a/azurerm/resource_arm_automation_runbook.go +++ b/azurerm/resource_arm_automation_runbook.go @@ -16,6 +16,7 @@ func resourceArmAutomationRunbook() *schema.Resource { Read: resourceArmAutomationRunbookRead, Update: resourceArmAutomationRunbookCreateUpdate, Delete: resourceArmAutomationRunbookDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -103,6 +104,7 @@ func resourceArmAutomationRunbook() *schema.Resource { }, }, }, + "tags": tagsSchema(), }, } @@ -111,6 +113,7 @@ func resourceArmAutomationRunbook() *schema.Resource { func resourceArmAutomationRunbookCreateUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationRunbookClient ctx := meta.(*ArmClient).StopContext + log.Printf("[INFO] preparing arguments for AzureRM Automation Runbook creation.") name := d.Get("name").(string) @@ -161,6 +164,7 @@ func resourceArmAutomationRunbookCreateUpdate(d *schema.ResourceData, meta inter func resourceArmAutomationRunbookRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationRunbookClient ctx := meta.(*ArmClient).StopContext + id, err := parseAzureResourceID(d.Id()) if err != nil { return err diff --git a/azurerm/resource_arm_automation_runbook_test.go b/azurerm/resource_arm_automation_runbook_test.go index 0b37fd2312642..27686417f5409 100644 --- a/azurerm/resource_arm_automation_runbook_test.go +++ b/azurerm/resource_arm_automation_runbook_test.go @@ -13,7 +13,6 @@ import ( func TestAccAzureRMAutomationRunbook_PSWorkflow(t *testing.T) { resourceName := "azurerm_automation_runbook.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationRunbook_PSWorkflow(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -21,12 +20,18 @@ func TestAccAzureRMAutomationRunbook_PSWorkflow(t *testing.T) { CheckDestroy: testCheckAzureRMAutomationRunbookDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMAutomationRunbook_PSWorkflow(ri, testLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMAutomationRunbookExists(resourceName), resource.TestCheckResourceAttr(resourceName, "runbook_type", "PowerShellWorkflow"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"publish_content_link"}, + }, }, }) } @@ -34,7 +39,6 @@ func TestAccAzureRMAutomationRunbook_PSWorkflow(t *testing.T) { func TestAccAzureRMAutomationRunbook_PSWorkflowWithHash(t *testing.T) { resourceName := "azurerm_automation_runbook.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationRunbook_PSWorkflowWithHash(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -42,12 +46,18 @@ func TestAccAzureRMAutomationRunbook_PSWorkflowWithHash(t *testing.T) { CheckDestroy: testCheckAzureRMAutomationRunbookDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMAutomationRunbook_PSWorkflowWithHash(ri, testLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMAutomationRunbookExists(resourceName), resource.TestCheckResourceAttr(resourceName, "runbook_type", "PowerShellWorkflow"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"publish_content_link"}, + }, }, }) } diff --git a/azurerm/resource_arm_automation_schedule.go b/azurerm/resource_arm_automation_schedule.go index 1248adc832da1..2c6a6b0f6024e 100644 --- a/azurerm/resource_arm_automation_schedule.go +++ b/azurerm/resource_arm_automation_schedule.go @@ -3,12 +3,16 @@ package azurerm import ( "fmt" "log" + "regexp" + "strings" "time" "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation" "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -18,6 +22,7 @@ func resourceArmAutomationSchedule() *schema.Resource { Read: resourceArmAutomationScheduleRead, Update: resourceArmAutomationScheduleCreateUpdate, Delete: resourceArmAutomationScheduleDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -27,40 +32,35 @@ func resourceArmAutomationSchedule() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^[^<>*%&:\\?.+/]{0,127}[^<>*%&:\\?.+/\s]$`), + `The name length must be from 1 to 128 characters. The name cannot contain special characters < > * % & : \ ? . + / and cannot end with a whitespace character.`, + ), }, + "resource_group_name": resourceGroupNameSchema(), + + //this is AutomationAccountName in the SDK "account_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Deprecated: "account_name has been renamed to automation_account_name for clarity and to match the azure API", + ConflictsWith: []string{"automation_account_name"}, }, - "description": { + "automation_account_name": { Type: schema.TypeString, - Optional: true, + Optional: true, //todo change to required once account_name has been removed Computed: true, - }, - - "resource_group_name": resourceGroupNameSchema(), - - "start_time": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: compareDataAsUTCSuppressFunc, - ValidateFunc: validateStartTime, - }, - - "expiry_time": { - Type: schema.TypeString, - DiffSuppressFunc: compareDataAsUTCSuppressFunc, - Optional: true, - Computed: true, + //ForceNew: true, //todo this needs to come back once account_name has been removed + ConflictsWith: []string{"account_name"}, }, "frequency": { Type: schema.TypeString, Required: true, - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validation.StringInSlice([]string{ string(automation.Day), string(automation.Hour), @@ -69,85 +69,136 @@ func resourceArmAutomationSchedule() *schema.Resource { string(automation.Week), }, true), }, + + //ignored when frequency is `OneTime` + "interval": { + Type: schema.TypeInt, + Optional: true, + Computed: true, //defaults to 1 if frequency is not OneTime + ValidateFunc: validation.IntBetween(1, 100), + }, + + "start_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: suppress.RFC3339Time, + ValidateFunc: validate.RFC3339DateInFutureBy(time.Duration(5) * time.Minute), + //defaults to now + 7 minutes in create function if not set + }, + + "expiry_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, //same as start time when OneTime, ridiculous value when recurring: "9999-12-31T15:59:00-08:00" + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: validate.RFC3339Time, + }, + + "description": { + Type: schema.TypeString, + Optional: true, + }, + "timezone": { Type: schema.TypeString, Optional: true, Default: "UTC", + //todo figure out how to validate this properly }, + + //todo missing properties: week_days, month_days, month_week_day from advanced automation section }, - } -} -func compareDataAsUTCSuppressFunc(k, old, new string, d *schema.ResourceData) bool { - ot, oerr := time.Parse(time.RFC3339, old) - nt, nerr := time.Parse(time.RFC3339, new) - if oerr != nil || nerr != nil { - return false - } + CustomizeDiff: func(diff *schema.ResourceDiff, v interface{}) error { - return nt.Equal(ot) -} + interval, _ := diff.GetOk("interval") + if strings.ToLower(diff.Get("frequency").(string)) == "onetime" && interval.(int) > 0 { + return fmt.Errorf("interval canot be set when frequency is not OneTime") + } -func validateStartTime(v interface{}, k string) (ws []string, errors []error) { - starttime, tperr := time.Parse(time.RFC3339, v.(string)) - if tperr != nil { - errors = append(errors, fmt.Errorf("Cannot parse %q", k)) - } + _, hasAccount := diff.GetOk("automation_account_name") + _, hasAutomationAccountWeb := diff.GetOk("account_name") + if !hasAccount && !hasAutomationAccountWeb { + return fmt.Errorf("`automation_account_name` must be set") + } - u := time.Until(starttime) - if u < 5*time.Minute { - errors = append(errors, fmt.Errorf("%q should be at least 5 minutes in the future", k)) - } + //if automation_account_name changed or account_name changed to or from nil force a new resource + //remove once we remove the deprecated property + oAan, nAan := diff.GetChange("automation_account_name") + if oAan != "" && nAan != "" { + diff.ForceNew("automation_account_name") + } + + oAn, nAn := diff.GetChange("account_name") + if oAn != "" && nAn != "" { + diff.ForceNew("account_name") + } - return + return nil + }, + } } func resourceArmAutomationScheduleCreateUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationScheduleClient ctx := meta.(*ArmClient).StopContext + log.Printf("[INFO] preparing arguments for AzureRM Automation Schedule creation.") name := d.Get("name").(string) resGroup := d.Get("resource_group_name").(string) + frequency := d.Get("frequency").(string) - accName := d.Get("account_name").(string) - freqstr := d.Get("frequency").(string) - freq := automation.ScheduleFrequency(freqstr) - - cst := d.Get("start_time").(string) - starttime, tperr := time.Parse(time.RFC3339, cst) - if tperr != nil { - return fmt.Errorf("Cannot parse start_time: %q", cst) - } + timeZone := d.Get("timezone").(string) + description := d.Get("description").(string) - expirytime, teperr := time.Parse(time.RFC3339, cst) - if teperr != nil { - return fmt.Errorf("Cannot parse expiry_time: %q", cst) + //CustomizeDiff should ensure one of these two is set + //todo remove this once `account_name` is removed + accountName := "" + if v, ok := d.GetOk("automation_account_name"); ok { + accountName = v.(string) + } else if v, ok := d.GetOk("account_name"); ok { + accountName = v.(string) } - stdt := date.Time{Time: starttime} - etdt := date.Time{Time: expirytime} - - description := d.Get("description").(string) - timezone := d.Get("timezone").(string) - parameters := automation.ScheduleCreateOrUpdateParameters{ Name: &name, ScheduleCreateOrUpdateProperties: &automation.ScheduleCreateOrUpdateProperties{ Description: &description, - Frequency: freq, - StartTime: &stdt, - ExpiryTime: &etdt, - TimeZone: &timezone, + Frequency: automation.ScheduleFrequency(frequency), + TimeZone: &timeZone, }, } + properties := parameters.ScheduleCreateOrUpdateProperties + + //start time can default to now + 7 (5 could be invalid by the time the API is called) + if v, ok := d.GetOk("start_time"); ok { + t, _ := time.Parse(time.RFC3339, v.(string)) //should be validated by the schema + properties.StartTime = &date.Time{Time: t} + } else { + properties.StartTime = &date.Time{Time: time.Now().Add(time.Duration(7) * time.Minute)} + } - _, err := client.CreateOrUpdate(ctx, resGroup, accName, name, parameters) + if v, ok := d.GetOk("expiry_time"); ok { + t, _ := time.Parse(time.RFC3339, v.(string)) //should be validated by the schema + properties.ExpiryTime = &date.Time{Time: t} + } + + //only pay attention to interval if frequency is not OneTime, and default it to 1 if not set + if properties.Frequency != automation.OneTime { + if v, ok := d.GetOk("interval"); ok { + properties.Interval = utils.Int32(int32(v.(int))) + } else { + properties.Interval = 1 + } + } + _, err := client.CreateOrUpdate(ctx, resGroup, accountName, name, parameters) if err != nil { return err } - read, err := client.Get(ctx, resGroup, accName, name) + read, err := client.Get(ctx, resGroup, accountName, name) if err != nil { return err } @@ -164,15 +215,17 @@ func resourceArmAutomationScheduleCreateUpdate(d *schema.ResourceData, meta inte func resourceArmAutomationScheduleRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).automationScheduleClient ctx := meta.(*ArmClient).StopContext + id, err := parseAzureResourceID(d.Id()) if err != nil { return err } - resGroup := id.ResourceGroup - accName := id.Path["automationAccounts"] + name := id.Path["schedules"] + resGroup := id.ResourceGroup + accountName := id.Path["automationAccounts"] - resp, err := client.Get(ctx, resGroup, accName, name) + resp, err := client.Get(ctx, resGroup, accountName, name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { d.SetId("") @@ -184,12 +237,26 @@ func resourceArmAutomationScheduleRead(d *schema.ResourceData, meta interface{}) d.Set("name", resp.Name) d.Set("resource_group_name", resGroup) - d.Set("account_name", accName) - d.Set("frequency", resp.Frequency) - d.Set("description", resp.Description) - d.Set("start_time", string(resp.StartTime.Format(time.RFC3339))) - d.Set("expiry_time", string(resp.ExpiryTime.Format(time.RFC3339))) - d.Set("timezone", resp.TimeZone) + d.Set("automation_account_name", accountName) + d.Set("account_name", accountName) //todo remove once `account_name` is removed + d.Set("frequency", string(resp.Frequency)) + + if v := resp.StartTime; v != nil { + d.Set("start_time", string(v.Format(time.RFC3339))) + } + if v := resp.ExpiryTime; v != nil { + d.Set("expiry_time", string(v.Format(time.RFC3339))) + } + if v := resp.Interval; v != nil { + //seems to me missing its type in swagger, leading to it being a interface{} float64 + d.Set("interval", int(v.(float64))) + } + if v := resp.Description; v != nil { + d.Set("description", v) + } + if v := resp.TimeZone; v != nil { + d.Set("timezone", v) + } return nil } @@ -201,18 +268,16 @@ func resourceArmAutomationScheduleDelete(d *schema.ResourceData, meta interface{ if err != nil { return err } - resGroup := id.ResourceGroup - accName := id.Path["automationAccounts"] - name := id.Path["schedules"] - resp, err := client.Delete(ctx, resGroup, accName, name) + name := id.Path["schedules"] + resGroup := id.ResourceGroup + accountName := id.Path["automationAccounts"] + resp, err := client.Delete(ctx, resGroup, accountName, name) if err != nil { - if utils.ResponseWasNotFound(resp) { - return nil + if !utils.ResponseWasNotFound(resp) { + return fmt.Errorf("Error issuing AzureRM delete request for Automation Schedule '%s': %+v", name, err) } - - return fmt.Errorf("Error issuing AzureRM delete request for Automation Schedule '%s': %+v", name, err) } return nil diff --git a/azurerm/resource_arm_automation_schedule_test.go b/azurerm/resource_arm_automation_schedule_test.go index 33ac8d9a17091..74479f97d8e19 100644 --- a/azurerm/resource_arm_automation_schedule_test.go +++ b/azurerm/resource_arm_automation_schedule_test.go @@ -2,19 +2,93 @@ package azurerm import ( "fmt" - "testing" - "time" - - "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" + "strconv" + "testing" + "time" ) -func TestAccAzureRMAutomationSchedule_oneTime(t *testing.T) { +func TestAccAzureRMAutomationSchedule_oneTime_basic(t *testing.T) { + resourceName := "azurerm_automation_schedule.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMAutomationSchedule_oneTime_basic(ri, testLocation()), + Check: checkAccAzureRMAutomationSchedule_oneTime_basic(resourceName), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMAutomationSchedule_oneTime_complete(t *testing.T) { + resourceName := "azurerm_automation_schedule.test" + ri := acctest.RandInt() + + //the API returns the time in the timezone we pass in + //it also seems to strip seconds, hijack the RFC3339 format to have 0s there + loc, _ := time.LoadLocation("CET") + startTime := time.Now().UTC().Add(time.Hour * 7).In(loc).Format("2006-01-02T15:04:00Z07:00") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMAutomationSchedule_oneTime_complete(ri, testLocation(), startTime), + Check: checkAccAzureRMAutomationSchedule_oneTime_complete(resourceName, startTime), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMAutomationSchedule_oneTime_update(t *testing.T) { + resourceName := "azurerm_automation_schedule.test" + ri := acctest.RandInt() + + //the API returns the time in the timezone we pass in + //it also seems to strip seconds, hijack the RFC3339 format to have 0s there + loc, _ := time.LoadLocation("CET") + startTime := time.Now().UTC().Add(time.Hour * 7).In(loc).Format("2006-01-02T15:04:00Z07:00") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMAutomationSchedule_oneTime_basic(ri, testLocation()), + Check: checkAccAzureRMAutomationSchedule_oneTime_basic(resourceName), + }, + { + Config: testAccAzureRMAutomationSchedule_oneTime_complete(ri, testLocation(), startTime), + Check: checkAccAzureRMAutomationSchedule_oneTime_complete(resourceName, startTime), + }, + }, + }) +} + +func TestAccAzureRMAutomationSchedule_hourly(t *testing.T) { + resourceName := "azurerm_automation_schedule.test" ri := acctest.RandInt() - config := testAccAzureRMAutomationSchedule_oneTime(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -22,10 +96,79 @@ func TestAccAzureRMAutomationSchedule_oneTime(t *testing.T) { CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, Steps: []resource.TestStep{ { - Config: config, - Check: resource.ComposeTestCheckFunc( - testCheckAzureRMAutomationScheduleExistsAndFrequencyType("azurerm_automation_schedule.test", automation.OneTime), - ), + Config: testAccAzureRMAutomationSchedule_recurring_basic(ri, testLocation(), "Hour", 7), + Check: checkAccAzureRMAutomationSchedule_recurring_basic(resourceName, "Hour", 7), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMAutomationSchedule_daily(t *testing.T) { + resourceName := "azurerm_automation_schedule.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMAutomationSchedule_recurring_basic(ri, testLocation(), "Day", 7), + Check: checkAccAzureRMAutomationSchedule_recurring_basic(resourceName, "Day", 7), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMAutomationSchedule_weekly(t *testing.T) { + resourceName := "azurerm_automation_schedule.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMAutomationSchedule_recurring_basic(ri, testLocation(), "Week", 7), + Check: checkAccAzureRMAutomationSchedule_recurring_basic(resourceName, "Week", 7), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMAutomationSchedule_monthly(t *testing.T) { + resourceName := "azurerm_automation_schedule.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAutomationScheduleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMAutomationSchedule_recurring_basic(ri, testLocation(), "Month", 7), + Check: checkAccAzureRMAutomationSchedule_recurring_basic(resourceName, "Month", 7), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -64,8 +207,11 @@ func testCheckAzureRMAutomationScheduleDestroy(s *terraform.State) error { return nil } -func testCheckAzureRMAutomationScheduleExistsAndFrequencyType(name string, freq automation.ScheduleFrequency) resource.TestCheckFunc { +func testCheckAzureRMAutomationScheduleExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { + conn := testAccProvider.Meta().(*ArmClient).automationScheduleClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + // Ensure we have enough information in state to look up in API rs, ok := s.RootModule().Resources[name] if !ok { @@ -73,18 +219,14 @@ func testCheckAzureRMAutomationScheduleExistsAndFrequencyType(name string, freq } name := rs.Primary.Attributes["name"] - accName := rs.Primary.Attributes["account_name"] + accName := rs.Primary.Attributes["automation_account_name"] resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] if !hasResourceGroup { return fmt.Errorf("Bad: no resource group found in state for Automation Schedule: '%s'", name) } - conn := testAccProvider.Meta().(*ArmClient).automationScheduleClient - ctx := testAccProvider.Meta().(*ArmClient).StopContext - resp, err := conn.Get(ctx, resourceGroup, accName, name) - if err != nil { if utils.ResponseWasNotFound(resp.Response) { return fmt.Errorf("Automation Schedule '%s' (resource group: '%s') does not exist", name, resourceGroup) @@ -93,40 +235,106 @@ func testCheckAzureRMAutomationScheduleExistsAndFrequencyType(name string, freq return fmt.Errorf("Bad: Get on automationScheduleClient: %+v", err) } - if resp.Frequency != freq { - return fmt.Errorf("Current frequency %s is not consistent with checked value %s", resp.Frequency, freq) - } return nil } } -func testAccAzureRMAutomationSchedule_oneTime(rInt int, location string) string { - startTime := time.Now().UTC().Add(time.Duration(7) * time.Minute) - startTime = startTime.Add(time.Duration(-1*startTime.Second()) * time.Second) +func testAccAzureRMAutomationSchedule_prerequisites(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_automation_account" "test" { + name = "acctestAA-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku { + name = "Basic" + } +} + +`, rInt, location, rInt) +} +func testAccAzureRMAutomationSchedule_oneTime_basic(rInt int, location string) string { return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" +%s + +resource "azurerm_automation_schedule" "test" { + name = "acctestAS-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + automation_account_name = "${azurerm_automation_account.test.name}" + frequency = "OneTime" +} +`, testAccAzureRMAutomationSchedule_prerequisites(rInt, location), rInt) } -resource "azurerm_automation_account" "test" { - name = "acctest-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - sku { - name = "Basic" - } +func checkAccAzureRMAutomationSchedule_oneTime_basic(resourceName string) resource.TestCheckFunc { + return resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMAutomationScheduleExists("azurerm_automation_schedule.test"), + resource.TestCheckResourceAttrSet(resourceName, "name"), + resource.TestCheckResourceAttrSet(resourceName, "resource_group_name"), + resource.TestCheckResourceAttrSet(resourceName, "automation_account_name"), + resource.TestCheckResourceAttrSet(resourceName, "start_time"), + resource.TestCheckResourceAttr(resourceName, "frequency", "OneTime"), + resource.TestCheckResourceAttr(resourceName, "timezone", "UTC"), + ) } +func testAccAzureRMAutomationSchedule_oneTime_complete(rInt int, location, startTime string) string { + return fmt.Sprintf(` +%s + resource "azurerm_automation_schedule" "test" { - name = "OneTimer-%d" - resource_group_name = "${azurerm_resource_group.test.name}" - account_name = "${azurerm_automation_account.test.name}" - frequency = "OneTime" - timezone = "Central Europe Standard Time" - start_time = "%s" - description = "This is a test runbook for terraform acceptance test" -} -`, rInt, location, rInt, rInt, startTime.Format(time.RFC3339)) + name = "acctestAS-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + automation_account_name = "${azurerm_automation_account.test.name}" + frequency = "OneTime" + start_time = "%s" + timezone = "Central Europe Standard Time" + description = "This is an automation schedule" +} +`, testAccAzureRMAutomationSchedule_prerequisites(rInt, location), rInt, startTime) +} + +func checkAccAzureRMAutomationSchedule_oneTime_complete(resourceName, startTime string) resource.TestCheckFunc { + return resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMAutomationScheduleExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "name"), + resource.TestCheckResourceAttrSet(resourceName, "resource_group_name"), + resource.TestCheckResourceAttrSet(resourceName, "automation_account_name"), + resource.TestCheckResourceAttr(resourceName, "frequency", "OneTime"), + resource.TestCheckResourceAttr(resourceName, "start_time", startTime), + resource.TestCheckResourceAttr(resourceName, "timezone", "Central Europe Standard Time"), + resource.TestCheckResourceAttr(resourceName, "description", "This is an automation schedule"), + ) +} + +func testAccAzureRMAutomationSchedule_recurring_basic(rInt int, location, frequency string, interval int) string { + return fmt.Sprintf(` +%s + +resource "azurerm_automation_schedule" "test" { + name = "acctestAS-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + automation_account_name = "${azurerm_automation_account.test.name}" + frequency = "%s" + interval = "%d" +} +`, testAccAzureRMAutomationSchedule_prerequisites(rInt, location), rInt, frequency, interval) +} + +func checkAccAzureRMAutomationSchedule_recurring_basic(resourceName string, frequency string, interval int) resource.TestCheckFunc { + return resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMAutomationScheduleExists("azurerm_automation_schedule.test"), + resource.TestCheckResourceAttrSet(resourceName, "name"), + resource.TestCheckResourceAttrSet(resourceName, "resource_group_name"), + resource.TestCheckResourceAttrSet(resourceName, "automation_account_name"), + resource.TestCheckResourceAttrSet(resourceName, "start_time"), + resource.TestCheckResourceAttr(resourceName, "frequency", frequency), + resource.TestCheckResourceAttr(resourceName, "interval", strconv.Itoa(interval)), + resource.TestCheckResourceAttr(resourceName, "timezone", "UTC"), + ) } diff --git a/azurerm/resource_arm_cdn_endpoint.go b/azurerm/resource_arm_cdn_endpoint.go index ea7b660fc43b8..2e85c9cadf5d9 100644 --- a/azurerm/resource_arm_cdn_endpoint.go +++ b/azurerm/resource_arm_cdn_endpoint.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-04-02/cdn" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" diff --git a/azurerm/resource_arm_cdn_endpoint_test.go b/azurerm/resource_arm_cdn_endpoint_test.go index 235325a721c1d..1929c36df2410 100644 --- a/azurerm/resource_arm_cdn_endpoint_test.go +++ b/azurerm/resource_arm_cdn_endpoint_test.go @@ -157,6 +157,69 @@ func TestAccAzureRMCdnEndpoint_withGeoFilters(t *testing.T) { }, }) } +func TestAccAzureRMCdnEndpoint_fullFields(t *testing.T) { + resourceName := "azurerm_cdn_endpoint.test" + ri := acctest.RandInt() + config := testAccAzureRMCdnEndpoint_fullFields(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMCdnEndpointDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMCdnEndpointExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "is_http_allowed", "true"), + resource.TestCheckResourceAttr(resourceName, "is_https_allowed", "true"), + resource.TestCheckResourceAttr(resourceName, "origin_path", "/origin-path"), + resource.TestCheckResourceAttr(resourceName, "probe_path", "/origin-path/probe"), + resource.TestCheckResourceAttr(resourceName, "origin_host_header", "www.example.com"), + resource.TestCheckResourceAttr(resourceName, "optimization_type", "GeneralWebDelivery"), + resource.TestCheckResourceAttr(resourceName, "querystring_caching_behaviour", "UseQueryString"), + resource.TestCheckResourceAttr(resourceName, "content_types_to_compress.#", "1"), + resource.TestCheckResourceAttr(resourceName, "is_compression_enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "geo_filter.#", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.environment", "Production"), + ), + }, + }, + }) +} + +func TestAccAzureRMCdnEndpoint_isHttpAndHttpsAllowedUpdate(t *testing.T) { + resourceName := "azurerm_cdn_endpoint.test" + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMCdnEndpoint_isHttpAndHttpsAllowed(ri, location, "true", "false") + updatedConfig := testAccAzureRMCdnEndpoint_isHttpAndHttpsAllowed(ri, location, "false", "true") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMCdnEndpointDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMCdnEndpointExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "is_http_allowed", "true"), + resource.TestCheckResourceAttr(resourceName, "is_https_allowed", "false"), + ), + }, + { + Config: updatedConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMCdnEndpointExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "is_http_allowed", "false"), + resource.TestCheckResourceAttr(resourceName, "is_https_allowed", "true"), + ), + }, + }, + }) +} func testCheckAzureRMCdnEndpointExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -427,6 +490,7 @@ resource "azurerm_cdn_endpoint" "test" { } `, rInt, location, rInt, rInt) } + func testAccAzureRMCdnEndpoint_optimized(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { @@ -459,3 +523,84 @@ resource "azurerm_cdn_endpoint" "test" { } `, rInt, location, rInt, rInt) } + +func testAccAzureRMCdnEndpoint_fullFields(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_cdn_profile" "test" { + name = "acctestcdnprof%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Standard_Verizon" +} + +resource "azurerm_cdn_endpoint" "test" { + name = "acctestcdnend%d" + profile_name = "${azurerm_cdn_profile.test.name}" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + is_http_allowed = true + is_https_allowed = true + content_types_to_compress = ["text/html"] + is_compression_enabled = true + querystring_caching_behaviour = "UseQueryString" + origin_host_header = "www.example.com" + optimization_type = "GeneralWebDelivery" + origin_path = "/origin-path" + probe_path = "/origin-path/probe" + + origin { + name = "acceptanceTestCdnOrigin1" + host_name = "www.example.com" + https_port = 443 + http_port = 80 + } + + geo_filter { + relative_path = "/some-example-endpoint" + action = "Allow" + country_codes = ["GB"] + } + + tags { + environment = "Production" + } +} +`, rInt, location, rInt, rInt) +} + +func testAccAzureRMCdnEndpoint_isHttpAndHttpsAllowed(rInt int, location string, isHttpAllowed string, isHttpsAllowed string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_cdn_profile" "test" { + name = "acctestcdnprof%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Standard_Verizon" +} + +resource "azurerm_cdn_endpoint" "test" { + name = "acctestcdnend%d" + profile_name = "${azurerm_cdn_profile.test.name}" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + is_http_allowed = %s + is_https_allowed = %s + + origin { + name = "acceptanceTestCdnOrigin1" + host_name = "www.example.com" + https_port = 443 + http_port = 80 + } +} +`, rInt, location, rInt, rInt, isHttpAllowed, isHttpsAllowed) +} diff --git a/azurerm/resource_arm_cdn_profile.go b/azurerm/resource_arm_cdn_profile.go index 645cd09a80147..77fca987791c2 100644 --- a/azurerm/resource_arm_cdn_profile.go +++ b/azurerm/resource_arm_cdn_profile.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-04-02/cdn" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" @@ -38,7 +38,10 @@ func resourceArmCdnProfile() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(cdn.StandardAkamai), + string(cdn.StandardChinaCdn), string(cdn.StandardVerizon), + // TODO: replace this with an SDK constant once available + "Standard_Microsoft", string(cdn.PremiumVerizon), }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, diff --git a/azurerm/resource_arm_cdn_profile_test.go b/azurerm/resource_arm_cdn_profile_test.go index c8e30c42f0280..6630880d76e5c 100644 --- a/azurerm/resource_arm_cdn_profile_test.go +++ b/azurerm/resource_arm_cdn_profile_test.go @@ -138,6 +138,77 @@ func TestAccAzureRMCdnProfile_NonStandardCasing(t *testing.T) { }) } +func TestAccAzureRMCdnProfile_basicToStandardAkamai(t *testing.T) { + resourceName := "azurerm_cdn_profile.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMCdnProfile_basic(ri, testLocation()) + postConfig := testAccAzureRMCdnProfile_standardAkamai(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMCdnProfileDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMCdnProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard_Verizon"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMCdnProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard_Akamai"), + ), + }, + }, + }) +} + +func TestAccAzureRMCdnProfile_standardAkamai(t *testing.T) { + resourceName := "azurerm_cdn_profile.test" + ri := acctest.RandInt() + config := testAccAzureRMCdnProfile_standardAkamai(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMCdnProfileDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMCdnProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard_Akamai"), + ), + }, + }, + }) +} + +func TestAccAzureRMCdnProfile_standardMicrosoft(t *testing.T) { + resourceName := "azurerm_cdn_profile.test" + ri := acctest.RandInt() + config := testAccAzureRMCdnProfile_standardMicrosoft(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMCdnProfileDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMCdnProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard_Microsoft"), + ), + }, + }, + }) +} + func testCheckAzureRMCdnProfileExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API @@ -266,3 +337,35 @@ resource "azurerm_cdn_profile" "test" { } `, rInt, location, rInt) } + +func testAccAzureRMCdnProfile_standardAkamai(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_cdn_profile" "test" { + name = "acctestcdnprof%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Standard_Akamai" +} +`, rInt, location, rInt) +} + +func testAccAzureRMCdnProfile_standardMicrosoft(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_cdn_profile" "test" { + name = "acctestcdnprof%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Standard_Microsoft" +} +`, rInt, location, rInt) +} diff --git a/azurerm/resource_arm_container_group.go b/azurerm/resource_arm_container_group.go index 2199f3be51046..5e11908d934d4 100644 --- a/azurerm/resource_arm_container_group.go +++ b/azurerm/resource_arm_container_group.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-02-01-preview/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-04-01/containerinstance" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_container_registry.go b/azurerm/resource_arm_container_registry.go index fb1d5925e0e6e..89064aa4016d0 100644 --- a/azurerm/resource_arm_container_registry.go +++ b/azurerm/resource_arm_container_registry.go @@ -41,7 +41,6 @@ func resourceArmContainerRegistry() *schema.Resource { "sku": { Type: schema.TypeString, Optional: true, - ForceNew: true, Default: string(containerregistry.Classic), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ @@ -145,21 +144,21 @@ func resourceArmContainerRegistryCreate(d *schema.ResourceData, meta interface{} future, err := client.Create(ctx, resourceGroup, name, parameters) if err != nil { - return err + return fmt.Errorf("Error creating Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) if err != nil { - return err + return fmt.Errorf("Error waiting for creation of Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } read, err := client.Get(ctx, resourceGroup, name) if err != nil { - return err + return fmt.Errorf("Error retrieving Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } if read.ID == nil { - return fmt.Errorf("Cannot read Container Registry %s (resource group %s) ID", name, resourceGroup) + return fmt.Errorf("Cannot read Container Registry %q (resource group %q) ID", name, resourceGroup) } d.SetId(*read.ID) @@ -183,6 +182,10 @@ func resourceArmContainerRegistryUpdate(d *schema.ResourceData, meta interface{} RegistryPropertiesUpdateParameters: &containerregistry.RegistryPropertiesUpdateParameters{ AdminUserEnabled: utils.Bool(adminUserEnabled), }, + Sku: &containerregistry.Sku{ + Name: containerregistry.SkuName(sku), + Tier: containerregistry.SkuTier(sku), + }, Tags: expandTags(tags), } @@ -202,14 +205,17 @@ func resourceArmContainerRegistryUpdate(d *schema.ResourceData, meta interface{} future, err := client.Update(ctx, resourceGroup, name, parameters) if err != nil { - return err + return fmt.Errorf("Error updating Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error waiting for update of Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) + } read, err := client.Get(ctx, resourceGroup, name) if err != nil { - return err + return fmt.Errorf("Error retrieving Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } if read.ID == nil { @@ -235,11 +241,12 @@ func resourceArmContainerRegistryRead(d *schema.ResourceData, meta interface{}) resp, err := client.Get(ctx, resourceGroup, name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[DEBUG] Container Registry %q was not found in Resource Group %q", name, resourceGroup) d.SetId("") return nil } - return fmt.Errorf("Error making Read request on Azure Container Registry %q: %+v", name, err) + return fmt.Errorf("Error making Read request on Azure Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } d.Set("name", resp.Name) diff --git a/azurerm/resource_arm_container_registry_migrate_test.go b/azurerm/resource_arm_container_registry_migrate_test.go index ae61dc3599320..966fd99a8c99e 100644 --- a/azurerm/resource_arm_container_registry_migrate_test.go +++ b/azurerm/resource_arm_container_registry_migrate_test.go @@ -27,7 +27,7 @@ func TestAccAzureRMContainerRegistryMigrateState(t *testing.T) { client.StopContext = testAccProvider.StopContext() rs := acctest.RandString(4) - resourceGroupName := fmt.Sprintf("acctestrg%s", rs) + resourceGroupName := fmt.Sprintf("acctestRG%s", rs) storageAccountName := fmt.Sprintf("acctestsa%s", rs) location := azureRMNormalizeLocation(testLocation()) ctx := client.StopContext diff --git a/azurerm/resource_arm_container_registry_test.go b/azurerm/resource_arm_container_registry_test.go index 3cabb4e7d0534..76712201e1ebf 100644 --- a/azurerm/resource_arm_container_registry_test.go +++ b/azurerm/resource_arm_container_registry_test.go @@ -144,6 +144,35 @@ func TestAccAzureRMContainerRegistry_basicPremium(t *testing.T) { }) } +func TestAccAzureRMContainerRegistry_basicBasicUpgradePremium(t *testing.T) { + resourceName := "azurerm_container_registry.test" + ri := acctest.RandInt() + config := testAccAzureRMContainerRegistry_basicManaged(ri, testLocation(), "Basic") + configUpdated := testAccAzureRMContainerRegistry_basicManaged(ri, testLocation(), "Premium") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMContainerRegistryDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMContainerRegistryExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Basic"), + ), + }, + { + Config: configUpdated, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMContainerRegistryExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Premium"), + ), + }, + }, + }) +} + func TestAccAzureRMContainerRegistry_complete(t *testing.T) { ri := acctest.RandInt() rs := acctest.RandString(4) diff --git a/azurerm/resource_arm_container_service.go b/azurerm/resource_arm_container_service.go index 9eeea972ae35d..a29c396294bcb 100644 --- a/azurerm/resource_arm_container_service.go +++ b/azurerm/resource_arm_container_service.go @@ -8,7 +8,7 @@ import ( "bytes" - "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2017-09-30/containerservice" + "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2018-03-31/containerservice" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" diff --git a/azurerm/resource_arm_cosmos_db_account.go b/azurerm/resource_arm_cosmos_db_account.go index fb9309efcc6cb..0d822664b745e 100644 --- a/azurerm/resource_arm_cosmos_db_account.go +++ b/azurerm/resource_arm_cosmos_db_account.go @@ -48,32 +48,32 @@ func resourceArmCosmosDBAccount() *schema.Resource { //resource fields "offer_type": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ string(documentdb.Standard), }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, "kind": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Default: string(documentdb.GlobalDocumentDB), + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: string(documentdb.GlobalDocumentDB), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ string(documentdb.GlobalDocumentDB), string(documentdb.MongoDB), }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, "ip_range_filter": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringMatch( - regexp.MustCompile(`^(\b(?:(?: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]?)\b[,]?){1,}$`), - "Cosmos DB ip_range_filter must be a set of CIDR IP addresses separated by commas with no spaces: '10.0.0.1,10.0.0.2'", + regexp.MustCompile(`^(\b(?:(?: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]?)(\/[1-2][0-9])?\b[,]?){1,}$`), + "Cosmos DB ip_range_filter must be a set of CIDR IP addresses separated by commas with no spaces: '10.0.0.1,10.0.0.2,10.20.0.0/16'", ), }, @@ -173,12 +173,7 @@ func resourceArmCosmosDBAccount() *schema.Resource { Computed: true, }, - "location": { - Type: schema.TypeString, - Required: true, - StateFunc: azureRMNormalizeLocation, - DiffSuppressFunc: azureRMSuppressLocationDiff, - }, + "location": locationSchema(), "failover_priority": { Type: schema.TypeInt, @@ -190,6 +185,26 @@ func resourceArmCosmosDBAccount() *schema.Resource { Set: resourceAzureRMCosmosDBAccountGeoLocationHash, }, + "capabilities": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: validation.StringInSlice([]string{ + "EnableTable", + "EnableGremlin", + `EnableCassandra`, + }, true), + }, + }, + }, + Set: resourceAzureRMCosmosDBAccountCapabilitiesHash, + }, + //computed "endpoint": { Type: schema.TypeString, @@ -262,9 +277,16 @@ func resourceArmCosmosDBAccountCreate(d *schema.ResourceData, meta interface{}) ipRangeFilter := d.Get("ip_range_filter").(string) enableAutomaticFailover := d.Get("enable_automatic_failover").(bool) + r, err := client.CheckNameExists(ctx, name) + if err != nil { + return fmt.Errorf("Error checking if CosmosDB Account %q already exists (Resource Group %q): %+v", name, resourceGroup, err) + } + if !utils.ResponseWasNotFound(r) { + return fmt.Errorf("CosmosDB Account %s already exists, please import the resource via terraform import", name) + } + //hacky, todo fix up once deprecated field 'failover_policy' is removed var geoLocations []documentdb.Location - var err error if _, ok := d.GetOk("geo_location"); ok { geoLocations, err = expandAzureRmCosmosDBAccountGeoLocations(name, d) if err != nil { @@ -277,18 +299,19 @@ func resourceArmCosmosDBAccountCreate(d *schema.ResourceData, meta interface{}) } } else { //could be a CustomizeDiff?, but this is temporary - return fmt.Errorf("Neither `geo_location` or `failover_policy` is set for CosmosDB Account '%s'", name) + return fmt.Errorf("Neither `geo_location` or `failover_policy` is set for CosmosDB Account %s", name) } account := documentdb.DatabaseAccountCreateUpdateParameters{ Location: utils.String(location), Kind: documentdb.DatabaseAccountKind(kind), DatabaseAccountCreateUpdateProperties: &documentdb.DatabaseAccountCreateUpdateProperties{ - ConsistencyPolicy: expandAzureRmCosmosDBAccountConsistencyPolicy(d), - Locations: &geoLocations, DatabaseAccountOfferType: utils.String(offerType), IPRangeFilter: utils.String(ipRangeFilter), EnableAutomaticFailover: utils.Bool(enableAutomaticFailover), + ConsistencyPolicy: expandAzureRmCosmosDBAccountConsistencyPolicy(d), + Locations: &geoLocations, + Capabilities: expandAzureRmCosmosDBAccountCapabilities(d), }, Tags: expandTags(tags), } @@ -298,9 +321,7 @@ func resourceArmCosmosDBAccountCreate(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error creating CosmosDB Account %q (Resource Group %q): %+v", name, resourceGroup, err) } - //todo is this still required? - r := *resp - id := r.ID + id := resp.ID if id == nil { return fmt.Errorf("Cannot read CosmosDB Account '%s' (resource group %s) ID", name, resourceGroup) } @@ -369,11 +390,12 @@ func resourceArmCosmosDBAccountUpdate(d *schema.ResourceData, meta interface{}) Location: utils.String(location), Kind: documentdb.DatabaseAccountKind(kind), DatabaseAccountCreateUpdateProperties: &documentdb.DatabaseAccountCreateUpdateProperties{ - ConsistencyPolicy: expandAzureRmCosmosDBAccountConsistencyPolicy(d), - Locations: &oldLocations, DatabaseAccountOfferType: utils.String(offerType), IPRangeFilter: utils.String(ipRangeFilter), EnableAutomaticFailover: utils.Bool(enableAutomaticFailover), + Capabilities: expandAzureRmCosmosDBAccountCapabilities(d), + ConsistencyPolicy: expandAzureRmCosmosDBAccountConsistencyPolicy(d), + Locations: &oldLocations, }, Tags: expandTags(tags), } @@ -489,6 +511,10 @@ func resourceArmCosmosDBAccountRead(d *schema.ResourceData, meta interface{}) er } } + if err := d.Set("capabilities", flattenAzureRmCosmosDBAccountCapabilities(resp.Capabilities)); err != nil { + return fmt.Errorf("Error setting `capabilities`: %+v", err) + } + if p := resp.ReadLocations; p != nil { readEndpoints := []string{} for _, l := range *p { @@ -734,6 +760,19 @@ func expandAzureRmCosmosDBAccountFailoverPolicy(databaseName string, d *schema.R return locations, nil } +func expandAzureRmCosmosDBAccountCapabilities(d *schema.ResourceData) *[]documentdb.Capability { + + capabilities := d.Get("capabilities").(*schema.Set).List() + s := make([]documentdb.Capability, 0, 0) + + for _, c := range capabilities { + m := c.(map[string]interface{}) + s = append(s, documentdb.Capability{Name: utils.String(m["name"].(string))}) + } + + return &s +} + func flattenAzureRmCosmosDBAccountConsistencyPolicy(policy *documentdb.ConsistencyPolicy) []interface{} { result := map[string]interface{}{} @@ -800,6 +839,23 @@ func flattenAzureRmCosmosDBAccountGeoLocations(d *schema.ResourceData, account d return &locationSet } +func flattenAzureRmCosmosDBAccountCapabilities(capabilities *[]documentdb.Capability) *schema.Set { + s := schema.Set{ + F: resourceAzureRMCosmosDBAccountCapabilitiesHash, + } + + for _, c := range *capabilities { + if v := c.Name; v != nil { + e := map[string]interface{}{ + "name": *v, + } + s.Add(e) + } + } + + return &s +} + //todo remove once deprecated field `failover_policy` is removed func resourceAzureRMCosmosDBAccountFailoverPolicyHash(v interface{}) int { var buf bytes.Buffer @@ -830,3 +886,13 @@ func resourceAzureRMCosmosDBAccountGeoLocationHash(v interface{}) int { return hashcode.String(buf.String()) } + +func resourceAzureRMCosmosDBAccountCapabilitiesHash(v interface{}) int { + var buf bytes.Buffer + + if m, ok := v.(map[string]interface{}); ok { + buf.WriteString(fmt.Sprintf("%s-", m["name"].(string))) + } + + return hashcode.String(buf.String()) +} diff --git a/azurerm/resource_arm_cosmos_db_account_test.go b/azurerm/resource_arm_cosmos_db_account_test.go index 7fc025d97389e..cb137d77897ad 100644 --- a/azurerm/resource_arm_cosmos_db_account_test.go +++ b/azurerm/resource_arm_cosmos_db_account_test.go @@ -262,6 +262,56 @@ func TestAccAzureRMCosmosDBAccount_mongoDB(t *testing.T) { }) } +func TestAccAzureRMCosmosDBAccount_gremlin(t *testing.T) { + ri := acctest.RandInt() + resourceName := "azurerm_cosmosdb_account.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMCosmosDBAccount_gremlin(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 1), + resource.TestCheckResourceAttr(resourceName, "kind", "GlobalDocumentDB"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMCosmosDBAccount_table(t *testing.T) { + ri := acctest.RandInt() + resourceName := "azurerm_cosmosdb_account.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMCosmosDBAccount_table(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 1), + resource.TestCheckResourceAttr(resourceName, "kind", "GlobalDocumentDB"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAbcAzureRMCosmosDBAccount_updatePropertiesAndLocation(t *testing.T) { ri := acctest.RandInt() resourceName := "azurerm_cosmosdb_account.test" @@ -393,7 +443,7 @@ func TestAccAzureRMCosmosDBAccount_complete(t *testing.T) { Config: testAccAzureRMCosmosDBAccount_complete(ri, testLocation(), testAltLocation()), Check: resource.ComposeAggregateTestCheckFunc( checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 2), - resource.TestCheckResourceAttr(resourceName, "ip_range_filter", "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26"), + resource.TestCheckResourceAttr(resourceName, "ip_range_filter", "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26,10.20.0.0/16"), resource.TestCheckResourceAttr(resourceName, "enable_automatic_failover", "true"), ), }, @@ -477,7 +527,7 @@ resource "azurerm_cosmosdb_account" "test" { consistency_policy { consistency_level = "%s" - %s + %s } geo_location { @@ -504,6 +554,26 @@ func testAccAzureRMCosmosDBAccount_mongoDB(rInt int, location string) string { `) } +func testAccAzureRMCosmosDBAccount_gremlin(rInt int, location string) string { + return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", ` + kind = "GlobalDocumentDB" + + capabilities = { + name = "EnableGremlin" + } + `) +} + +func testAccAzureRMCosmosDBAccount_table(rInt int, location string) string { + return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", ` + kind = "GlobalDocumentDB" + + capabilities = { + name = "EnableTable" + } + `) +} + func testAccAzureRMCosmosDBAccount_geoReplicated(rInt int, location string, altLocation string) string { return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", fmt.Sprintf(` geo_location { @@ -527,7 +597,7 @@ func testAccAzureRMCosmosDBAccount_geoReplicated_customId(rInt int, location str func testAccAzureRMCosmosDBAccount_complete(rInt int, location string, altLocation string) string { return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", fmt.Sprintf(` - ip_range_filter = "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26" + ip_range_filter = "104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26,10.20.0.0/16" enable_automatic_failover = true geo_location { @@ -543,7 +613,7 @@ func checkAccAzureRMCosmosDBAccount_basic(resourceName string, location string, testCheckAzureRMCosmosDBAccountExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "name"), resource.TestCheckResourceAttrSet(resourceName, "resource_group_name"), - resource.TestCheckResourceAttr(resourceName, "location", location), + resource.TestCheckResourceAttr(resourceName, "location", azureRMNormalizeLocation(location)), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "offer_type", string(documentdb.Standard)), resource.TestCheckResourceAttr(resourceName, "consistency_policy.0.consistency_level", consistency), diff --git a/azurerm/resource_arm_data_lake_store_test.go b/azurerm/resource_arm_data_lake_store_test.go index 488673fe5d809..c0dc71fc5fc3f 100644 --- a/azurerm/resource_arm_data_lake_store_test.go +++ b/azurerm/resource_arm_data_lake_store_test.go @@ -160,7 +160,7 @@ func testCheckAzureRMDataLakeStoreDestroy(s *terraform.State) error { func testAccAzureRMDataLakeStore_basic(rInt int, rs string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -175,7 +175,7 @@ resource "azurerm_data_lake_store" "test" { func testAccAzureRMDataLakeStore_tier(rInt int, rs string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -191,7 +191,7 @@ resource "azurerm_data_lake_store" "test" { func testAccAzureRMDataLakeStore_withTags(rInt int, rs string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -211,7 +211,7 @@ resource "azurerm_data_lake_store" "test" { func testAccAzureRMDataLakeStore_withTagsUpdate(rInt int, rs string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_a_record.go b/azurerm/resource_arm_dns_a_record.go index 06945cf1c9333..c8459d777aae1 100644 --- a/azurerm/resource_arm_dns_a_record.go +++ b/azurerm/resource_arm_dns_a_record.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_dns_a_record_test.go b/azurerm/resource_arm_dns_a_record_test.go index 0677009a77936..022f44f607e5f 100644 --- a/azurerm/resource_arm_dns_a_record_test.go +++ b/azurerm/resource_arm_dns_a_record_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -153,7 +153,7 @@ func testCheckAzureRMDnsARecordDestroy(s *terraform.State) error { func testAccAzureRMDnsARecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -175,7 +175,7 @@ resource "azurerm_dns_a_record" "test" { func testAccAzureRMDnsARecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -197,7 +197,7 @@ resource "azurerm_dns_a_record" "test" { func testAccAzureRMDnsARecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -224,7 +224,7 @@ resource "azurerm_dns_a_record" "test" { func testAccAzureRMDnsARecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_aaaa_record.go b/azurerm/resource_arm_dns_aaaa_record.go index 29c195105e7fa..68b05687d087b 100644 --- a/azurerm/resource_arm_dns_aaaa_record.go +++ b/azurerm/resource_arm_dns_aaaa_record.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_dns_aaaa_record_test.go b/azurerm/resource_arm_dns_aaaa_record_test.go index a46ecd39e7b31..a4df807e169eb 100644 --- a/azurerm/resource_arm_dns_aaaa_record_test.go +++ b/azurerm/resource_arm_dns_aaaa_record_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -153,7 +153,7 @@ func testCheckAzureRMDnsAaaaRecordDestroy(s *terraform.State) error { func testAccAzureRMDnsAAAARecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -175,7 +175,7 @@ resource "azurerm_dns_aaaa_record" "test" { func testAccAzureRMDnsAAAARecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -197,7 +197,7 @@ resource "azurerm_dns_aaaa_record" "test" { func testAccAzureRMDnsAAAARecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -224,7 +224,7 @@ resource "azurerm_dns_aaaa_record" "test" { func testAccAzureRMDnsAAAARecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_caa_record.go b/azurerm/resource_arm_dns_caa_record.go new file mode 100644 index 0000000000000..afa9053da99d6 --- /dev/null +++ b/azurerm/resource_arm_dns_caa_record.go @@ -0,0 +1,223 @@ +package azurerm + +import ( + "bytes" + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" + "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmDnsCaaRecord() *schema.Resource { + return &schema.Resource{ + Create: resourceArmDnsCaaRecordCreateOrUpdate, + Read: resourceArmDnsCaaRecordRead, + Update: resourceArmDnsCaaRecordCreateOrUpdate, + Delete: resourceArmDnsCaaRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "resource_group_name": resourceGroupNameSchema(), + + "zone_name": { + Type: schema.TypeString, + Required: true, + }, + + "record": { + Type: schema.TypeSet, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "flags": { + Type: schema.TypeInt, + Required: true, + }, + + "tag": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "issue", + "issuewild", + "iodef", + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + Set: resourceArmDnsCaaRecordHash, + }, + + "ttl": { + Type: schema.TypeInt, + Required: true, + }, + + "tags": tagsSchema(), + }, + } +} + +func resourceArmDnsCaaRecordCreateOrUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).dnsClient + ctx := meta.(*ArmClient).StopContext + + name := d.Get("name").(string) + resGroup := d.Get("resource_group_name").(string) + zoneName := d.Get("zone_name").(string) + ttl := int64(d.Get("ttl").(int)) + tags := d.Get("tags").(map[string]interface{}) + + records, err := expandAzureRmDnsCaaRecords(d) + if err != nil { + return err + } + + parameters := dns.RecordSet{ + Name: &name, + RecordSetProperties: &dns.RecordSetProperties{ + Metadata: expandTags(tags), + TTL: &ttl, + CaaRecords: &records, + }, + } + + eTag := "" + ifNoneMatch := "" // set to empty to allow updates to records after creation + resp, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.CAA, parameters, eTag, ifNoneMatch) + if err != nil { + return err + } + + if resp.ID == nil { + return fmt.Errorf("Cannot read DNS CAA Record %s (resource group %s) ID", name, resGroup) + } + + d.SetId(*resp.ID) + + return resourceArmDnsCaaRecordRead(d, meta) +} + +func resourceArmDnsCaaRecordRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).dnsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + resGroup := id.ResourceGroup + name := id.Path["CAA"] + zoneName := id.Path["dnszones"] + + resp, err := client.Get(ctx, resGroup, zoneName, name, dns.CAA) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("Error reading DNS CAA record %s: %v", name, err) + } + + d.Set("name", name) + d.Set("resource_group_name", resGroup) + d.Set("zone_name", zoneName) + d.Set("ttl", resp.TTL) + + if err := d.Set("record", flattenAzureRmDnsCaaRecords(resp.CaaRecords)); err != nil { + return err + } + flattenAndSetTags(d, resp.Metadata) + + return nil +} + +func resourceArmDnsCaaRecordDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).dnsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + resGroup := id.ResourceGroup + name := id.Path["CAA"] + zoneName := id.Path["dnszones"] + + resp, error := client.Delete(ctx, resGroup, zoneName, name, dns.CAA, "") + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("Error deleting DNS CAA Record %s: %+v", name, error) + } + + return nil +} + +func flattenAzureRmDnsCaaRecords(records *[]dns.CaaRecord) []map[string]interface{} { + results := make([]map[string]interface{}, 0, len(*records)) + + if records != nil { + for _, record := range *records { + results = append(results, map[string]interface{}{ + "flags": *record.Flags, + "tag": *record.Tag, + "value": *record.Value, + }) + } + } + + return results +} + +func expandAzureRmDnsCaaRecords(d *schema.ResourceData) ([]dns.CaaRecord, error) { + recordStrings := d.Get("record").(*schema.Set).List() + records := make([]dns.CaaRecord, len(recordStrings)) + + for i, v := range recordStrings { + record := v.(map[string]interface{}) + flags := int32(record["flags"].(int)) + tag := record["tag"].(string) + value := record["value"].(string) + + caaRecord := dns.CaaRecord{ + Flags: &flags, + Tag: &tag, + Value: &value, + } + + records[i] = caaRecord + } + + return records, nil +} + +func resourceArmDnsCaaRecordHash(v interface{}) int { + var buf bytes.Buffer + + if m, ok := v.(map[string]interface{}); ok { + buf.WriteString(fmt.Sprintf("%d-", m["flags"].(int))) + buf.WriteString(fmt.Sprintf("%s-", m["tag"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["value"].(string))) + } + + return hashcode.String(buf.String()) +} diff --git a/azurerm/resource_arm_dns_caa_record_test.go b/azurerm/resource_arm_dns_caa_record_test.go new file mode 100644 index 0000000000000..ebbdd07134909 --- /dev/null +++ b/azurerm/resource_arm_dns_caa_record_test.go @@ -0,0 +1,322 @@ +package azurerm + +import ( + "fmt" + "net/http" + "testing" + + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAzureRMDnsCaaRecord_basic(t *testing.T) { + resourceName := "azurerm_dns_caa_record.test" + ri := acctest.RandInt() + config := testAccAzureRMDnsCaaRecord_basic(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsCaaRecordDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsCaaRecordExists(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMDnsCaaRecord_updateRecords(t *testing.T) { + resourceName := "azurerm_dns_caa_record.test" + ri := acctest.RandInt() + location := testLocation() + preConfig := testAccAzureRMDnsCaaRecord_basic(ri, location) + postConfig := testAccAzureRMDnsCaaRecord_updateRecords(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsCaaRecordDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsCaaRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "record.#", "4"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsCaaRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "record.#", "5"), + ), + }, + }, + }) +} + +func TestAccAzureRMDnsCaaRecord_withTags(t *testing.T) { + resourceName := "azurerm_dns_caa_record.test" + ri := acctest.RandInt() + location := testLocation() + preConfig := testAccAzureRMDnsCaaRecord_withTags(ri, location) + postConfig := testAccAzureRMDnsCaaRecord_withTagsUpdate(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsCaaRecordDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsCaaRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsCaaRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + ), + }, + }, + }) +} + +func testCheckAzureRMDnsCaaRecordExists(name string) resource.TestCheckFunc { + return func(s *terraform.State) error { + // Ensure we have enough information in state to look up in API + rs, ok := s.RootModule().Resources[name] + if !ok { + return fmt.Errorf("Not found: %s", name) + } + + caaName := rs.Primary.Attributes["name"] + zoneName := rs.Primary.Attributes["zone_name"] + resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] + if !hasResourceGroup { + return fmt.Errorf("Bad: no resource group found in state for DNS CAA record: %s", caaName) + } + + conn := testAccProvider.Meta().(*ArmClient).dnsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + resp, err := conn.Get(ctx, resourceGroup, zoneName, caaName, dns.CAA) + if err != nil { + return fmt.Errorf("Bad: Get CAA RecordSet: %+v", err) + } + + if resp.StatusCode == http.StatusNotFound { + return fmt.Errorf("Bad: DNS CAA record %s (resource group: %s) does not exist", caaName, resourceGroup) + } + + return nil + } +} + +func testCheckAzureRMDnsCaaRecordDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*ArmClient).dnsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_dns_caa_record" { + continue + } + + caaName := rs.Primary.Attributes["name"] + zoneName := rs.Primary.Attributes["zone_name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := conn.Get(ctx, resourceGroup, zoneName, caaName, dns.CAA) + + if err != nil { + if resp.StatusCode == http.StatusNotFound { + return nil + } + + return err + } + + return fmt.Errorf("DNS CAA record still exists:\n%#v", resp.RecordSetProperties) + } + + return nil +} + +func testAccAzureRMDnsCaaRecord_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_caa_record" "test" { + name = "myarecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + record { + flags = 0 + tag = "issue" + value = "example.com" + } + + record { + flags = 0 + tag = "issue" + value = "example.net" + } + + record { + flags = 1 + tag = "issuewild" + value = ";" + } + + record { + flags = 0 + tag = "iodef" + value = "mailto:terraform@nonexist.tld" + } +} +`, rInt, location, rInt, rInt) +} + +func testAccAzureRMDnsCaaRecord_updateRecords(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_caa_record" "test" { + name = "myarecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + record { + flags = 0 + tag = "issue" + value = "example.com" + } + + record { + flags = 0 + tag = "issue" + value = "example.net" + } + + record { + flags = 1 + tag = "issuewild" + value = ";" + } + + record { + flags = 0 + tag = "iodef" + value = "mailto:terraform@nonexist.tld" + } + + record { + flags = 0 + tag = "issue" + value = "letsencrypt.org" + } +} +`, rInt, location, rInt, rInt) +} + +func testAccAzureRMDnsCaaRecord_withTags(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_caa_record" "test" { + name = "myarecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + record { + flags = 0 + tag = "issue" + value = "example.net" + } + + record { + flags = 1 + tag = "issuewild" + value = ";" + } + + tags { + environment = "Production" + cost_center = "MSFT" + } +} +`, rInt, location, rInt, rInt) +} + +func testAccAzureRMDnsCaaRecord_withTagsUpdate(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_caa_record" "test" { + name = "myarecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + record { + flags = 0 + tag = "issue" + value = "example.net" + } + + record { + flags = 1 + tag = "issuewild" + value = ";" + } + + tags { + environment = "staging" + } +} +`, rInt, location, rInt, rInt) +} diff --git a/azurerm/resource_arm_dns_cname_record.go b/azurerm/resource_arm_dns_cname_record.go index 108e7fc3ac4b8..f99b524329c50 100644 --- a/azurerm/resource_arm_dns_cname_record.go +++ b/azurerm/resource_arm_dns_cname_record.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_dns_cname_record_test.go b/azurerm/resource_arm_dns_cname_record_test.go index f856fa528eb1a..f5bfa4f68079c 100644 --- a/azurerm/resource_arm_dns_cname_record_test.go +++ b/azurerm/resource_arm_dns_cname_record_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -172,7 +172,7 @@ func testCheckAzureRMDnsCNameRecordDestroy(s *terraform.State) error { func testAccAzureRMDnsCNameRecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -194,7 +194,7 @@ resource "azurerm_dns_cname_record" "test" { func testAccAzureRMDnsCNameRecord_subdomain(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -216,7 +216,7 @@ resource "azurerm_dns_cname_record" "test" { func testAccAzureRMDnsCNameRecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -238,7 +238,7 @@ resource "azurerm_dns_cname_record" "test" { func testAccAzureRMDnsCNameRecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -265,7 +265,7 @@ resource "azurerm_dns_cname_record" "test" { func testAccAzureRMDnsCNameRecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_mx_record.go b/azurerm/resource_arm_dns_mx_record.go index 82f87f1ec879e..e8d9593c6aa6a 100644 --- a/azurerm/resource_arm_dns_mx_record.go +++ b/azurerm/resource_arm_dns_mx_record.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_dns_mx_record_test.go b/azurerm/resource_arm_dns_mx_record_test.go index e7b7fab9a9324..c7972c3fc07b9 100644 --- a/azurerm/resource_arm_dns_mx_record_test.go +++ b/azurerm/resource_arm_dns_mx_record_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -153,7 +153,7 @@ func testCheckAzureRMDnsMxRecordDestroy(s *terraform.State) error { func testAccAzureRMDnsMxRecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -184,7 +184,7 @@ resource "azurerm_dns_mx_record" "test" { func testAccAzureRMDnsMxRecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -220,7 +220,7 @@ resource "azurerm_dns_mx_record" "test" { func testAccAzureRMDnsMxRecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -256,7 +256,7 @@ resource "azurerm_dns_mx_record" "test" { func testAccAzureRMDnsMxRecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_ns_record.go b/azurerm/resource_arm_dns_ns_record.go index 8f6d1b8b9afe3..4319c5357b215 100644 --- a/azurerm/resource_arm_dns_ns_record.go +++ b/azurerm/resource_arm_dns_ns_record.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -33,9 +33,21 @@ func resourceArmDnsNsRecord() *schema.Resource { Required: true, }, + "records": { + Type: schema.TypeList, + //TODO: add `Required: true` once we remove the `record` attribute + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + ConflictsWith: []string{"record"}, + }, + "record": { - Type: schema.TypeSet, - Required: true, + Type: schema.TypeSet, + Optional: true, + Computed: true, + Deprecated: "This field has been replaced by `records`", + ConflictsWith: []string{"records"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "nsdname": { @@ -122,8 +134,13 @@ func resourceArmDnsNsRecordRead(d *schema.ResourceData, meta interface{}) error d.Set("zone_name", zoneName) d.Set("ttl", resp.TTL) - if err := d.Set("record", flattenAzureRmDnsNsRecords(resp.NsRecords)); err != nil { - return err + if err := d.Set("records", flattenAzureRmDnsNsRecords(resp.NsRecords)); err != nil { + return fmt.Errorf("Error settings `records`: %+v", err) + } + + //TODO: remove this once we remove the `record` attribute + if err := d.Set("record", flattenAzureRmDnsNsRecordsSet(resp.NsRecords)); err != nil { + return fmt.Errorf("Error settings `record`: %+v", err) } flattenAndSetTags(d, resp.Metadata) @@ -152,14 +169,14 @@ func resourceArmDnsNsRecordDelete(d *schema.ResourceData, meta interface{}) erro return nil } -func flattenAzureRmDnsNsRecords(records *[]dns.NsRecord) []map[string]interface{} { +//TODO: remove this once we remove the `record` attribute +func flattenAzureRmDnsNsRecordsSet(records *[]dns.NsRecord) []map[string]interface{} { results := make([]map[string]interface{}, 0, len(*records)) if records != nil { for _, record := range *records { nsRecord := make(map[string]interface{}) nsRecord["nsdname"] = *record.Nsdname - results = append(results, nsRecord) } } @@ -167,20 +184,48 @@ func flattenAzureRmDnsNsRecords(records *[]dns.NsRecord) []map[string]interface{ return results } +func flattenAzureRmDnsNsRecords(records *[]dns.NsRecord) []string { + results := make([]string, 0, len(*records)) + + if records != nil { + for _, record := range *records { + results = append(results, *record.Nsdname) + } + } + + return results +} + func expandAzureRmDnsNsRecords(d *schema.ResourceData) ([]dns.NsRecord, error) { - recordStrings := d.Get("record").(*schema.Set).List() - records := make([]dns.NsRecord, len(recordStrings)) + var records []dns.NsRecord - for i, v := range recordStrings { - record := v.(map[string]interface{}) - nsdName := record["nsdname"].(string) + //TODO: remove this once we remove the `record` attribute + if d.HasChange("records") || !d.HasChange("record") { + recordStrings := d.Get("records").([]interface{}) + records = make([]dns.NsRecord, len(recordStrings)) + for i, v := range recordStrings { + record := v.(string) - nsRecord := dns.NsRecord{ - Nsdname: &nsdName, - } + nsRecord := dns.NsRecord{ + Nsdname: &record, + } - records[i] = nsRecord + records[i] = nsRecord + } + } else { + recordList := d.Get("record").(*schema.Set).List() + if len(recordList) != 0 { + records = make([]dns.NsRecord, len(recordList)) + for i, v := range recordList { + record := v.(map[string]interface{}) + nsdname := record["nsdname"].(string) + nsRecord := dns.NsRecord{ + Nsdname: &nsdname, + } + + records[i] = nsRecord + } + } } - return records, nil } diff --git a/azurerm/resource_arm_dns_ns_record_test.go b/azurerm/resource_arm_dns_ns_record_test.go index 32bddc4e87383..3e2b2ddd1ec79 100644 --- a/azurerm/resource_arm_dns_ns_record_test.go +++ b/azurerm/resource_arm_dns_ns_record_test.go @@ -5,12 +5,33 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) +//TODO: remove this once we remove the `record` attribute +func TestAccAzureRMDnsNsRecord_deprecatedBasic(t *testing.T) { + resourceName := "azurerm_dns_ns_record.test" + ri := acctest.RandInt() + config := testAccAzureRMDnsNsRecord_deprecatedBasic(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsNsRecordDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsNsRecordExists(resourceName), + ), + }, + }, + }) +} + func TestAccAzureRMDnsNsRecord_basic(t *testing.T) { resourceName := "azurerm_dns_ns_record.test" ri := acctest.RandInt() @@ -31,6 +52,37 @@ func TestAccAzureRMDnsNsRecord_basic(t *testing.T) { }) } +//TODO: remove this once we remove the `record` attribute +func TestAccAzureRMDnsNsRecord_deprecatedUpdateRecords(t *testing.T) { + resourceName := "azurerm_dns_ns_record.test" + ri := acctest.RandInt() + location := testLocation() + preConfig := testAccAzureRMDnsNsRecord_deprecatedBasic(ri, location) + postConfig := testAccAzureRMDnsNsRecord_deprecatedUpdateRecords(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsNsRecordDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsNsRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "record.#", "2"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsNsRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "record.#", "3"), + ), + }, + }, + }) +} + func TestAccAzureRMDnsNsRecord_updateRecords(t *testing.T) { resourceName := "azurerm_dns_ns_record.test" ri := acctest.RandInt() @@ -47,14 +99,76 @@ func TestAccAzureRMDnsNsRecord_updateRecords(t *testing.T) { Config: preConfig, Check: resource.ComposeTestCheckFunc( testCheckAzureRMDnsNsRecordExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "record.#", "2"), + resource.TestCheckResourceAttr(resourceName, "records.#", "2"), ), }, { Config: postConfig, Check: resource.ComposeTestCheckFunc( testCheckAzureRMDnsNsRecordExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "record.#", "3"), + resource.TestCheckResourceAttr(resourceName, "records.#", "3"), + ), + }, + }, + }) +} + +//TODO: remove this once we remove the `record` attribute +func TestAccAzureRMDnsNsRecord_deprecatedChangeRecordToRecords(t *testing.T) { + resourceName := "azurerm_dns_ns_record.test" + ri := acctest.RandInt() + location := testLocation() + preConfig := testAccAzureRMDnsNsRecord_deprecatedBasic(ri, location) + postConfig := testAccAzureRMDnsNsRecord_deprecatedBasicNewRecords(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsNsRecordDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsNsRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "records.#", "2"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsNsRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "records.#", "2"), + ), + }, + }, + }) +} + +//TODO: remove this once we remove the `record` attribute +func TestAccAzureRMDnsNsRecord_deprecatedWithTags(t *testing.T) { + resourceName := "azurerm_dns_ns_record.test" + ri := acctest.RandInt() + location := testLocation() + preConfig := testAccAzureRMDnsNsRecord_deprecatedWithTags(ri, location) + postConfig := testAccAzureRMDnsNsRecord_deprecatedWithTagsUpdate(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsNsRecordDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsNsRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsNsRecordExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), ), }, }, @@ -152,7 +266,31 @@ func testCheckAzureRMDnsNsRecordDestroy(s *terraform.State) error { func testAccAzureRMDnsNsRecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_ns_record" "test" { + name = "mynsrecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + records = ["ns1.contoso.com", "ns2.contoso.com"] +} +`, rInt, location, rInt, rInt) +} + +//TODO: remove this once we remove the `record` attribute +func testAccAzureRMDnsNsRecord_deprecatedBasic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" location = "%s" } @@ -168,20 +306,68 @@ resource "azurerm_dns_ns_record" "test" { ttl = 300 record { - nsdname = "ns1.contoso.com" + nsdname = "ns1.contoso.com" } record { - nsdname = "ns2.contoso.com" + nsdname = "ns2.contoso.com" } } `, rInt, location, rInt, rInt) } +//TODO: remove this once we remove the `record` attribute +func testAccAzureRMDnsNsRecord_deprecatedBasicNewRecords(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_ns_record" "test" { + name = "mynsrecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + records = ["ns2.contoso.com", "ns1.contoso.com"] +} +`, rInt, location, rInt, rInt) +} + func testAccAzureRMDnsNsRecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_ns_record" "test" { + name = "mynsrecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + records = ["ns1.contoso.com", "ns2.contoso.com", "ns3.contoso.com"] +} +`, rInt, location, rInt, rInt) +} + +//TODO: remove this once we remove the `record` attribute +func testAccAzureRMDnsNsRecord_deprecatedUpdateRecords(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" location = "%s" } @@ -214,7 +400,7 @@ resource "azurerm_dns_ns_record" "test" { func testAccAzureRMDnsNsRecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -229,9 +415,38 @@ resource "azurerm_dns_ns_record" "test" { zone_name = "${azurerm_dns_zone.test.name}" ttl = 300 - record { - nsdname = "ns1.contoso.com" + records = ["ns1.contoso.com", "ns2.contoso.com"] + + tags { + environment = "Production" + cost_center = "MSFT" } +} +`, rInt, location, rInt, rInt) +} + +//TODO: remove this once we remove the `record` attribute +func testAccAzureRMDnsNsRecord_deprecatedWithTags(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_ns_record" "test" { + name = "mynsrecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + record { + nsdname = "ns1.contoso.com" + } record { nsdname = "ns2.contoso.com" @@ -248,7 +463,35 @@ resource "azurerm_dns_ns_record" "test" { func testAccAzureRMDnsNsRecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_ns_record" "test" { + name = "mynsrecord%d" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_name = "${azurerm_dns_zone.test.name}" + ttl = 300 + + records = ["ns1.contoso.com", "ns2.contoso.com"] + + tags { + environment = "staging" + } +} +`, rInt, location, rInt, rInt) +} + +//TODO: remove this once we remove the `record` attribute +func testAccAzureRMDnsNsRecord_deprecatedWithTagsUpdate(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_ptr_record.go b/azurerm/resource_arm_dns_ptr_record.go index d4b52341c5873..940daf2f5483e 100644 --- a/azurerm/resource_arm_dns_ptr_record.go +++ b/azurerm/resource_arm_dns_ptr_record.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_dns_ptr_record_test.go b/azurerm/resource_arm_dns_ptr_record_test.go index 805f1d7d926b8..6a4d580718eb7 100644 --- a/azurerm/resource_arm_dns_ptr_record_test.go +++ b/azurerm/resource_arm_dns_ptr_record_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -153,7 +153,7 @@ func testCheckAzureRMDnsPtrRecordDestroy(s *terraform.State) error { func testAccAzureRMDnsPtrRecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -175,7 +175,7 @@ resource "azurerm_dns_ptr_record" "test" { func testAccAzureRMDnsPtrRecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -197,7 +197,7 @@ resource "azurerm_dns_ptr_record" "test" { func testAccAzureRMDnsPtrRecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -224,7 +224,7 @@ resource "azurerm_dns_ptr_record" "test" { func testAccAzureRMDnsPtrRecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_srv_record.go b/azurerm/resource_arm_dns_srv_record.go index 636769e983a1c..098d10cf1bc2e 100644 --- a/azurerm/resource_arm_dns_srv_record.go +++ b/azurerm/resource_arm_dns_srv_record.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_dns_srv_record_test.go b/azurerm/resource_arm_dns_srv_record_test.go index e35c5c40dab60..8b50e58428a22 100644 --- a/azurerm/resource_arm_dns_srv_record_test.go +++ b/azurerm/resource_arm_dns_srv_record_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -153,7 +153,7 @@ func testCheckAzureRMDnsSrvRecordDestroy(s *terraform.State) error { func testAccAzureRMDnsSrvRecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -188,7 +188,7 @@ resource "azurerm_dns_srv_record" "test" { func testAccAzureRMDnsSrvRecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -230,7 +230,7 @@ resource "azurerm_dns_srv_record" "test" { func testAccAzureRMDnsSrvRecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -270,7 +270,7 @@ resource "azurerm_dns_srv_record" "test" { func testAccAzureRMDnsSrvRecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_txt_record.go b/azurerm/resource_arm_dns_txt_record.go index 297d322240e78..250470a82394a 100644 --- a/azurerm/resource_arm_dns_txt_record.go +++ b/azurerm/resource_arm_dns_txt_record.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_dns_txt_record_test.go b/azurerm/resource_arm_dns_txt_record_test.go index 5c6761ebc65d8..f97dcb26f5bb6 100644 --- a/azurerm/resource_arm_dns_txt_record_test.go +++ b/azurerm/resource_arm_dns_txt_record_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -151,7 +151,7 @@ func testCheckAzureRMDnsTxtRecordDestroy(s *terraform.State) error { func testAccAzureRMDnsTxtRecord_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -180,7 +180,7 @@ resource "azurerm_dns_txt_record" "test" { func testAccAzureRMDnsTxtRecord_updateRecords(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -213,7 +213,7 @@ resource "azurerm_dns_txt_record" "test" { func testAccAzureRMDnsTxtRecord_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -247,7 +247,7 @@ resource "azurerm_dns_txt_record" "test" { func testAccAzureRMDnsTxtRecord_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_dns_zone.go b/azurerm/resource_arm_dns_zone.go index 524ae4b4f4692..c0d4bc011b559 100644 --- a/azurerm/resource_arm_dns_zone.go +++ b/azurerm/resource_arm_dns_zone.go @@ -3,17 +3,18 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) func resourceArmDnsZone() *schema.Resource { return &schema.Resource{ - Create: resourceArmDnsZoneCreate, + Create: resourceArmDnsZoneCreateUpdate, Read: resourceArmDnsZoneRead, - Update: resourceArmDnsZoneCreate, + Update: resourceArmDnsZoneCreateUpdate, Delete: resourceArmDnsZoneDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -45,24 +46,54 @@ func resourceArmDnsZone() *schema.Resource { Set: schema.HashString, }, + "zone_type": { + Type: schema.TypeString, + Default: string(dns.Public), + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(dns.Private), + string(dns.Public), + }, false), + }, + + "registration_virtual_network_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "resolution_virtual_network_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "tags": tagsSchema(), }, } } -func resourceArmDnsZoneCreate(d *schema.ResourceData, meta interface{}) error { +func resourceArmDnsZoneCreateUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).zonesClient ctx := meta.(*ArmClient).StopContext name := d.Get("name").(string) resGroup := d.Get("resource_group_name").(string) location := "global" - + zoneType := d.Get("zone_type").(string) tags := d.Get("tags").(map[string]interface{}) + registrationVirtualNetworkIds := expandDnsZoneRegistrationVirtualNetworkIds(d) + resolutionVirtualNetworkIds := expandDnsZoneResolutionVirtualNetworkIds(d) + parameters := dns.Zone{ Location: &location, Tags: expandTags(tags), + ZoneProperties: &dns.ZoneProperties{ + ZoneType: dns.ZoneType(zoneType), + RegistrationVirtualNetworks: registrationVirtualNetworkIds, + ResolutionVirtualNetworks: resolutionVirtualNetworkIds, + }, } etag := "" @@ -106,11 +137,19 @@ func resourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error { d.Set("resource_group_name", resGroup) d.Set("number_of_record_sets", resp.NumberOfRecordSets) d.Set("max_number_of_record_sets", resp.MaxNumberOfRecordSets) + d.Set("zone_type", resp.ZoneType) - nameServers := make([]string, 0, len(*resp.NameServers)) - for _, ns := range *resp.NameServers { - nameServers = append(nameServers, ns) + registrationVirtualNetworks := flattenDnsZoneRegistrationVirtualNetworkIDs(resp.RegistrationVirtualNetworks) + if err := d.Set("registration_virtual_network_ids", registrationVirtualNetworks); err != nil { + return err + } + + resolutionVirtualNetworks := flattenDnsZoneResolutionVirtualNetworkIDs(resp.ResolutionVirtualNetworks) + if err := d.Set("resolution_virtual_network_ids", resolutionVirtualNetworks); err != nil { + return err } + + nameServers := flattenDnsZoneNameservers(resp.NameServers) if err := d.Set("name_servers", nameServers); err != nil { return err } @@ -151,3 +190,67 @@ func resourceArmDnsZoneDelete(d *schema.ResourceData, meta interface{}) error { return nil } + +func expandDnsZoneResolutionVirtualNetworkIds(d *schema.ResourceData) *[]dns.SubResource { + resolutionVirtualNetworks := d.Get("resolution_virtual_network_ids").([]interface{}) + + resolutionVNetSubResources := make([]dns.SubResource, 0, len(resolutionVirtualNetworks)) + for _, rvn := range resolutionVirtualNetworks { + id := rvn.(string) + resolutionVNetSubResources = append(resolutionVNetSubResources, dns.SubResource{ + ID: &id, + }) + } + + return &resolutionVNetSubResources +} + +func flattenDnsZoneRegistrationVirtualNetworkIDs(input *[]dns.SubResource) []string { + registrationVirtualNetworks := make([]string, 0) + + if input != nil { + for _, rvn := range *input { + registrationVirtualNetworks = append(registrationVirtualNetworks, *rvn.ID) + } + } + + return registrationVirtualNetworks +} + +func expandDnsZoneRegistrationVirtualNetworkIds(d *schema.ResourceData) *[]dns.SubResource { + registrationVirtualNetworks := d.Get("registration_virtual_network_ids").([]interface{}) + + registrationVNetSubResources := make([]dns.SubResource, 0) + for _, rvn := range registrationVirtualNetworks { + id := rvn.(string) + registrationVNetSubResources = append(registrationVNetSubResources, dns.SubResource{ + ID: &id, + }) + } + + return ®istrationVNetSubResources +} + +func flattenDnsZoneResolutionVirtualNetworkIDs(input *[]dns.SubResource) []string { + resolutionVirtualNetworks := make([]string, 0) + + if input != nil { + for _, rvn := range *input { + resolutionVirtualNetworks = append(resolutionVirtualNetworks, *rvn.ID) + } + } + + return resolutionVirtualNetworks +} + +func flattenDnsZoneNameservers(input *[]string) []string { + nameServers := make([]string, 0) + + if input != nil { + for _, ns := range *input { + nameServers = append(nameServers, ns) + } + } + + return nameServers +} diff --git a/azurerm/resource_arm_dns_zone_test.go b/azurerm/resource_arm_dns_zone_test.go index 70ae3161cfc75..60322b7fefb74 100644 --- a/azurerm/resource_arm_dns_zone_test.go +++ b/azurerm/resource_arm_dns_zone_test.go @@ -30,6 +30,26 @@ func TestAccAzureRMDnsZone_basic(t *testing.T) { }) } +func TestAccAzureRMDnsZone_withVNets(t *testing.T) { + resourceName := "azurerm_dns_zone.test" + ri := acctest.RandInt() + config := testAccAzureRMDnsZone_withVNets(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsZoneDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDnsZoneExists(resourceName), + ), + }, + }, + }) +} + func TestAccAzureRMDnsZone_withTags(t *testing.T) { resourceName := "azurerm_dns_zone.test" ri := acctest.RandInt() @@ -119,31 +139,55 @@ func testCheckAzureRMDnsZoneDestroy(s *terraform.State) error { func testAccAzureRMDnsZone_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" - location = "%s" + name = "acctestRG-%d" + location = "%s" } resource "azurerm_dns_zone" "test" { - name = "acctestzone%d.com" - resource_group_name = "${azurerm_resource_group.test.name}" + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" } `, rInt, location, rInt) } +func testAccAzureRMDnsZone_withVNets(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG_%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestvnet%d" + location = "%s" + resource_group_name = "${azurerm_resource_group.test.name}" + address_space = ["10.0.0.0/16"] + dns_servers = ["168.63.129.16"] +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_type = "Private" + registration_virtual_network_ids = ["${azurerm_virtual_network.test.id}"] +} +`, rInt, location, rInt, location, rInt) +} + func testAccAzureRMDnsZone_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" - location = "%s" + name = "acctestRG-%d" + location = "%s" } resource "azurerm_dns_zone" "test" { - name = "acctestzone%d.com" - resource_group_name = "${azurerm_resource_group.test.name}" - tags { - environment = "Production" - cost_center = "MSFT" - } + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" + tags { + environment = "Production" + cost_center = "MSFT" + } } `, rInt, location, rInt) } @@ -151,16 +195,16 @@ resource "azurerm_dns_zone" "test" { func testAccAzureRMDnsZone_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_dns_zone" "test" { - name = "acctestzone%d.com" - resource_group_name = "${azurerm_resource_group.test.name}" - tags { - environment = "staging" - } + name = "acctestzone%d.com" + resource_group_name = "${azurerm_resource_group.test.name}" + tags { + environment = "staging" + } } `, rInt, location, rInt) } diff --git a/azurerm/resource_arm_eventgrid_topic.go b/azurerm/resource_arm_eventgrid_topic.go index 6af3e90cb9089..d037094cc0a57 100644 --- a/azurerm/resource_arm_eventgrid_topic.go +++ b/azurerm/resource_arm_eventgrid_topic.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid" + "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_eventhub_consumer_group_test.go b/azurerm/resource_arm_eventhub_consumer_group_test.go index 7dc58a3be7848..4d7bd62a0d79f 100644 --- a/azurerm/resource_arm_eventhub_consumer_group_test.go +++ b/azurerm/resource_arm_eventhub_consumer_group_test.go @@ -50,6 +50,34 @@ func TestAccAzureRMEventHubConsumerGroup_complete(t *testing.T) { }) } +func TestAccAzureRMEventHubConsumerGroup_userMetadataUpdate(t *testing.T) { + resourceName := "azurerm_eventhub_consumer_group.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMEventHubConsumerGroup_basic(ri, testLocation()) + postConfig := testAccAzureRMEventHubConsumerGroup_complete(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventHubConsumerGroupDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubConsumerGroupExists(resourceName), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubConsumerGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "user_metadata", "some-meta-data"), + ), + }, + }, + }) +} + func testCheckAzureRMEventHubConsumerGroupDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*ArmClient).eventHubConsumerGroupClient ctx := testAccProvider.Meta().(*ArmClient).StopContext diff --git a/azurerm/resource_arm_eventhub_namespace_test.go b/azurerm/resource_arm_eventhub_namespace_test.go index 30f0df8d96a9a..978ef5e5a9b7a 100644 --- a/azurerm/resource_arm_eventhub_namespace_test.go +++ b/azurerm/resource_arm_eventhub_namespace_test.go @@ -118,6 +118,147 @@ func TestAccAzureRMEventHubNamespace_NonStandardCasing(t *testing.T) { }) } +func TestAccAzureRMEventHubNamespace_BasicWithTagsUpdate(t *testing.T) { + resourceName := "azurerm_eventhub_namespace.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMEventHubNamespace_basic(ri, testLocation()) + postConfig := testAccAzureRMEventHubNamespace_basicWithTagsUpdate(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventHubNamespaceDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + ), + }, + }, + }) +} + +func TestAccAzureRMEventHubNamespace_BasicWithCapacity(t *testing.T) { + resourceName := "azurerm_eventhub_namespace.test" + ri := acctest.RandInt() + config := testAccAzureRMEventHubNamespace_capacity(ri, testLocation(), 20) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventHubNamespaceDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "capacity", "20"), + ), + }, + }, + }) +} + +func TestAccAzureRMEventHubNamespace_BasicWithCapacityUpdate(t *testing.T) { + resourceName := "azurerm_eventhub_namespace.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMEventHubNamespace_capacity(ri, testLocation(), 20) + postConfig := testAccAzureRMEventHubNamespace_capacity(ri, testLocation(), 2) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventHubNamespaceDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "capacity", "20"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "capacity", "2"), + ), + }, + }, + }) +} + +func TestAccAzureRMEventHubNamespace_BasicWithSkuUpdate(t *testing.T) { + resourceName := "azurerm_eventhub_namespace.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMEventHubNamespace_basic(ri, testLocation()) + postConfig := testAccAzureRMEventHubNamespace_standard(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventHubNamespaceDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Basic"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard"), + resource.TestCheckResourceAttr(resourceName, "capacity", "2"), + ), + }, + }, + }) +} + +func TestAccAzureRMEventHubNamespace_maximumThroughputUnitsUpdate(t *testing.T) { + resourceName := "azurerm_eventhub_namespace.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMEventHubNamespace_maximumThroughputUnits(ri, testLocation()) + postConfig := testAccAzureRMEventHubNamespace_maximumThroughputUnitsUpdate(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventHubNamespaceDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard"), + resource.TestCheckResourceAttr(resourceName, "capacity", "2"), + resource.TestCheckResourceAttr(resourceName, "maximum_throughput_units", "20"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubNamespaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard"), + resource.TestCheckResourceAttr(resourceName, "capacity", "1"), + resource.TestCheckResourceAttr(resourceName, "maximum_throughput_units", "1"), + ), + }, + }, + }) +} + func testCheckAzureRMEventHubNamespaceDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*ArmClient).eventHubNamespacesClient ctx := testAccProvider.Meta().(*ArmClient).StopContext @@ -241,3 +382,60 @@ resource "azurerm_eventhub_namespace" "test" { } `, rInt, location, rInt) } + +func testAccAzureRMEventHubNamespace_basicWithTagsUpdate(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_eventhub_namespace" "test" { + name = "acctesteventhubnamespace-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Basic" + tags { + environment = "Production" + } +} +`, rInt, location, rInt) +} + +func testAccAzureRMEventHubNamespace_capacity(rInt int, location string, capacity int) string { + return fmt.Sprintf(` + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_eventhub_namespace" "test" { + name = "acctesteventhubnamespace-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Basic" + capacity = %d +} +`, rInt, location, rInt, capacity) +} + +func testAccAzureRMEventHubNamespace_maximumThroughputUnitsUpdate(rInt int, location string) string { + return fmt.Sprintf(` + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_eventhub_namespace" "test" { + name = "acctesteventhubnamespace-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Standard" + capacity = 1 + auto_inflate_enabled = true + maximum_throughput_units = 1 +} +`, rInt, location, rInt) +} diff --git a/azurerm/resource_arm_eventhub_test.go b/azurerm/resource_arm_eventhub_test.go index c488305f80df5..b224e06689cc5 100644 --- a/azurerm/resource_arm_eventhub_test.go +++ b/azurerm/resource_arm_eventhub_test.go @@ -258,6 +258,35 @@ func TestAccAzureRMEventHub_captureDescriptionDisabled(t *testing.T) { }) } +func TestAccAzureRMEventHub_messageRetentionUpdate(t *testing.T) { + resourceName := "azurerm_eventhub.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMEventHub_standard(ri, testLocation()) + postConfig := testAccAzureRMEventHub_messageRetentionUpdate(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventHubDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "message_retention", "7"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventHubExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "message_retention", "5"), + ), + }, + }, + }) +} + func testCheckAzureRMEventHubDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*ArmClient).eventHubClient ctx := testAccProvider.Meta().(*ArmClient).StopContext @@ -368,7 +397,7 @@ func testAccAzureRMEventHub_captureDescription(rInt int, rString string, locatio enabledString := strconv.FormatBool(enabled) return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -417,3 +446,27 @@ resource "azurerm_eventhub" "test" { } `, rInt, location, rString, rInt, rInt, enabledString) } + +func testAccAzureRMEventHub_messageRetentionUpdate(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_eventhub_namespace" "test" { + name = "acctesteventhubnamespace-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "Standard" +} + +resource "azurerm_eventhub" "test" { + name = "acctesteventhub-%d" + namespace_name = "${azurerm_eventhub_namespace.test.name}" + resource_group_name = "${azurerm_resource_group.test.name}" + partition_count = 2 + message_retention = 5 +} +`, rInt, location, rInt, rInt) +} diff --git a/azurerm/resource_arm_express_route_circuit.go b/azurerm/resource_arm_express_route_circuit.go index d3393a8938202..cfacbc218fee2 100644 --- a/azurerm/resource_arm_express_route_circuit.go +++ b/azurerm/resource_arm_express_route_circuit.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" ) diff --git a/azurerm/resource_arm_express_route_circuit_authorization.go b/azurerm/resource_arm_express_route_circuit_authorization.go index fe2a18be81a7c..bb057d6496af9 100644 --- a/azurerm/resource_arm_express_route_circuit_authorization.go +++ b/azurerm/resource_arm_express_route_circuit_authorization.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_express_route_circuit_authorization_test.go b/azurerm/resource_arm_express_route_circuit_authorization_test.go index ad4b67500bc94..65e52e1801467 100644 --- a/azurerm/resource_arm_express_route_circuit_authorization_test.go +++ b/azurerm/resource_arm_express_route_circuit_authorization_test.go @@ -114,7 +114,7 @@ func testCheckAzureRMExpressRouteCircuitAuthorizationDestroy(s *terraform.State) func testAccAzureRMExpressRouteCircuitAuthorization_basicConfig(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -150,7 +150,7 @@ resource "azurerm_express_route_circuit_authorization" "test" { func testAccAzureRMExpressRouteCircuitAuthorization_multipleConfig(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_express_route_circuit_peering.go b/azurerm/resource_arm_express_route_circuit_peering.go index 8ea9fc051a4ae..4252282e05178 100644 --- a/azurerm/resource_arm_express_route_circuit_peering.go +++ b/azurerm/resource_arm_express_route_circuit_peering.go @@ -5,7 +5,7 @@ import ( "log" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" @@ -121,12 +121,12 @@ func resourceArmExpressRouteCircuitPeeringCreateUpdate(d *schema.ResourceData, m parameters := network.ExpressRouteCircuitPeering{ ExpressRouteCircuitPeeringPropertiesFormat: &network.ExpressRouteCircuitPeeringPropertiesFormat{ - PeeringType: network.ExpressRouteCircuitPeeringType(peeringType), + PeeringType: network.ExpressRoutePeeringType(peeringType), SharedKey: utils.String(sharedKey), PrimaryPeerAddressPrefix: utils.String(primaryPeerAddressPrefix), SecondaryPeerAddressPrefix: utils.String(secondaryPeerAddressPrefix), AzureASN: utils.Int32(int32(azureASN)), - PeerASN: utils.Int32(int32(peerASN)), + PeerASN: utils.Int64(int64(peerASN)), VlanID: utils.Int32(int32(vlanId)), }, } diff --git a/azurerm/resource_arm_express_route_circuit_peering_test.go b/azurerm/resource_arm_express_route_circuit_peering_test.go index 662993da4e4d7..9e22566a65084 100644 --- a/azurerm/resource_arm_express_route_circuit_peering_test.go +++ b/azurerm/resource_arm_express_route_circuit_peering_test.go @@ -115,7 +115,7 @@ func testCheckAzureRMExpressRouteCircuitPeeringDestroy(s *terraform.State) error func testAccAzureRMExpressRouteCircuitPeering_privatePeering(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -154,7 +154,7 @@ resource "azurerm_express_route_circuit_peering" "test" { func testAccAzureRMExpressRouteCircuitPeering_msPeering(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_express_route_circuit_test.go b/azurerm/resource_arm_express_route_circuit_test.go index 0b5bcafa84eb8..746f166bd6907 100644 --- a/azurerm/resource_arm_express_route_circuit_test.go +++ b/azurerm/resource_arm_express_route_circuit_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -17,9 +17,13 @@ func TestAccAzureRMExpressRouteCircuit(t *testing.T) { // Azure only being happy about provisioning a couple at a time testCases := map[string]map[string]func(t *testing.T){ "basic": { - "metered": testAccAzureRMExpressRouteCircuit_basicMetered, - "unlimited": testAccAzureRMExpressRouteCircuit_basicUnlimited, - "update": testAccAzureRMExpressRouteCircuit_update, + "metered": testAccAzureRMExpressRouteCircuit_basicMetered, + "unlimited": testAccAzureRMExpressRouteCircuit_basicUnlimited, + "update": testAccAzureRMExpressRouteCircuit_update, + "tierUpdate": testAccAzureRMExpressRouteCircuit_tierUpdate, + "premiumMetered": testAccAzureRMExpressRouteCircuit_premiumMetered, + "premiumUnlimited": testAccAzureRMExpressRouteCircuit_premiumUnlimited, + "allowClassicOperationsUpdate": testAccAzureRMExpressRouteCircuit_allowClassicOperationsUpdate, }, "PrivatePeering": { "azurePrivatePeering": testAccAzureRMExpressRouteCircuitPeering_azurePrivatePeering, @@ -122,6 +126,106 @@ func testAccAzureRMExpressRouteCircuit_update(t *testing.T) { }) } +func testAccAzureRMExpressRouteCircuit_tierUpdate(t *testing.T) { + resourceName := "azurerm_express_route_circuit.test" + var erc network.ExpressRouteCircuit + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMExpressRouteCircuitDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMExpressRouteCircuit_sku(ri, testLocation(), "Standard", "MeteredData"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMExpressRouteCircuitExists("azurerm_express_route_circuit.test", &erc), + resource.TestCheckResourceAttr(resourceName, "sku.0.tier", "Standard"), + ), + }, + { + Config: testAccAzureRMExpressRouteCircuit_sku(ri, testLocation(), "Premium", "MeteredData"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMExpressRouteCircuitExists("azurerm_express_route_circuit.test", &erc), + resource.TestCheckResourceAttr(resourceName, "sku.0.tier", "Premium"), + ), + }, + }, + }) +} + +func testAccAzureRMExpressRouteCircuit_premiumMetered(t *testing.T) { + resourceName := "azurerm_express_route_circuit.test" + var erc network.ExpressRouteCircuit + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMExpressRouteCircuitDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMExpressRouteCircuit_sku(ri, testLocation(), "Premium", "MeteredData"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMExpressRouteCircuitExists("azurerm_express_route_circuit.test", &erc), + resource.TestCheckResourceAttr(resourceName, "sku.0.tier", "Premium"), + resource.TestCheckResourceAttr(resourceName, "sku.0.family", "MeteredData"), + ), + }, + }, + }) +} + +func testAccAzureRMExpressRouteCircuit_premiumUnlimited(t *testing.T) { + resourceName := "azurerm_express_route_circuit.test" + var erc network.ExpressRouteCircuit + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMExpressRouteCircuitDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMExpressRouteCircuit_sku(ri, testLocation(), "Premium", "UnlimitedData"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMExpressRouteCircuitExists("azurerm_express_route_circuit.test", &erc), + resource.TestCheckResourceAttr(resourceName, "sku.0.tier", "Premium"), + resource.TestCheckResourceAttr(resourceName, "sku.0.family", "UnlimitedData"), + ), + }, + }, + }) +} + +func testAccAzureRMExpressRouteCircuit_allowClassicOperationsUpdate(t *testing.T) { + resourceName := "azurerm_express_route_circuit.test" + var erc network.ExpressRouteCircuit + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMExpressRouteCircuitDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMExpressRouteCircuit_allowClassicOperations(ri, testLocation(), "false"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMExpressRouteCircuitExists("azurerm_express_route_circuit.test", &erc), + resource.TestCheckResourceAttr(resourceName, "allow_classic_operations", "false"), + ), + }, + { + Config: testAccAzureRMExpressRouteCircuit_allowClassicOperations(ri, testLocation(), "true"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMExpressRouteCircuitExists("azurerm_express_route_circuit.test", &erc), + resource.TestCheckResourceAttr(resourceName, "allow_classic_operations", "true"), + ), + }, + }, + }) +} + func testCheckAzureRMExpressRouteCircuitExists(name string, erc *network.ExpressRouteCircuit) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -182,7 +286,7 @@ func testCheckAzureRMExpressRouteCircuitDestroy(s *terraform.State) error { func testAccAzureRMExpressRouteCircuit_basicMeteredConfig(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -208,10 +312,11 @@ resource "azurerm_express_route_circuit" "test" { } `, rInt, location, rInt) } + func testAccAzureRMExpressRouteCircuit_basicUnlimitedConfig(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -237,3 +342,63 @@ resource "azurerm_express_route_circuit" "test" { } `, rInt, location, rInt) } + +func testAccAzureRMExpressRouteCircuit_sku(rInt int, location string, tier string, family string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestrg-%d" + location = "%s" +} + +resource "azurerm_express_route_circuit" "test" { + name = "acctest-erc-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + service_provider_name = "Equinix" + peering_location = "Silicon Valley" + bandwidth_in_mbps = 50 + + sku { + tier = "%s" + family = "%s" + } + + allow_classic_operations = false + + tags { + Environment = "production" + Purpose = "AcceptanceTests" + } +} +`, rInt, location, rInt, tier, family) +} + +func testAccAzureRMExpressRouteCircuit_allowClassicOperations(rInt int, location string, allowClassicOperations string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestrg-%d" + location = "%s" +} + +resource "azurerm_express_route_circuit" "test" { + name = "acctest-erc-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + service_provider_name = "Equinix" + peering_location = "Silicon Valley" + bandwidth_in_mbps = 50 + + sku { + tier = "Standard" + family = "MeteredData" + } + + allow_classic_operations = %s + + tags { + Environment = "production" + Purpose = "AcceptanceTests" + } +} +`, rInt, location, rInt, allowClassicOperations) +} diff --git a/azurerm/resource_arm_function_app.go b/azurerm/resource_arm_function_app.go index 8a3c3eb1113d8..68471cb57f84e 100644 --- a/azurerm/resource_arm_function_app.go +++ b/azurerm/resource_arm_function_app.go @@ -105,6 +105,33 @@ func resourceArmFunctionApp() *schema.Resource { }, }, + "identity": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: validation.StringInSlice([]string{ + string(web.SystemAssigned), + }, true), + }, + "principal_id": { + Type: schema.TypeString, + Computed: true, + }, + "tenant_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "tags": tagsSchema(), "default_hostname": { @@ -204,6 +231,12 @@ func resourceArmFunctionAppCreate(d *schema.ResourceData, meta interface{}) erro }, } + if v, ok := d.GetOk("identity.0.type"); ok { + siteEnvelope.Identity = &web.ManagedServiceIdentity{ + Type: web.ManagedServiceIdentityType(v.(string)), + } + } + createFuture, err := client.CreateOrUpdate(ctx, resGroup, name, siteEnvelope) if err != nil { return err @@ -263,6 +296,12 @@ func resourceArmFunctionAppUpdate(d *schema.ResourceData, meta interface{}) erro }, } + if v, ok := d.GetOk("identity.0.type"); ok { + siteEnvelope.Identity = &web.ManagedServiceIdentity{ + Type: web.ManagedServiceIdentityType(v.(string)), + } + } + future, err := client.CreateOrUpdate(ctx, resGroup, name, siteEnvelope) if err != nil { return err @@ -357,6 +396,10 @@ func resourceArmFunctionAppRead(d *schema.ResourceData, meta interface{}) error d.Set("client_affinity_enabled", props.ClientAffinityEnabled) } + if err := d.Set("identity", flattenFunctionAppIdentity(resp.Identity)); err != nil { + return err + } + appSettings := flattenAppServiceAppSettings(appSettingsResp.Properties) d.Set("storage_connection_string", appSettings["AzureWebJobsStorage"]) @@ -529,3 +572,21 @@ func flattenFunctionAppConnectionStrings(input map[string]*web.ConnStringValueTy return results } + +func flattenFunctionAppIdentity(identity *web.ManagedServiceIdentity) interface{} { + if identity == nil { + return make([]interface{}, 0) + } + + result := make(map[string]interface{}) + result["type"] = string(identity.Type) + + if identity.PrincipalID != nil { + result["principal_id"] = *identity.PrincipalID + } + if identity.TenantID != nil { + result["tenant_id"] = *identity.TenantID + } + + return []interface{}{result} +} diff --git a/azurerm/resource_arm_function_app_test.go b/azurerm/resource_arm_function_app_test.go index b81f71fb371cd..ed7c395b6101a 100644 --- a/azurerm/resource_arm_function_app_test.go +++ b/azurerm/resource_arm_function_app_test.go @@ -2,6 +2,7 @@ package azurerm import ( "fmt" + "regexp" "strings" "testing" @@ -334,6 +335,69 @@ func TestAccAzureRMFunctionApp_consumptionPlan(t *testing.T) { }) } +func TestAccAzureRMFunctionApp_createIdentity(t *testing.T) { + resourceName := "azurerm_function_app.test" + ri := acctest.RandInt() + rs := strings.ToLower(acctest.RandString(11)) + config := testAccAzureRMFunctionApp_basicIdentity(ri, rs, testLocation()) + + uuidMatch := regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMFunctionAppDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMFunctionAppExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.#", "1"), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", uuidMatch), + resource.TestMatchResourceAttr(resourceName, "identity.0.tenant_id", uuidMatch), + ), + }, + }, + }) +} + +func TestAccAzureRMFunctionApp_updateIdentity(t *testing.T) { + resourceName := "azurerm_function_app.test" + ri := acctest.RandInt() + rs := strings.ToLower(acctest.RandString(11)) + + preConfig := testAccAzureRMFunctionApp_basic(ri, rs, testLocation()) + postConfig := testAccAzureRMFunctionApp_basicIdentity(ri, rs, testLocation()) + + uuidMatch := regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMFunctionAppDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.#", "0"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMFunctionAppExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.#", "1"), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", uuidMatch), + resource.TestMatchResourceAttr(resourceName, "identity.0.tenant_id", uuidMatch), + ), + }, + }, + }) +} + func testCheckAzureRMFunctionAppDestroy(s *terraform.State) error { client := testAccProvider.Meta().(*ArmClient).appServicesClient @@ -850,3 +914,41 @@ resource "azurerm_function_app" "test" { } `, rInt, location, rString, rInt, rInt) } + +func testAccAzureRMFunctionApp_basicIdentity(rInt int, storage string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_storage_account" "test" { + name = "acctestsa%[3]s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_app_service_plan" "test" { + name = "acctestASP-%[1]d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku { + tier = "Standard" + size = "S1" + } +} + +resource "azurerm_function_app" "test" { + name = "acctest-%[1]d-func" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" + storage_connection_string = "${azurerm_storage_account.test.primary_connection_string}" + + identity { + type = "SystemAssigned" + } +}`, rInt, location, storage) +} diff --git a/azurerm/resource_arm_image.go b/azurerm/resource_arm_image.go index 7f6c8dc33ca74..b0c4a9d731ec5 100644 --- a/azurerm/resource_arm_image.go +++ b/azurerm/resource_arm_image.go @@ -5,8 +5,11 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" + "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -32,66 +35,71 @@ func resourceArmImage() *schema.Resource { "resource_group_name": resourceGroupNameSchema(), "source_virtual_machine_id": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, }, "os_disk": { - Type: schema.TypeSet, + Type: schema.TypeList, Optional: true, MaxItems: 1, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "os_type": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ string(compute.Linux), string(compute.Windows), }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, "os_state": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ string(compute.Generalized), string(compute.Specialized), }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, "managed_disk_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, + Type: schema.TypeString, + Computed: true, + Optional: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: azure.ValidateResourceID, }, "blob_uri": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validate.URLIsHTTPOrHTTPS, }, "caching": { - Type: schema.TypeString, - Optional: true, - Default: string(compute.None), + Type: schema.TypeString, + Optional: true, + Default: string(compute.None), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ string(compute.CachingTypesNone), string(compute.CachingTypesReadOnly), string(compute.CachingTypesReadWrite), }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, "size_gb": { - Type: schema.TypeInt, - Computed: true, - Optional: true, + Type: schema.TypeInt, + Computed: true, + Optional: true, + ValidateFunc: validation.NoZeroValues, }, }, }, @@ -109,15 +117,17 @@ func resourceArmImage() *schema.Resource { }, "managed_disk_id": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, }, "blob_uri": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.URLIsHTTPOrHTTPS, }, "caching": { @@ -133,9 +143,10 @@ func resourceArmImage() *schema.Resource { }, "size_gb": { - Type: schema.TypeInt, - Optional: true, - Computed: true, + Type: schema.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.NoZeroValues, }, }, }, @@ -155,8 +166,8 @@ func resourceArmImageCreateUpdate(d *schema.ResourceData, meta interface{}) erro name := d.Get("name").(string) location := azureRMNormalizeLocation(d.Get("location").(string)) resGroup := d.Get("resource_group_name").(string) - tags := d.Get("tags").(map[string]interface{}) - expandedTags := expandTags(tags) + expandedTags := expandTags(d.Get("tags").(map[string]interface{})) + properties := compute.ImageProperties{} osDisk, err := expandAzureRmImageOsDisk(d) @@ -349,7 +360,7 @@ func flattenAzureRmImageDataDisks(diskImages *[]compute.ImageDataDisk) []interfa func expandAzureRmImageOsDisk(d *schema.ResourceData) (*compute.ImageOSDisk, error) { osDisk := &compute.ImageOSDisk{} - disks := d.Get("os_disk").(*schema.Set).List() + disks := d.Get("os_disk").([]interface{}) if len(disks) > 0 { config := disks[0].(map[string]interface{}) diff --git a/azurerm/resource_arm_key_vault.go b/azurerm/resource_arm_key_vault.go index 2a30b0b92069b..ef9e1b3a88191 100644 --- a/azurerm/resource_arm_key_vault.go +++ b/azurerm/resource_arm_key_vault.go @@ -3,12 +3,11 @@ package azurerm import ( "fmt" "log" - "net" + "net/http" "regexp" "time" "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault" - "github.com/hashicorp/go-getter/helper/url" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -445,21 +444,22 @@ func validateKeyVaultName(v interface{}, k string) (ws []string, errors []error) func keyVaultRefreshFunc(vaultUri string) resource.StateRefreshFunc { return func() (interface{}, string, error) { log.Printf("[DEBUG] Checking to see if KeyVault %q is available..", vaultUri) - uri, err := url.Parse(vaultUri) - if err != nil { - return nil, "error", fmt.Errorf("Error parsing URI %q: %s", vaultUri, err) + + var PTransport = &http.Transport{Proxy: http.ProxyFromEnvironment} + + client := &http.Client{ + Transport: PTransport, } - hostAndPort := fmt.Sprintf("%s:443", uri.Host) - conn, err := net.Dial("tcp", hostAndPort) + conn, err := client.Get(vaultUri) if err != nil { - log.Printf("[DEBUG] Didn't find KeyVault at %q", hostAndPort) - return nil, "pending", fmt.Errorf("Error connecting to %q: %s", hostAndPort, err) + log.Printf("[DEBUG] Didn't find KeyVault at %q", vaultUri) + return nil, "pending", fmt.Errorf("Error connecting to %q: %s", vaultUri, err) } - _ = conn.Close() + defer conn.Body.Close() - log.Printf("[DEBUG] Found KeyVault at %q", hostAndPort) + log.Printf("[DEBUG] Found KeyVault at %q", vaultUri) return "available", "available", nil } } diff --git a/azurerm/resource_arm_key_vault_certificate_test.go b/azurerm/resource_arm_key_vault_certificate_test.go index 0e67f14436a97..bc5d31e439356 100644 --- a/azurerm/resource_arm_key_vault_certificate_test.go +++ b/azurerm/resource_arm_key_vault_certificate_test.go @@ -134,7 +134,7 @@ func testAccAzureRMKeyVaultCertificate_basicImportPFX(rString string, location s data "azurerm_client_config" "current" {} resource "azurerm_resource_group" "test" { - name = "acctestrg-%s" + name = "acctestRG-%s" location = "%s" } @@ -202,7 +202,7 @@ func testAccAzureRMKeyVaultCertificate_basicGenerate(rString string, location st data "azurerm_client_config" "current" {} resource "azurerm_resource_group" "test" { - name = "acctestrg-%s" + name = "acctestRG-%s" location = "%s" } @@ -290,7 +290,7 @@ func testAccAzureRMKeyVaultCertificate_basicGenerateTags(rString string, locatio data "azurerm_client_config" "current" {} resource "azurerm_resource_group" "test" { - name = "acctestrg-%s" + name = "acctestRG-%s" location = "%s" } diff --git a/azurerm/resource_arm_kubernetes_cluster.go b/azurerm/resource_arm_kubernetes_cluster.go index 555ba2aaa3e76..7221e08bc7a9c 100644 --- a/azurerm/resource_arm_kubernetes_cluster.go +++ b/azurerm/resource_arm_kubernetes_cluster.go @@ -6,7 +6,7 @@ import ( "log" "regexp" - "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2017-09-30/containerservice" + "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2018-03-31/containerservice" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -37,8 +37,7 @@ func resourceArmKubernetesCluster() *schema.Resource { "dns_prefix": { Type: schema.TypeString, - Optional: true, - Computed: true, + Required: true, }, "fqdn": { @@ -293,7 +292,7 @@ func resourceArmKubernetesClusterRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error making Read request on AKS Managed Cluster %q (resource group %q): %+v", name, resGroup, err) } - profile, err := kubernetesClustersClient.GetAccessProfiles(ctx, resGroup, name, "clusterUser") + profile, err := kubernetesClustersClient.GetAccessProfile(ctx, resGroup, name, "clusterUser") if err != nil { return fmt.Errorf("Error getting access profile while making Read request on AKS Managed Cluster %q (resource group %q): %+v", name, resGroup, err) } @@ -383,7 +382,7 @@ func flattenAzureRmKubernetesClusterLinuxProfile(input *containerservice.LinuxPr return []interface{}{values} } -func flattenAzureRmKubernetesClusterAgentPoolProfiles(profiles *[]containerservice.AgentPoolProfile, fqdn *string) []interface{} { +func flattenAzureRmKubernetesClusterAgentPoolProfiles(profiles *[]containerservice.ManagedClusterAgentPoolProfile, fqdn *string) []interface{} { agentPoolProfiles := make([]interface{}, 0) for _, profile := range *profiles { @@ -535,10 +534,10 @@ func expandAzureRmKubernetesClusterServicePrincipal(d *schema.ResourceData) *con return &principal } -func expandAzureRmKubernetesClusterAgentProfiles(d *schema.ResourceData) []containerservice.AgentPoolProfile { +func expandAzureRmKubernetesClusterAgentProfiles(d *schema.ResourceData) []containerservice.ManagedClusterAgentPoolProfile { configs := d.Get("agent_pool_profile").([]interface{}) config := configs[0].(map[string]interface{}) - profiles := make([]containerservice.AgentPoolProfile, 0, len(configs)) + profiles := make([]containerservice.ManagedClusterAgentPoolProfile, 0, len(configs)) name := config["name"].(string) count := int32(config["count"].(int)) @@ -547,7 +546,7 @@ func expandAzureRmKubernetesClusterAgentProfiles(d *schema.ResourceData) []conta osDiskSizeGB := int32(config["os_disk_size_gb"].(int)) osType := config["os_type"].(string) - profile := containerservice.AgentPoolProfile{ + profile := containerservice.ManagedClusterAgentPoolProfile{ Name: utils.String(name), Count: utils.Int32(count), VMSize: containerservice.VMSizeTypes(vmSize), diff --git a/azurerm/resource_arm_kubernetes_cluster_test.go b/azurerm/resource_arm_kubernetes_cluster_test.go index a5b154e1f8db7..2d3d47df96c7e 100644 --- a/azurerm/resource_arm_kubernetes_cluster_test.go +++ b/azurerm/resource_arm_kubernetes_cluster_test.go @@ -255,7 +255,7 @@ resource "azurerm_resource_group" "test" { resource "azurerm_virtual_network" "test" { name = "acctestvirtnet%d" - address_space = ["10.0.0.0/16"] + address_space = ["172.0.0.0/16"] location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -268,7 +268,7 @@ resource "azurerm_subnet" "test" { name = "acctestsubnet%d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" - address_prefix = "10.0.2.0/24" + address_prefix = "172.0.2.0/24" } resource "azurerm_kubernetes_cluster" "test" { diff --git a/azurerm/resource_arm_loadbalancer.go b/azurerm/resource_arm_loadbalancer.go index 5cd9ad35d1ec4..9c2ecd016cf6c 100644 --- a/azurerm/resource_arm_loadbalancer.go +++ b/azurerm/resource_arm_loadbalancer.go @@ -5,20 +5,24 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) func resourceArmLoadBalancer() *schema.Resource { return &schema.Resource{ Create: resourceArmLoadBalancerCreate, - Read: resourecArmLoadBalancerRead, + Read: resourceArmLoadBalancerRead, Update: resourceArmLoadBalancerCreate, Delete: resourceArmLoadBalancerDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -34,6 +38,18 @@ func resourceArmLoadBalancer() *schema.Resource { "resource_group_name": resourceGroupNameSchema(), + "sku": { + Type: schema.TypeString, + Optional: true, + Default: string(network.LoadBalancerSkuNameBasic), + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.LoadBalancerSkuNameBasic), + string(network.LoadBalancerSkuNameStandard), + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + "frontend_ip_configuration": { Type: schema.TypeList, Optional: true, @@ -41,49 +57,62 @@ func resourceArmLoadBalancer() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, }, "subnet_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: azure.ValidateResourceID, }, "private_ip_address": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.IPv4AddressOrEmpty, }, "public_ip_address_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: azure.ValidateResourceIDOrEmpty, }, "private_ip_address_allocation": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validateLoadBalancerPrivateIpAddressAllocation, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.Dynamic), + string(network.Static), + }, true), StateFunc: ignoreCaseStateFunc, - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + DiffSuppressFunc: suppress.CaseDifference, }, "load_balancer_rules": { Type: schema.TypeSet, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.NoZeroValues, + }, + Set: schema.HashString, }, "inbound_nat_rules": { Type: schema.TypeSet, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.NoZeroValues, + }, + Set: schema.HashString, }, "zones": singleZonesSchema(), @@ -103,18 +132,6 @@ func resourceArmLoadBalancer() *schema.Resource { }, }, - "sku": { - Type: schema.TypeString, - Optional: true, - Default: string(network.LoadBalancerSkuNameBasic), - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(network.LoadBalancerSkuNameBasic), - string(network.LoadBalancerSkuNameStandard), - }, true), - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - }, - "tags": tagsSchema(), }, } @@ -181,10 +198,10 @@ func resourceArmLoadBalancerCreate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Error waiting for LoadBalancer (%q - Resource Group %q) to become available: %s", name, resGroup, err) } - return resourecArmLoadBalancerRead(d, meta) + return resourceArmLoadBalancerRead(d, meta) } -func resourecArmLoadBalancerRead(d *schema.ResourceData, meta interface{}) error { +func resourceArmLoadBalancerRead(d *schema.ResourceData, meta interface{}) error { id, err := parseAzureResourceID(d.Id()) if err != nil { return err @@ -334,21 +351,21 @@ func flattenLoadBalancerFrontendIpConfiguration(ipConfigs *[]network.FrontendIPC } if rules := props.LoadBalancingRules; rules != nil { - loadBalancingRules := make([]string, 0, len(*rules)) + loadBalancingRules := make([]interface{}, 0, len(*rules)) for _, rule := range *rules { loadBalancingRules = append(loadBalancingRules, *rule.ID) } - ipConfig["load_balancer_rules"] = loadBalancingRules + ipConfig["load_balancer_rules"] = schema.NewSet(schema.HashString, loadBalancingRules) } if rules := props.InboundNatRules; rules != nil { - inboundNatRules := make([]string, 0, len(*rules)) + inboundNatRules := make([]interface{}, 0, len(*rules)) for _, rule := range *rules { inboundNatRules = append(inboundNatRules, *rule.ID) } - ipConfig["inbound_nat_rules"] = inboundNatRules + ipConfig["inbound_nat_rules"] = schema.NewSet(schema.HashString, inboundNatRules) } } diff --git a/azurerm/resource_arm_loadbalancer_backend_address_pool.go b/azurerm/resource_arm_loadbalancer_backend_address_pool.go index 0a66b608059f9..5e21b945c7f69 100644 --- a/azurerm/resource_arm_loadbalancer_backend_address_pool.go +++ b/azurerm/resource_arm_loadbalancer_backend_address_pool.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" diff --git a/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go b/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go index b7a0780e061e5..145d46f90e75c 100644 --- a/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go +++ b/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -18,7 +18,7 @@ func TestAccAzureRMLoadBalancerBackEndAddressPool_basic(t *testing.T) { subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") backendAddressPoolId := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/backendAddressPools/%s", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/backendAddressPools/%s", subscriptionID, ri, ri, addressPoolName) resource.Test(t, resource.TestCase{ @@ -176,7 +176,7 @@ func testCheckAzureRMLoadBalancerBackEndAddressPoolDisappears(addressPoolName st func testAccAzureRMLoadBalancerBackEndAddressPool_basic(rInt int, addressPoolName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -211,7 +211,7 @@ resource "azurerm_lb_backend_address_pool" "test" { func testAccAzureRMLoadBalancerBackEndAddressPool_removal(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_loadbalancer_nat_pool.go b/azurerm/resource_arm_loadbalancer_nat_pool.go index 589546cc71d1f..dc446aafff084 100644 --- a/azurerm/resource_arm_loadbalancer_nat_pool.go +++ b/azurerm/resource_arm_loadbalancer_nat_pool.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" diff --git a/azurerm/resource_arm_loadbalancer_nat_pool_test.go b/azurerm/resource_arm_loadbalancer_nat_pool_test.go index 2a4bd75d63e06..46c59246f17d9 100644 --- a/azurerm/resource_arm_loadbalancer_nat_pool_test.go +++ b/azurerm/resource_arm_loadbalancer_nat_pool_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -18,7 +18,7 @@ func TestAccAzureRMLoadBalancerNatPool_basic(t *testing.T) { subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") natPoolId := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/inboundNatPools/%s", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/inboundNatPools/%s", subscriptionID, ri, ri, natPoolName) resource.Test(t, resource.TestCase{ @@ -216,7 +216,7 @@ func testCheckAzureRMLoadBalancerNatPoolDisappears(natPoolName string, lb *netwo func testAccAzureRMLoadBalancerNatPool_basic(rInt int, natPoolName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -255,7 +255,7 @@ resource "azurerm_lb_nat_pool" "test" { func testAccAzureRMLoadBalancerNatPool_removal(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -283,7 +283,7 @@ func testAccAzureRMLoadBalancerNatPool_multiplePools(rInt int, natPoolName, natP return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -334,7 +334,7 @@ resource "azurerm_lb_nat_pool" "test2" { func testAccAzureRMLoadBalancerNatPool_multiplePoolsUpdate(rInt int, natPoolName, natPool2Name string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_loadbalancer_nat_rule.go b/azurerm/resource_arm_loadbalancer_nat_rule.go index ebace2b765bde..cd34c2a8b7dec 100644 --- a/azurerm/resource_arm_loadbalancer_nat_rule.go +++ b/azurerm/resource_arm_loadbalancer_nat_rule.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" diff --git a/azurerm/resource_arm_loadbalancer_nat_rule_test.go b/azurerm/resource_arm_loadbalancer_nat_rule_test.go index 782c1f2b2ac44..52a86bfc7e475 100644 --- a/azurerm/resource_arm_loadbalancer_nat_rule_test.go +++ b/azurerm/resource_arm_loadbalancer_nat_rule_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -18,7 +18,7 @@ func TestAccAzureRMLoadBalancerNatRule_basic(t *testing.T) { subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") natRuleId := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/inboundNatRules/%s", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/inboundNatRules/%s", subscriptionID, ri, ri, natRuleName) resource.Test(t, resource.TestCase{ @@ -276,7 +276,7 @@ func testCheckAzureRMLoadBalancerNatRuleDisappears(natRuleName string, lb *netwo func testAccAzureRMLoadBalancerNatRule_basic(rInt int, natRuleName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -314,7 +314,7 @@ resource "azurerm_lb_nat_rule" "test" { func testAccAzureRMLoadBalancerNatRule_removal(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -341,7 +341,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancerNatRule_multipleRules(rInt int, natRuleName, natRule2Name string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -390,7 +390,7 @@ resource "azurerm_lb_nat_rule" "test2" { func testAccAzureRMLoadBalancerNatRule_multipleRulesUpdate(rInt int, natRuleName, natRule2Name string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -439,7 +439,7 @@ resource "azurerm_lb_nat_rule" "test2" { func testAccAzureRMLoadBalancerNatRule_enableFloatingIP(rInt int, natRuleName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_loadbalancer_probe.go b/azurerm/resource_arm_loadbalancer_probe.go index 8ce83be61acaf..ca1aa6c825ac3 100644 --- a/azurerm/resource_arm_loadbalancer_probe.go +++ b/azurerm/resource_arm_loadbalancer_probe.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" diff --git a/azurerm/resource_arm_loadbalancer_probe_test.go b/azurerm/resource_arm_loadbalancer_probe_test.go index 92f13bc96e933..fa2033b4ad782 100644 --- a/azurerm/resource_arm_loadbalancer_probe_test.go +++ b/azurerm/resource_arm_loadbalancer_probe_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -18,7 +18,7 @@ func TestAccAzureRMLoadBalancerProbe_basic(t *testing.T) { subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") probe_id := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/probes/%s", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/probes/%s", subscriptionID, ri, ri, probeName) resource.Test(t, resource.TestCase{ @@ -247,7 +247,7 @@ func testCheckAzureRMLoadBalancerProbeDisappears(addressPoolName string, lb *net func testAccAzureRMLoadBalancerProbe_basic(rInt int, probeName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -282,7 +282,7 @@ resource "azurerm_lb_probe" "test" { func testAccAzureRMLoadBalancerProbe_removal(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -309,7 +309,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancerProbe_multipleProbes(rInt int, probeName, probe2Name string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -352,7 +352,7 @@ resource "azurerm_lb_probe" "test2" { func testAccAzureRMLoadBalancerProbe_multipleProbesUpdate(rInt int, probeName, probe2Name string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -396,7 +396,7 @@ resource "azurerm_lb_probe" "test2" { func testAccAzureRMLoadBalancerProbe_updateProtocolBefore(rInt int, probeName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -433,7 +433,7 @@ resource "azurerm_lb_probe" "test" { func testAccAzureRMLoadBalancerProbe_updateProtocolAfter(rInt int, probeName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_loadbalancer_rule.go b/azurerm/resource_arm_loadbalancer_rule.go index 3f1df0f361d0d..150052c00b9de 100644 --- a/azurerm/resource_arm_loadbalancer_rule.go +++ b/azurerm/resource_arm_loadbalancer_rule.go @@ -6,7 +6,7 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" diff --git a/azurerm/resource_arm_loadbalancer_rule_test.go b/azurerm/resource_arm_loadbalancer_rule_test.go index 4e567f5eeaee6..e6530ca7d57b8 100644 --- a/azurerm/resource_arm_loadbalancer_rule_test.go +++ b/azurerm/resource_arm_loadbalancer_rule_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -74,7 +74,7 @@ func TestAccAzureRMLoadBalancerRule_basic(t *testing.T) { subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") lbRule_id := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/loadBalancingRules/%s", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/loadBalancingRules/%s", subscriptionID, ri, ri, lbRuleName) resource.Test(t, resource.TestCase{ @@ -157,11 +157,11 @@ func TestAccAzureRMLoadBalancerRule_update(t *testing.T) { subscriptionID := os.Getenv("ARM_SUBSCRIPTION_ID") lbRuleID := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/loadBalancingRules/%s", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/loadBalancingRules/%s", subscriptionID, ri, ri, lbRuleName) lbRule2ID := fmt.Sprintf( - "/subscriptions/%s/resourceGroups/acctestrg-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/loadBalancingRules/%s", + "/subscriptions/%s/resourceGroups/acctestRG-%d/providers/Microsoft.Network/loadBalancers/arm-test-loadbalancer-%d/loadBalancingRules/%s", subscriptionID, ri, ri, lbRule2Name) resource.Test(t, resource.TestCase{ @@ -313,7 +313,7 @@ func testCheckAzureRMLoadBalancerRuleDisappears(ruleName string, lb *network.Loa func testAccAzureRMLoadBalancerRule_basic(rInt int, lbRuleName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -351,7 +351,7 @@ resource "azurerm_lb_rule" "test" { func testAccAzureRMLoadBalancerRule_removal(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -380,7 +380,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancerRule_inconsistentRead(rInt int, backendPoolName, probeName, lbRuleName string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -435,7 +435,7 @@ resource "azurerm_lb_rule" "test" { func testAccAzureRMLoadBalancerRule_multipleRules(rInt int, lbRuleName, lbRule2Name string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -485,7 +485,7 @@ resource "azurerm_lb_rule" "test2" { func testAccAzureRMLoadBalancerRule_multipleRulesUpdate(rInt int, lbRuleName, lbRule2Name string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_loadbalancer_test.go b/azurerm/resource_arm_loadbalancer_test.go index 92243088129f5..1eb780dcf834a 100644 --- a/azurerm/resource_arm_loadbalancer_test.go +++ b/azurerm/resource_arm_loadbalancer_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -153,6 +153,27 @@ func TestAccAzureRMLoadBalancer_tags(t *testing.T) { }) } +func TestAccAzureRMLoadBalancer_emptyPrivateIP(t *testing.T) { + resourceName := "azurerm_lb.test" + var lb network.LoadBalancer + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMLoadBalancerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMLoadBalancer_emptyIPAddress(ri, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMLoadBalancerExists(resourceName, &lb), + resource.TestCheckResourceAttrSet(resourceName, "frontend_ip_configuration.0.private_ip_address"), + ), + }, + }, + }) +} + func testCheckAzureRMLoadBalancerExists(name string, lb *network.LoadBalancer) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -213,7 +234,7 @@ func testCheckAzureRMLoadBalancerDestroy(s *terraform.State) error { func testAccAzureRMLoadBalancer_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -233,7 +254,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancer_standard(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -255,7 +276,7 @@ func testAccAzureRMLoadBalancer_updatedTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -274,7 +295,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancer_frontEndConfig(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -312,7 +333,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancer_frontEndConfig_withZone(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -352,7 +373,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancer_frontEndConfigRemovalWithIP(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -385,7 +406,7 @@ resource "azurerm_lb" "test" { func testAccAzureRMLoadBalancer_frontEndConfigRemoval(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -407,3 +428,40 @@ resource "azurerm_lb" "test" { } }`, rInt, location, rInt, rInt, rInt) } + +func testAccAzureRMLoadBalancer_emptyIPAddress(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_lb" "test" { + name = "acctestlb-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + sku = "Basic" + + frontend_ip_configuration { + name = "Internal" + private_ip_address_allocation = "Dynamic" + private_ip_address = "" + subnet_id = "${azurerm_subnet.test.id}" + } +} +`, rInt, location, rInt, rInt, rInt) +} diff --git a/azurerm/resource_arm_local_network_gateway.go b/azurerm/resource_arm_local_network_gateway.go index 380913024cc48..2791ca089d068 100644 --- a/azurerm/resource_arm_local_network_gateway.go +++ b/azurerm/resource_arm_local_network_gateway.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_local_network_gateway_test.go b/azurerm/resource_arm_local_network_gateway_test.go index f35f93ea3e0bb..9a81de76f5e87 100644 --- a/azurerm/resource_arm_local_network_gateway_test.go +++ b/azurerm/resource_arm_local_network_gateway_test.go @@ -193,7 +193,7 @@ func TestAccAzureRMLocalNetworkGateway_bgpSettingsComplete(t *testing.T) { }) } -// testCheckAzureRMLocalNetworkGatewayExists returns the resurce.TestCheckFunc +// testCheckAzureRMLocalNetworkGatewayExists returns the resource.TestCheckFunc // which checks whether or not the expected local network gateway exists both // in the schema, and on Azure. func testCheckAzureRMLocalNetworkGatewayExists(name string) resource.TestCheckFunc { diff --git a/azurerm/resource_arm_log_analytics_solution.go b/azurerm/resource_arm_log_analytics_solution.go index 9e5fd9f8fe743..077967c036a60 100644 --- a/azurerm/resource_arm_log_analytics_solution.go +++ b/azurerm/resource_arm_log_analytics_solution.go @@ -5,7 +5,7 @@ import ( "log" "strings" - "github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement" + "github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_log_analytics_solution_test.go b/azurerm/resource_arm_log_analytics_solution_test.go index 52b5edd0c0efa..f908ae3a953c6 100644 --- a/azurerm/resource_arm_log_analytics_solution_test.go +++ b/azurerm/resource_arm_log_analytics_solution_test.go @@ -113,7 +113,7 @@ resource "azurerm_log_analytics_workspace" "test" { name = "acctest-dep-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - sku = "Free" + sku = "PerGB2018" } resource "azurerm_log_analytics_solution" "test" { @@ -142,7 +142,7 @@ resource "azurerm_log_analytics_workspace" "test" { name = "acctest-dep-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - sku = "Free" + sku = "PerGB2018" } resource "azurerm_log_analytics_solution" "test" { diff --git a/azurerm/resource_arm_log_analytics_workspace.go b/azurerm/resource_arm_log_analytics_workspace.go index 236922f636e4d..8f1386d1db9e4 100644 --- a/azurerm/resource_arm_log_analytics_workspace.go +++ b/azurerm/resource_arm_log_analytics_workspace.go @@ -5,7 +5,7 @@ import ( "log" "regexp" - "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights" + "github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -44,6 +44,7 @@ func resourceArmLogAnalyticsWorkspace() *schema.Resource { string(operationalinsights.Standalone), string(operationalinsights.Standard), string(operationalinsights.Unlimited), + string(operationalinsights.PerGB2018), }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, diff --git a/azurerm/resource_arm_log_analytics_workspace_test.go b/azurerm/resource_arm_log_analytics_workspace_test.go index ca76d9fd95ba8..8cd26c17a09fc 100644 --- a/azurerm/resource_arm_log_analytics_workspace_test.go +++ b/azurerm/resource_arm_log_analytics_workspace_test.go @@ -69,6 +69,7 @@ func TestAccAzureRMLogAnalyticsWorkspace_requiredOnly(t *testing.T) { }, }) } + func TestAccAzureRMLogAnalyticsWorkspace_retentionInDaysComplete(t *testing.T) { ri := acctest.RandInt() config := testAccAzureRMLogAnalyticsWorkspace_retentionInDaysComplete(ri, testLocation()) @@ -143,7 +144,6 @@ func testCheckAzureRMLogAnalyticsWorkspaceExists(name string) resource.TestCheck return nil } } - func testAccAzureRMLogAnalyticsWorkspace_requiredOnly(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { @@ -155,7 +155,7 @@ resource "azurerm_log_analytics_workspace" "test" { name = "acctest-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - sku = "Free" + sku = "PerGB2018" } `, rInt, location, rInt) } @@ -171,7 +171,7 @@ resource "azurerm_log_analytics_workspace" "test" { name = "acctest-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - sku = "Standard" + sku = "PerGB2018" retention_in_days = 30 } `, rInt, location, rInt) diff --git a/azurerm/resource_arm_managed_disk.go b/azurerm/resource_arm_managed_disk.go index c3bf268ba9ce6..055f2543b69e2 100644 --- a/azurerm/resource_arm_managed_disk.go +++ b/azurerm/resource_arm_managed_disk.go @@ -137,7 +137,7 @@ func resourceArmManagedDiskCreate(d *schema.ResourceData, meta interface{}) erro OsType: compute.OperatingSystemTypes(osType), }, Sku: &compute.DiskSku{ - Name: (skuName), + Name: skuName, }, Tags: expandedTags, Zones: zones, diff --git a/azurerm/resource_arm_metric_alertrule.go b/azurerm/resource_arm_metric_alertrule.go index a8d0150fa6c8b..8032073e4adb9 100644 --- a/azurerm/resource_arm_metric_alertrule.go +++ b/azurerm/resource_arm_metric_alertrule.go @@ -3,10 +3,9 @@ package azurerm import ( "fmt" "log" - "strings" - "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights" + "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_mysql_configuration.go b/azurerm/resource_arm_mysql_configuration.go index 280d1efb587c1..8a2dd1aa67cf4 100644 --- a/azurerm/resource_arm_mysql_configuration.go +++ b/azurerm/resource_arm_mysql_configuration.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql" + "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_mysql_configuration_test.go b/azurerm/resource_arm_mysql_configuration_test.go index cda838baca9c5..7bc0d9ecbde69 100644 --- a/azurerm/resource_arm_mysql_configuration_test.go +++ b/azurerm/resource_arm_mysql_configuration_test.go @@ -223,15 +223,21 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "5.7" - storage_mb = 51200 ssl_enforcement = "Enabled" } `, rInt, location, rInt) diff --git a/azurerm/resource_arm_mysql_database.go b/azurerm/resource_arm_mysql_database.go index cf11d980ad291..e4cf22b027939 100644 --- a/azurerm/resource_arm_mysql_database.go +++ b/azurerm/resource_arm_mysql_database.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql" + "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -34,9 +34,10 @@ func resourceArmMySqlDatabase() *schema.Resource { }, "charset": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ForceNew: true, }, "collation": { diff --git a/azurerm/resource_arm_mysql_database_test.go b/azurerm/resource_arm_mysql_database_test.go index 7cafc19543d86..3d7e729eb428c 100644 --- a/azurerm/resource_arm_mysql_database_test.go +++ b/azurerm/resource_arm_mysql_database_test.go @@ -30,6 +30,48 @@ func TestAccAzureRMMySQLDatabase_basic(t *testing.T) { }) } +func TestAccAzureRMMySQLDatabase_charsetUppercase(t *testing.T) { + resourceName := "azurerm_mysql_database.test" + ri := acctest.RandInt() + config := testAccAzureRMMySQLDatabase_charsetUppercase(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMMySQLDatabaseDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMMySQLDatabaseExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "charset", "utf8"), + ), + }, + }, + }) +} + +func TestAccAzureRMMySQLDatabase_charsetMixedcase(t *testing.T) { + resourceName := "azurerm_mysql_database.test" + ri := acctest.RandInt() + config := testAccAzureRMMySQLDatabase_charsetMixedcase(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMMySQLDatabaseDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMMySQLDatabaseExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "charset", "utf8"), + ), + }, + }, + }) +} + func testCheckAzureRMMySQLDatabaseExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API @@ -99,15 +141,21 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "5.6" - storage_mb = 51200 ssl_enforcement = "Enabled" } @@ -120,3 +168,85 @@ resource "azurerm_mysql_database" "test" { } `, rInt, location, rInt, rInt) } + +func testAccAzureRMMySQLDatabase_charsetUppercase(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_mysql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "B_Gen4_2" + capacity = 2 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "5.6" + ssl_enforcement = "Enabled" +} + +resource "azurerm_mysql_database" "test" { + name = "acctestdb_%d" + resource_group_name = "${azurerm_resource_group.test.name}" + server_name = "${azurerm_mysql_server.test.name}" + charset = "UTF8" + collation = "utf8_unicode_ci" +} +`, rInt, location, rInt, rInt) +} + +func testAccAzureRMMySQLDatabase_charsetMixedcase(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_mysql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "B_Gen4_2" + capacity = 2 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "5.6" + ssl_enforcement = "Enabled" +} + +resource "azurerm_mysql_database" "test" { + name = "acctestdb_%d" + resource_group_name = "${azurerm_resource_group.test.name}" + server_name = "${azurerm_mysql_server.test.name}" + charset = "Utf8" + collation = "utf8_unicode_ci" +} +`, rInt, location, rInt, rInt) +} diff --git a/azurerm/resource_arm_mysql_firewall_rule.go b/azurerm/resource_arm_mysql_firewall_rule.go index 521bf8223c392..4d37864866b20 100644 --- a/azurerm/resource_arm_mysql_firewall_rule.go +++ b/azurerm/resource_arm_mysql_firewall_rule.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql" + "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_mysql_firewall_rule_test.go b/azurerm/resource_arm_mysql_firewall_rule_test.go index 65e94d2a220cd..b0e2a7efaaef3 100644 --- a/azurerm/resource_arm_mysql_firewall_rule_test.go +++ b/azurerm/resource_arm_mysql_firewall_rule_test.go @@ -100,15 +100,21 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 - tier = "Basic" + name = "B_Gen4_2" + capacity = 2 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "5.6" - storage_mb = 51200 ssl_enforcement = "Enabled" } diff --git a/azurerm/resource_arm_mysql_server.go b/azurerm/resource_arm_mysql_server.go index e733722cb5aeb..60f70ab2a4609 100644 --- a/azurerm/resource_arm_mysql_server.go +++ b/azurerm/resource_arm_mysql_server.go @@ -3,9 +3,9 @@ package azurerm import ( "fmt" "log" - "strconv" + "strings" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql" + "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -33,7 +33,7 @@ func resourceArmMySqlServer() *schema.Resource { "resource_group_name": resourceGroupNameSchema(), "sku": { - Type: schema.TypeSet, + Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ @@ -42,12 +42,24 @@ func resourceArmMySqlServer() *schema.Resource { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - "MYSQLB50", - "MYSQLB100", - "MYSQLS100", - "MYSQLS200", - "MYSQLS400", - "MYSQLS800", + "B_Gen4_1", + "B_Gen4_2", + "B_Gen5_1", + "B_Gen5_2", + "GP_Gen4_2", + "GP_Gen4_4", + "GP_Gen4_8", + "GP_Gen4_16", + "GP_Gen4_32", + "GP_Gen5_2", + "GP_Gen5_4", + "GP_Gen5_8", + "GP_Gen5_16", + "GP_Gen5_32", + "MO_Gen5_2", + "MO_Gen5_4", + "MO_Gen5_8", + "MO_Gen5_16", }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, @@ -56,20 +68,34 @@ func resourceArmMySqlServer() *schema.Resource { Type: schema.TypeInt, Required: true, ValidateFunc: validateIntInSlice([]int{ - 50, - 100, - 200, - 400, - 800, + 1, + 2, + 4, + 8, + 16, + 32, }), }, "tier": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(mysql.Basic), - string(mysql.Standard), + string(mysql.GeneralPurpose), + string(mysql.MemoryOptimized), + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + + "family": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "Gen4", + "Gen5", }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, @@ -100,31 +126,34 @@ func resourceArmMySqlServer() *schema.Resource { ForceNew: true, }, - "storage_mb": { - Type: schema.TypeInt, + "storage_profile": { + Type: schema.TypeList, Required: true, - ForceNew: true, - ValidateFunc: validateIntInSlice([]int{ - // Basic SKU - 51200, - 179200, - 307200, - 435200, - 563200, - 691200, - 819200, - 947200, - - // Standard SKU - 128000, - 256000, - 384000, - 512000, - 640000, - 768000, - 896000, - 1024000, - }), + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_mb": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validateIntBetweenDivisibleBy(5120, 4194304, 1024), + }, + "backup_retention_days": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(7, 35), + }, + "geo_redundant_backup": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "Enabled", + "Disabled", + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + }, + }, }, "ssl_enforcement": { @@ -144,6 +173,18 @@ func resourceArmMySqlServer() *schema.Resource { "tags": tagsSchema(), }, + + CustomizeDiff: func(diff *schema.ResourceDiff, v interface{}) error { + + tier, _ := diff.GetOk("sku.0.tier") + storageMB, _ := diff.GetOk("storage_profile.0.storage_mb") + + if strings.ToLower(tier.(string)) == "basic" && storageMB.(int) > 1048576 { + return fmt.Errorf("basic pricing tier only supports upto 1,048,576 MB (1TB) of storage") + } + + return nil + }, } } @@ -161,41 +202,43 @@ func resourceArmMySqlServerCreate(d *schema.ResourceData, meta interface{}) erro adminLoginPassword := d.Get("administrator_login_password").(string) sslEnforcement := d.Get("ssl_enforcement").(string) version := d.Get("version").(string) - storageMB := d.Get("storage_mb").(int) - + createMode := "Default" tags := d.Get("tags").(map[string]interface{}) - sku := expandMySQLServerSku(d, storageMB) + sku := expandMySQLServerSku(d) + storageProfile := expandMySQLStorageProfile(d) properties := mysql.ServerForCreate{ Location: &location, - Sku: sku, Properties: &mysql.ServerPropertiesForDefaultCreate{ - Version: mysql.ServerVersion(version), - StorageMB: utils.Int64(int64(storageMB)), - SslEnforcement: mysql.SslEnforcementEnum(sslEnforcement), AdministratorLogin: utils.String(adminLogin), AdministratorLoginPassword: utils.String(adminLoginPassword), + Version: mysql.ServerVersion(version), + SslEnforcement: mysql.SslEnforcementEnum(sslEnforcement), + StorageProfile: storageProfile, + CreateMode: mysql.CreateMode(createMode), }, + Sku: sku, Tags: expandTags(tags), } - future, err := client.CreateOrUpdate(ctx, resourceGroup, name, properties) + future, err := client.Create(ctx, resourceGroup, name, properties) if err != nil { - return err + return fmt.Errorf("Error creating MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) if err != nil { - return err + return fmt.Errorf("Error waiting for creation of MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } read, err := client.Get(ctx, resourceGroup, name) if err != nil { - return err + return fmt.Errorf("Error retrieving MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } + if read.ID == nil { - return fmt.Errorf("Cannot read MySQL Server %q (resource group %q) ID", name, resourceGroup) + return fmt.Errorf("Cannot read MySQL Server %q (Resource Group %q) ID", name, resourceGroup) } d.SetId(*read.ID) @@ -215,38 +258,38 @@ func resourceArmMySqlServerUpdate(d *schema.ResourceData, meta interface{}) erro adminLoginPassword := d.Get("administrator_login_password").(string) sslEnforcement := d.Get("ssl_enforcement").(string) version := d.Get("version").(string) - storageMB := d.Get("storage_mb").(int) - sku := expandMySQLServerSku(d, storageMB) - + sku := expandMySQLServerSku(d) + storageProfile := expandMySQLStorageProfile(d) tags := d.Get("tags").(map[string]interface{}) properties := mysql.ServerUpdateParameters{ - Sku: sku, ServerUpdateParametersProperties: &mysql.ServerUpdateParametersProperties{ - SslEnforcement: mysql.SslEnforcementEnum(sslEnforcement), - StorageMB: utils.Int64(int64(storageMB)), - Version: mysql.ServerVersion(version), + StorageProfile: storageProfile, AdministratorLoginPassword: utils.String(adminLoginPassword), + Version: mysql.ServerVersion(version), + SslEnforcement: mysql.SslEnforcementEnum(sslEnforcement), }, + Sku: sku, Tags: expandTags(tags), } future, err := client.Update(ctx, resourceGroup, name, properties) if err != nil { - return err + return fmt.Errorf("Error updating MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) if err != nil { - return err + return fmt.Errorf("Error waiting for MySQL Server %q (Resource Group %q) to finish updating: %+v", name, resourceGroup, err) } read, err := client.Get(ctx, resourceGroup, name) if err != nil { - return err + return fmt.Errorf("Error retrieving MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } + if read.ID == nil { - return fmt.Errorf("Cannot read MySQL Server %q (resource group %q) ID", name, resourceGroup) + return fmt.Errorf("Cannot read MySQL Server %q (Resource Group %q) ID", name, resourceGroup) } d.SetId(*read.ID) @@ -271,22 +314,27 @@ func resourceArmMySqlServerRead(d *schema.ResourceData, meta interface{}) error d.SetId("") return nil } + return fmt.Errorf("Error making Read request on Azure MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } d.Set("name", resp.Name) d.Set("resource_group_name", resourceGroup) + if location := resp.Location; location != nil { d.Set("location", azureRMNormalizeLocation(*location)) } d.Set("administrator_login", resp.AdministratorLogin) d.Set("version", string(resp.Version)) - d.Set("storage_mb", int(*resp.StorageMB)) d.Set("ssl_enforcement", string(resp.SslEnforcement)) - if err := d.Set("sku", flattenMySQLServerSku(d, resp.Sku)); err != nil { - return err + if err := d.Set("sku", flattenMySQLServerSku(resp.Sku)); err != nil { + return fmt.Errorf("Error flattening `sku`: %+v", err) + } + + if err := d.Set("storage_profile", flattenMySQLStorageProfile(resp.StorageProfile)); err != nil { + return fmt.Errorf("Error flattening `storage_profile`: %+v", err) } flattenAndSetTags(d, resp.Tags) @@ -310,40 +358,81 @@ func resourceArmMySqlServerDelete(d *schema.ResourceData, meta interface{}) erro future, err := client.Delete(ctx, resourceGroup, name) if err != nil { - return err + return fmt.Errorf("Error deleting MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) if err != nil { - return err + return fmt.Errorf("Error waiting for deletion of MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } return nil } -func expandMySQLServerSku(d *schema.ResourceData, storageMB int) *mysql.Sku { - skus := d.Get("sku").(*schema.Set).List() +func expandMySQLServerSku(d *schema.ResourceData) *mysql.Sku { + skus := d.Get("sku").([]interface{}) sku := skus[0].(map[string]interface{}) name := sku["name"].(string) capacity := sku["capacity"].(int) tier := sku["tier"].(string) + family := sku["family"].(string) return &mysql.Sku{ Name: utils.String(name), - Capacity: utils.Int32(int32(capacity)), Tier: mysql.SkuTier(tier), - Size: utils.String(strconv.Itoa(storageMB)), + Capacity: utils.Int32(int32(capacity)), + Family: utils.String(family), + } +} + +func expandMySQLStorageProfile(d *schema.ResourceData) *mysql.StorageProfile { + storageprofiles := d.Get("storage_profile").([]interface{}) + storageprofile := storageprofiles[0].(map[string]interface{}) + + backupRetentionDays := storageprofile["backup_retention_days"].(int) + geoRedundantBackup := storageprofile["geo_redundant_backup"].(string) + storageMB := storageprofile["storage_mb"].(int) + + return &mysql.StorageProfile{ + BackupRetentionDays: utils.Int32(int32(backupRetentionDays)), + GeoRedundantBackup: mysql.GeoRedundantBackup(geoRedundantBackup), + StorageMB: utils.Int32(int32(storageMB)), } } -func flattenMySQLServerSku(d *schema.ResourceData, resp *mysql.Sku) []interface{} { +func flattenMySQLServerSku(resp *mysql.Sku) []interface{} { values := map[string]interface{}{} - values["name"] = *resp.Name - values["capacity"] = int(*resp.Capacity) + if name := resp.Name; name != nil { + values["name"] = *name + } + + if capacity := resp.Capacity; capacity != nil { + values["capacity"] = *capacity + } + values["tier"] = string(resp.Tier) - sku := []interface{}{values} - return sku + if family := resp.Family; family != nil { + values["family"] = *family + } + + return []interface{}{values} +} + +func flattenMySQLStorageProfile(resp *mysql.StorageProfile) []interface{} { + values := map[string]interface{}{} + + if storageMB := resp.StorageMB; storageMB != nil { + values["storage_mb"] = *storageMB + } + + if backupRetentionDays := resp.BackupRetentionDays; backupRetentionDays != nil { + values["backup_retention_days"] = *backupRetentionDays + } + + values["geo_redundant_backup"] = mysql.GeoRedundantBackup(resp.GeoRedundantBackup) + + return []interface{}{values} } diff --git a/azurerm/resource_arm_mysql_server_test.go b/azurerm/resource_arm_mysql_server_test.go index 830c85d09d938..111c34cc60558 100644 --- a/azurerm/resource_arm_mysql_server_test.go +++ b/azurerm/resource_arm_mysql_server_test.go @@ -50,10 +50,10 @@ func TestAccAzureRMMySQLServer_basicFiveSeven(t *testing.T) { }) } -func TestAccAzureRMMySqlServer_standard(t *testing.T) { +func TestAccAzureRMMySqlServer_generalPurpose(t *testing.T) { resourceName := "azurerm_mysql_server.test" ri := acctest.RandInt() - config := testAccAzureRMMySQLServer_standard(ri, testLocation()) + config := testAccAzureRMMySQLServer_generalPurpose(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -70,6 +70,56 @@ func TestAccAzureRMMySqlServer_standard(t *testing.T) { }) } +func TestAccAzureRMMySqlServer_memoryOptimized(t *testing.T) { + resourceName := "azurerm_mysql_server.test" + ri := acctest.RandInt() + config := testAccAzureRMMySQLServer_memoryOptimized(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMMySQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMMySQLServerExists(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMMySQLServer_basicFiveSevenUpdated(t *testing.T) { + resourceName := "azurerm_mysql_server.test" + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMMySQLServer_basicFiveSeven(ri, location) + updatedConfig := testAccAzureRMMySQLServer_basicFiveSevenUpdated(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMMySQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMMySQLServerExists(resourceName), + ), + }, + { + Config: updatedConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMMySQLServerExists(resourceName), + ), + }, + }, + }) +} + +// + func testCheckAzureRMMySQLServerExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API @@ -138,15 +188,21 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "5.6" - storage_mb = 51200 ssl_enforcement = "Enabled" } `, rInt, location, rInt) @@ -165,21 +221,27 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 + name = "B_Gen5_2" + capacity = 2 tier = "Basic" + family = "Gen5" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "5.7" - storage_mb = 51200 ssl_enforcement = "Enabled" } `, rInt, location, rInt) } -func testAccAzureRMMySQLServer_standard(rInt int, location string) string { +func testAccAzureRMMySQLServer_basicFiveSevenUpdated(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -192,15 +254,87 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLS200" - capacity = 200 - tier = "Standard" + name = "B_Gen5_1" + capacity = 1 + tier = "Basic" + family = "Gen5" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "5.7" + ssl_enforcement = "Enabled" +} +`, rInt, location, rInt) +} + +func testAccAzureRMMySQLServer_generalPurpose(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_mysql_server" "test" { + name = "acctestmysqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "GP_Gen5_32" + capacity = 32 + tier = "GeneralPurpose" + family = "Gen5" + } + + storage_profile { + storage_mb = 640000 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "5.7" + ssl_enforcement = "Enabled" +} +`, rInt, location, rInt) +} + +func testAccAzureRMMySQLServer_memoryOptimized(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_mysql_server" "test" { + name = "acctestmysqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "MO_Gen5_16" + capacity = 16 + tier = "MemoryOptimized" + family = "Gen5" + } + + storage_profile { + storage_mb = 4194304, + backup_retention_days = 7 + geo_redundant_backup = "Enabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "5.7" - storage_mb = 640000 ssl_enforcement = "Enabled" } `, rInt, location, rInt) diff --git a/azurerm/resource_arm_network_interface.go b/azurerm/resource_arm_network_interface.go index 8e58696425b76..c157c5c2095a8 100644 --- a/azurerm/resource_arm_network_interface.go +++ b/azurerm/resource_arm_network_interface.go @@ -5,9 +5,12 @@ import ( "log" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -17,6 +20,7 @@ func resourceArmNetworkInterface() *schema.Resource { Read: resourceArmNetworkInterfaceRead, Update: resourceArmNetworkInterfaceCreateUpdate, Delete: resourceArmNetworkInterfaceDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -33,20 +37,23 @@ func resourceArmNetworkInterface() *schema.Resource { "resource_group_name": resourceGroupNameSchema(), "network_security_group_id": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceIDOrEmpty, }, "mac_address": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validate.MACAddress, }, "virtual_machine_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: azure.ValidateResourceID, }, "ip_configuration": { @@ -55,20 +62,21 @@ func resourceArmNetworkInterface() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, }, "subnet_id": { Type: schema.TypeString, Required: true, - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: azure.ValidateResourceID, }, "private_ip_address": { Type: schema.TypeString, Optional: true, - Computed: true, }, "private_ip_address_allocation": { @@ -79,45 +87,57 @@ func resourceArmNetworkInterface() *schema.Resource { string(network.Static), }, true), StateFunc: ignoreCaseStateFunc, - DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + DiffSuppressFunc: suppress.CaseDifference, }, "public_ip_address_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceIDOrEmpty, }, "application_gateway_backend_address_pools_ids": { Type: schema.TypeSet, Optional: true, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: azure.ValidateResourceID, + }, + Set: schema.HashString, }, "load_balancer_backend_address_pools_ids": { Type: schema.TypeSet, Optional: true, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: azure.ValidateResourceID, + }, + Set: schema.HashString, }, "load_balancer_inbound_nat_rules_ids": { Type: schema.TypeSet, Optional: true, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: azure.ValidateResourceID, + }, + Set: schema.HashString, }, "application_security_group_ids": { Type: schema.TypeSet, Optional: true, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: azure.ValidateResourceID, + }, + Set: schema.HashString, }, "primary": { @@ -133,28 +153,36 @@ func resourceArmNetworkInterface() *schema.Resource { Type: schema.TypeSet, Optional: true, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.NoZeroValues, + }, + Set: schema.HashString, }, "internal_dns_name_label": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.NoZeroValues, }, "applied_dns_servers": { Type: schema.TypeSet, Optional: true, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.NoZeroValues, + }, + Set: schema.HashString, }, "internal_fqdn": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.NoZeroValues, }, /** @@ -368,6 +396,8 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e d.Set("internal_fqdn", props.DNSSettings.InternalFqdn) d.Set("internal_dns_name_label", props.DNSSettings.InternalDNSNameLabel) } + d.Set("applied_dns_servers", appliedDNSServers) + d.Set("dns_servers", dnsServers) if nsg := props.NetworkSecurityGroup; nsg != nil { d.Set("network_security_group_id", nsg.ID) @@ -381,8 +411,6 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e d.Set("location", azureRMNormalizeLocation(*location)) } - d.Set("applied_dns_servers", appliedDNSServers) - d.Set("dns_servers", dnsServers) d.Set("enable_ip_forwarding", resp.EnableIPForwarding) d.Set("enable_accelerated_networking", resp.EnableAcceleratedNetworking) diff --git a/azurerm/resource_arm_network_interface_test.go b/azurerm/resource_arm_network_interface_test.go index 91c52b95d0677..2ae53ea7d1fb4 100644 --- a/azurerm/resource_arm_network_interface_test.go +++ b/azurerm/resource_arm_network_interface_test.go @@ -333,6 +333,34 @@ func TestAccAzureRMNetworkInterface_withTags(t *testing.T) { }) } +func TestAccAzureRMNetworkInterface_IPAddressesBug1286(t *testing.T) { + resourceName := "azurerm_network_interface.test" + rInt := acctest.RandInt() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMNetworkInterfaceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMNetworkInterface_withIPAddresses(rInt, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMNetworkInterfaceExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "ip_configuration.0.private_ip_address"), + resource.TestCheckResourceAttrSet(resourceName, "ip_configuration.0.public_ip_address_id"), + ), + }, + { + Config: testAccAzureRMNetworkInterface_withIPAddressesUpdate(rInt, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMNetworkInterfaceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "ip_configuration.0.private_ip_address", ""), + resource.TestCheckResourceAttr(resourceName, "ip_configuration.0.public_ip_address_id", ""), + ), + }, + }, + }) +} + func TestAccAzureRMNetworkInterface_bug7986(t *testing.T) { rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ @@ -790,6 +818,94 @@ resource "azurerm_network_interface" "test" { `, rInt, location, rInt, rInt) } +func testAccAzureRMNetworkInterface_withIPAddresses(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctest-rg-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestvn-%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 = "testsubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_public_ip" "test" { + name = "test-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "static" + domain_name_label = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_network_interface" "test" { + name = "acctestni-%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 = "static" + private_ip_address = "10.0.2.9" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } +} +`, rInt, location, rInt, rInt, rInt) +} + +func testAccAzureRMNetworkInterface_withIPAddressesUpdate(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctest-rg-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestvn-%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 = "testsubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_public_ip" "test" { + name = "test-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "static" + domain_name_label = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_network_interface" "test" { + name = "acctestni-%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" + } +} +`, rInt, location, rInt, rInt, rInt) +} + func testAccAzureRMNetworkInterface_multipleLoadBalancers(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { @@ -925,7 +1041,7 @@ resource "azurerm_network_interface" "test2" { func testAccAzureRMNetworkInterface_applicationGatewayBackendPool(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_network_security_group.go b/azurerm/resource_arm_network_security_group.go index 521a42183c50a..b01968fdc5d13 100644 --- a/azurerm/resource_arm_network_security_group.go +++ b/azurerm/resource_arm_network_security_group.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" multierror "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" diff --git a/azurerm/resource_arm_network_security_rule.go b/azurerm/resource_arm_network_security_rule.go index f5db8534e3725..3cd297adf5d83 100644 --- a/azurerm/resource_arm_network_security_rule.go +++ b/azurerm/resource_arm_network_security_rule.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_network_watcher.go b/azurerm/resource_arm_network_watcher.go index d483f5fa0c7e3..7b80c15e62ffa 100644 --- a/azurerm/resource_arm_network_watcher.go +++ b/azurerm/resource_arm_network_watcher.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_packet_capture.go b/azurerm/resource_arm_packet_capture.go index 2073beb1b9b82..71a9f12d8facc 100644 --- a/azurerm/resource_arm_packet_capture.go +++ b/azurerm/resource_arm_packet_capture.go @@ -5,7 +5,7 @@ import ( "log" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" diff --git a/azurerm/resource_arm_packet_capture_test.go b/azurerm/resource_arm_packet_capture_test.go index 1c340b90faa42..ecfa2b7ade9af 100644 --- a/azurerm/resource_arm_packet_capture_test.go +++ b/azurerm/resource_arm_packet_capture_test.go @@ -153,7 +153,7 @@ func testCheckAzureRMPacketCaptureDestroy(s *terraform.State) error { func testAzureRMPacketCapture_base(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_policy_assignment_test.go b/azurerm/resource_arm_policy_assignment_test.go index 750cbd168200f..d57c280b34f5c 100644 --- a/azurerm/resource_arm_policy_assignment_test.go +++ b/azurerm/resource_arm_policy_assignment_test.go @@ -123,7 +123,7 @@ POLICY_RULE } resource "azurerm_resource_group" "test" { - name = "acctestrgpol-%d" + name = "acctestRG-%d" location = "%s" } @@ -171,7 +171,7 @@ PARAMETERS } resource "azurerm_resource_group" "test" { - name = "acctestrgpol-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_postgresql_configuration.go b/azurerm/resource_arm_postgresql_configuration.go index e26895e4e2b13..a4fb229bbef6f 100644 --- a/azurerm/resource_arm_postgresql_configuration.go +++ b/azurerm/resource_arm_postgresql_configuration.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_postgresql_configuration_test.go b/azurerm/resource_arm_postgresql_configuration_test.go index 7073e87b58658..bd63d3ce5bfd1 100644 --- a/azurerm/resource_arm_postgresql_configuration_test.go +++ b/azurerm/resource_arm_postgresql_configuration_test.go @@ -223,15 +223,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "9.6" - storage_mb = 51200 ssl_enforcement = "Enabled" } `, rInt, location, rInt) diff --git a/azurerm/resource_arm_postgresql_database.go b/azurerm/resource_arm_postgresql_database.go index e0d4e968244a9..d05cce28919b9 100644 --- a/azurerm/resource_arm_postgresql_database.go +++ b/azurerm/resource_arm_postgresql_database.go @@ -3,8 +3,9 @@ package azurerm import ( "fmt" "log" + "strings" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -35,15 +36,17 @@ func resourceArmPostgreSQLDatabase() *schema.Resource { }, "charset": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ForceNew: true, }, "collation": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateCollation(), }, }, } @@ -118,8 +121,15 @@ func resourceArmPostgreSQLDatabaseRead(d *schema.ResourceData, meta interface{}) d.Set("name", resp.Name) d.Set("resource_group_name", resGroup) d.Set("server_name", serverName) - d.Set("charset", resp.Charset) - d.Set("collation", resp.Collation) + + if props := resp.DatabaseProperties; props != nil { + d.Set("charset", props.Charset) + + if collation := props.Collation; collation != nil { + v := strings.Replace(*collation, "-", "_", -1) + d.Set("collation", v) + } + } return nil } diff --git a/azurerm/resource_arm_postgresql_database_test.go b/azurerm/resource_arm_postgresql_database_test.go index c74294f26c33e..ccc438b05314c 100644 --- a/azurerm/resource_arm_postgresql_database_test.go +++ b/azurerm/resource_arm_postgresql_database_test.go @@ -24,7 +24,50 @@ func TestAccAzureRMPostgreSQLDatabase_basic(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMPostgreSQLDatabaseExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "charset", "UTF8"), + resource.TestCheckResourceAttr(resourceName, "collation", "English_United States.1252"), + ), + }, + }, + }) +} +func TestAccAzureRMPostgreSQLDatabase_charsetLowercase(t *testing.T) { + resourceName := "azurerm_postgresql_database.test" + ri := acctest.RandInt() + config := testAccAzureRMPostgreSQLDatabase_charsetLowercase(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLDatabaseDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLDatabaseExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "charset", "UTF8"), + resource.TestCheckResourceAttr(resourceName, "collation", "English_United States.1252"), + ), + }, + }, + }) +} + +func TestAccAzureRMPostgreSQLDatabase_charsetMixedcase(t *testing.T) { + resourceName := "azurerm_postgresql_database.test" + ri := acctest.RandInt() + config := testAccAzureRMPostgreSQLDatabase_charsetMixedcase(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLDatabaseDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLDatabaseExists(resourceName), resource.TestCheckResourceAttr(resourceName, "charset", "UTF8"), resource.TestCheckResourceAttr(resourceName, "collation", "English_United States.1252"), ), @@ -105,15 +148,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "9.6" - storage_mb = 51200 ssl_enforcement = "Enabled" } @@ -126,3 +175,85 @@ resource "azurerm_postgresql_database" "test" { } `, rInt, location, rInt, rInt) } + +func testAccAzureRMPostgreSQLDatabase_charsetLowercase(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_postgresql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "B_Gen4_2" + capacity = 2 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "9.6" + ssl_enforcement = "Enabled" +} + +resource "azurerm_postgresql_database" "test" { + name = "acctestdb_%d" + resource_group_name = "${azurerm_resource_group.test.name}" + server_name = "${azurerm_postgresql_server.test.name}" + charset = "utf8" + collation = "English_United States.1252" +} +`, rInt, location, rInt, rInt) +} + +func testAccAzureRMPostgreSQLDatabase_charsetMixedcase(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_postgresql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "B_Gen4_2" + capacity = 2 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "9.6" + ssl_enforcement = "Enabled" +} + +resource "azurerm_postgresql_database" "test" { + name = "acctestdb_%d" + resource_group_name = "${azurerm_resource_group.test.name}" + server_name = "${azurerm_postgresql_server.test.name}" + charset = "Utf8" + collation = "English_United States.1252" +} +`, rInt, location, rInt, rInt) +} diff --git a/azurerm/resource_arm_postgresql_firewall_rule.go b/azurerm/resource_arm_postgresql_firewall_rule.go index 8e93fb4c65c70..2b06c3426360a 100644 --- a/azurerm/resource_arm_postgresql_firewall_rule.go +++ b/azurerm/resource_arm_postgresql_firewall_rule.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_postgresql_firewall_rule_test.go b/azurerm/resource_arm_postgresql_firewall_rule_test.go index a7dce5b184d73..57e279e00ca37 100644 --- a/azurerm/resource_arm_postgresql_firewall_rule_test.go +++ b/azurerm/resource_arm_postgresql_firewall_rule_test.go @@ -105,15 +105,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "9.6" - storage_mb = 51200 ssl_enforcement = "Enabled" } diff --git a/azurerm/resource_arm_postgresql_server.go b/azurerm/resource_arm_postgresql_server.go index f4dc7ed0b37cb..832157e3b6d80 100644 --- a/azurerm/resource_arm_postgresql_server.go +++ b/azurerm/resource_arm_postgresql_server.go @@ -3,9 +3,9 @@ package azurerm import ( "fmt" "log" - "strconv" + "strings" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" @@ -34,7 +34,7 @@ func resourceArmPostgreSQLServer() *schema.Resource { "resource_group_name": resourceGroupNameSchema(), "sku": { - Type: schema.TypeSet, + Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ @@ -43,12 +43,24 @@ func resourceArmPostgreSQLServer() *schema.Resource { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - "PGSQLB50", - "PGSQLB100", - "PGSQLS100", - "PGSQLS200", - "PGSQLS400", - "PGSQLS800", + "B_Gen4_1", + "B_Gen4_2", + "B_Gen5_1", + "B_Gen5_2", + "GP_Gen4_2", + "GP_Gen4_4", + "GP_Gen4_8", + "GP_Gen4_16", + "GP_Gen4_32", + "GP_Gen5_2", + "GP_Gen5_4", + "GP_Gen5_8", + "GP_Gen5_16", + "GP_Gen5_32", + "MO_Gen5_2", + "MO_Gen5_4", + "MO_Gen5_8", + "MO_Gen5_16", }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, @@ -57,20 +69,34 @@ func resourceArmPostgreSQLServer() *schema.Resource { Type: schema.TypeInt, Required: true, ValidateFunc: validateIntInSlice([]int{ - 50, - 100, - 200, - 400, - 800, + 1, + 2, + 4, + 8, + 16, + 32, }), }, "tier": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(postgresql.Basic), - string(postgresql.Standard), + string(postgresql.GeneralPurpose), + string(postgresql.MemoryOptimized), + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + + "family": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "Gen4", + "Gen5", }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, @@ -93,39 +119,46 @@ func resourceArmPostgreSQLServer() *schema.Resource { "version": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(postgresql.NineFullStopFive), string(postgresql.NineFullStopSix), + // TODO: Swap for the azure go api enum once supported. + "10.0", }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, - ForceNew: true, }, - "storage_mb": { - Type: schema.TypeInt, + "storage_profile": { + Type: schema.TypeList, Required: true, - ForceNew: true, - ValidateFunc: validateIntInSlice([]int{ - // Basic SKU - 51200, - 179200, - 307200, - 435200, - 563200, - 691200, - 819200, - 947200, - - // Standard SKU - 128000, - 256000, - 384000, - 512000, - 640000, - 768000, - 896000, - 1024000, - }), + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_mb": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validateIntBetweenDivisibleBy(5120, 4194304, 1024), + }, + + "backup_retention_days": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(7, 35), + }, + + "geo_redundant_backup": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "Enabled", + "Disabled", + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + }, + }, }, "ssl_enforcement": { @@ -145,6 +178,18 @@ func resourceArmPostgreSQLServer() *schema.Resource { "tags": tagsSchema(), }, + + CustomizeDiff: func(diff *schema.ResourceDiff, v interface{}) error { + + tier, _ := diff.GetOk("sku.0.tier") + storageMB, _ := diff.GetOk("storage_profile.0.storage_mb") + + if strings.ToLower(tier.(string)) == "basic" && storageMB.(int) > 1048576 { + return fmt.Errorf("basic pricing tier only supports upto 1,048,576 MB (1TB) of storage") + } + + return nil + }, } } @@ -156,48 +201,49 @@ func resourceArmPostgreSQLServerCreate(d *schema.ResourceData, meta interface{}) name := d.Get("name").(string) location := azureRMNormalizeLocation(d.Get("location").(string)) - resGroup := d.Get("resource_group_name").(string) + resourceGroup := d.Get("resource_group_name").(string) adminLogin := d.Get("administrator_login").(string) adminLoginPassword := d.Get("administrator_login_password").(string) sslEnforcement := d.Get("ssl_enforcement").(string) version := d.Get("version").(string) - storageMB := d.Get("storage_mb").(int) - + createMode := "Default" tags := d.Get("tags").(map[string]interface{}) - sku := expandAzureRmPostgreSQLServerSku(d, storageMB) + sku := expandAzureRmPostgreSQLServerSku(d) + storageProfile := expandAzureRmPostgreSQLStorageProfile(d) properties := postgresql.ServerForCreate{ Location: &location, - Sku: sku, Properties: &postgresql.ServerPropertiesForDefaultCreate{ - Version: postgresql.ServerVersion(version), - StorageMB: utils.Int64(int64(storageMB)), - SslEnforcement: postgresql.SslEnforcementEnum(sslEnforcement), AdministratorLogin: utils.String(adminLogin), AdministratorLoginPassword: utils.String(adminLoginPassword), - CreateMode: postgresql.CreateModeDefault, + Version: postgresql.ServerVersion(version), + SslEnforcement: postgresql.SslEnforcementEnum(sslEnforcement), + StorageProfile: storageProfile, + CreateMode: postgresql.CreateMode(createMode), }, + Sku: sku, Tags: expandTags(tags), } - future, err := client.Create(ctx, resGroup, name, properties) + future, err := client.Create(ctx, resourceGroup, name, properties) if err != nil { - return err + return fmt.Errorf("Error creating PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) if err != nil { - return err + return fmt.Errorf("Error waiting for creation of PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - read, err := client.Get(ctx, resGroup, name) + read, err := client.Get(ctx, resourceGroup, name) if err != nil { - return err + return fmt.Errorf("Error retrieving PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } + if read.ID == nil { - return fmt.Errorf("Cannot read PostgreSQL Server %s (resource group %s) ID", name, resGroup) + return fmt.Errorf("Cannot read PostgreSQL Server %q (Resource Group %q) ID", name, resourceGroup) } d.SetId(*read.ID) @@ -212,43 +258,43 @@ func resourceArmPostgreSQLServerUpdate(d *schema.ResourceData, meta interface{}) log.Printf("[INFO] preparing arguments for AzureRM PostgreSQL Server update.") name := d.Get("name").(string) - resGroup := d.Get("resource_group_name").(string) + resourceGroup := d.Get("resource_group_name").(string) adminLoginPassword := d.Get("administrator_login_password").(string) sslEnforcement := d.Get("ssl_enforcement").(string) version := d.Get("version").(string) - storageMB := d.Get("storage_mb").(int) - sku := expandAzureRmPostgreSQLServerSku(d, storageMB) - + sku := expandAzureRmPostgreSQLServerSku(d) + storageProfile := expandAzureRmPostgreSQLStorageProfile(d) tags := d.Get("tags").(map[string]interface{}) properties := postgresql.ServerUpdateParameters{ - Sku: sku, ServerUpdateParametersProperties: &postgresql.ServerUpdateParametersProperties{ - SslEnforcement: postgresql.SslEnforcementEnum(sslEnforcement), - StorageMB: utils.Int64(int64(storageMB)), - Version: postgresql.ServerVersion(version), + StorageProfile: storageProfile, AdministratorLoginPassword: utils.String(adminLoginPassword), + Version: postgresql.ServerVersion(version), + SslEnforcement: postgresql.SslEnforcementEnum(sslEnforcement), }, + Sku: sku, Tags: expandTags(tags), } - future, err := client.Update(ctx, resGroup, name, properties) + future, err := client.Update(ctx, resourceGroup, name, properties) if err != nil { - return err + return fmt.Errorf("Error updating PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) if err != nil { - return err + return fmt.Errorf("Error waiting for update of PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - read, err := client.Get(ctx, resGroup, name) + read, err := client.Get(ctx, resourceGroup, name) if err != nil { - return err + return fmt.Errorf("Error retrieving PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } + if read.ID == nil { - return fmt.Errorf("Cannot read PostgreSQL Server %s (resource group %s) ID", name, resGroup) + return fmt.Errorf("Cannot read PostgreSQL Server %s (resource group %s) ID", name, resourceGroup) } d.SetId(*read.ID) @@ -264,31 +310,38 @@ func resourceArmPostgreSQLServerRead(d *schema.ResourceData, meta interface{}) e if err != nil { return err } - resGroup := id.ResourceGroup + resourceGroup := id.ResourceGroup name := id.Path["servers"] - resp, err := client.Get(ctx, resGroup, name) + resp, err := client.Get(ctx, resourceGroup, name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[WARN] PostgreSQL Server '%s' was not found (resource group '%s')", name, resGroup) + log.Printf("[WARN] PostgreSQL Server %q was not found (resource group %q)", name, resourceGroup) d.SetId("") return nil } - return fmt.Errorf("Error making Read request on Azure PostgreSQL Server %s: %+v", name, err) + return fmt.Errorf("Error making Read request on Azure PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } d.Set("name", resp.Name) - d.Set("resource_group_name", resGroup) + d.Set("resource_group_name", resourceGroup) + if location := resp.Location; location != nil { d.Set("location", azureRMNormalizeLocation(*location)) } d.Set("administrator_login", resp.AdministratorLogin) d.Set("version", string(resp.Version)) - d.Set("storage_mb", int(*resp.StorageMB)) d.Set("ssl_enforcement", string(resp.SslEnforcement)) - d.Set("sku", flattenPostgreSQLServerSku(resp.Sku)) + + if err := d.Set("sku", flattenPostgreSQLServerSku(resp.Sku)); err != nil { + return fmt.Errorf("Error flattening `sku`: %+v", err) + } + + if err := d.Set("storage_profile", flattenPostgreSQLStorageProfile(resp.StorageProfile)); err != nil { + return fmt.Errorf("Error flattening `storage_profile`: %+v", err) + } flattenAndSetTags(d, resp.Tags) @@ -306,15 +359,16 @@ func resourceArmPostgreSQLServerDelete(d *schema.ResourceData, meta interface{}) if err != nil { return err } - resGroup := id.ResourceGroup + resourceGroup := id.ResourceGroup name := id.Path["servers"] - future, err := client.Delete(ctx, resGroup, name) + future, err := client.Delete(ctx, resourceGroup, name) if err != nil { if response.WasNotFound(future.Response()) { return nil } - return err + + return fmt.Errorf("Error deleting PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } err = future.WaitForCompletion(ctx, client.Client) @@ -322,35 +376,77 @@ func resourceArmPostgreSQLServerDelete(d *schema.ResourceData, meta interface{}) if response.WasNotFound(future.Response()) { return nil } - return err + + return fmt.Errorf("Error waiting for deletion of PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } return nil } -func expandAzureRmPostgreSQLServerSku(d *schema.ResourceData, storageMB int) *postgresql.Sku { - skus := d.Get("sku").(*schema.Set).List() +func expandAzureRmPostgreSQLServerSku(d *schema.ResourceData) *postgresql.Sku { + skus := d.Get("sku").([]interface{}) sku := skus[0].(map[string]interface{}) name := sku["name"].(string) capacity := sku["capacity"].(int) tier := sku["tier"].(string) + family := sku["family"].(string) return &postgresql.Sku{ Name: utils.String(name), - Capacity: utils.Int32(int32(capacity)), Tier: postgresql.SkuTier(tier), - Size: utils.String(strconv.Itoa(storageMB)), + Capacity: utils.Int32(int32(capacity)), + Family: utils.String(family), + } +} + +func expandAzureRmPostgreSQLStorageProfile(d *schema.ResourceData) *postgresql.StorageProfile { + storageprofiles := d.Get("storage_profile").([]interface{}) + storageprofile := storageprofiles[0].(map[string]interface{}) + + backupRetentionDays := storageprofile["backup_retention_days"].(int) + geoRedundantBackup := storageprofile["geo_redundant_backup"].(string) + storageMB := storageprofile["storage_mb"].(int) + + return &postgresql.StorageProfile{ + BackupRetentionDays: utils.Int32(int32(backupRetentionDays)), + GeoRedundantBackup: postgresql.GeoRedundantBackup(geoRedundantBackup), + StorageMB: utils.Int32(int32(storageMB)), } } func flattenPostgreSQLServerSku(resp *postgresql.Sku) []interface{} { values := map[string]interface{}{} - values["name"] = *resp.Name - values["capacity"] = int(*resp.Capacity) + if name := resp.Name; name != nil { + values["name"] = *name + } + + if capacity := resp.Capacity; capacity != nil { + values["capacity"] = *capacity + } + values["tier"] = string(resp.Tier) - sku := []interface{}{values} - return sku + if family := resp.Family; family != nil { + values["family"] = *family + } + + return []interface{}{values} +} + +func flattenPostgreSQLStorageProfile(resp *postgresql.StorageProfile) []interface{} { + values := map[string]interface{}{} + + if storageMB := resp.StorageMB; storageMB != nil { + values["storage_mb"] = *storageMB + } + + if backupRetentionDays := resp.BackupRetentionDays; backupRetentionDays != nil { + values["backup_retention_days"] = *backupRetentionDays + } + + values["geo_redundant_backup"] = postgresql.GeoRedundantBackup(resp.GeoRedundantBackup) + + return []interface{}{values} } diff --git a/azurerm/resource_arm_postgresql_server_test.go b/azurerm/resource_arm_postgresql_server_test.go index 75b36592547ee..0d254d43e8413 100644 --- a/azurerm/resource_arm_postgresql_server_test.go +++ b/azurerm/resource_arm_postgresql_server_test.go @@ -26,7 +26,6 @@ func TestAccAzureRMPostgreSQLServer_basicNinePointFive(t *testing.T) { testCheckAzureRMPostgreSQLServerExists(resourceName), resource.TestCheckResourceAttr(resourceName, "administrator_login", "acctestun"), resource.TestCheckResourceAttr(resourceName, "version", "9.5"), - resource.TestCheckResourceAttr(resourceName, "storage_mb", "51200"), resource.TestCheckResourceAttr(resourceName, "ssl_enforcement", "Enabled"), ), }, @@ -50,7 +49,28 @@ func TestAccAzureRMPostgreSQLServer_basicNinePointSix(t *testing.T) { testCheckAzureRMPostgreSQLServerExists(resourceName), resource.TestCheckResourceAttr(resourceName, "administrator_login", "acctestun"), resource.TestCheckResourceAttr(resourceName, "version", "9.6"), - resource.TestCheckResourceAttr(resourceName, "storage_mb", "51200"), + resource.TestCheckResourceAttr(resourceName, "ssl_enforcement", "Enabled"), + ), + }, + }, + }) +} + +func TestAccAzureRMPostgreSQLServer_basicTenPointZero(t *testing.T) { + resourceName := "azurerm_postgresql_server.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMPostgreSQLServer_basicTenPointZero(ri, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLServerExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "administrator_login", "acctestun"), + resource.TestCheckResourceAttr(resourceName, "version", "10.0"), resource.TestCheckResourceAttr(resourceName, "ssl_enforcement", "Enabled"), ), }, @@ -74,7 +94,6 @@ func TestAccAzureRMPostgreSQLServer_basicMaxStorage(t *testing.T) { testCheckAzureRMPostgreSQLServerExists(resourceName), resource.TestCheckResourceAttr(resourceName, "administrator_login", "acctestun"), resource.TestCheckResourceAttr(resourceName, "version", "9.6"), - resource.TestCheckResourceAttr(resourceName, "storage_mb", "947200"), resource.TestCheckResourceAttr(resourceName, "ssl_enforcement", "Enabled"), ), }, @@ -82,10 +101,30 @@ func TestAccAzureRMPostgreSQLServer_basicMaxStorage(t *testing.T) { }) } -func TestAccAzureRMPostgreSQLServer_standard(t *testing.T) { +func TestAccAzureRMPostgreSQLServer_generalPurpose(t *testing.T) { + resourceName := "azurerm_postgresql_server.test" + ri := acctest.RandInt() + config := testAccAzureRMPostgreSQLServer_generalPurpose(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLServerExists(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMPostgreSQLServer_memoryOptimized(t *testing.T) { resourceName := "azurerm_postgresql_server.test" ri := acctest.RandInt() - config := testAccAzureRMPostgreSQLServer_standard(ri, testLocation()) + config := testAccAzureRMPostgreSQLServer_memoryOptimized(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -107,7 +146,35 @@ func TestAccAzureRMPostgreSQLServer_updatePassword(t *testing.T) { ri := acctest.RandInt() location := testLocation() config := testAccAzureRMPostgreSQLServer_basicNinePointSix(ri, location) - updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdated(ri, location) + updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(ri, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPostgreSQLServerDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLServerExists(resourceName), + ), + }, + { + Config: updatedConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPostgreSQLServerExists(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMPostgreSQLServer_updateSKU(t *testing.T) { + resourceName := "azurerm_postgresql_server.test" + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMPostgreSQLServer_basicNinePointSix(ri, location) + updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedSKU(ri, location) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -201,15 +268,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "9.5" - storage_mb = 51200 ssl_enforcement = "Enabled" } `, rInt, location, rInt) @@ -228,21 +301,60 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "9.6" - storage_mb = 51200 ssl_enforcement = "Enabled" } `, rInt, location, rInt) } -func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdated(rInt int, location string) string { +func testAccAzureRMPostgreSQLServer_basicTenPointZero(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_postgresql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "B_Gen4_2" + capacity = 2 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "10.0" + ssl_enforcement = "Enabled" +} +`, rInt, location, rInt) +} + +func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -255,21 +367,60 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "R3dH0TCh1l1P3pp3rs!" version = "9.6" - storage_mb = 51200 ssl_enforcement = "Disabled" } `, rInt, location, rInt) } +func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedSKU(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_postgresql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "B_Gen4_1" + capacity = 1 + tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 51200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "9.6" + ssl_enforcement = "Enabled" +} +`, rInt, location, rInt) +} + func testAccAzureRMPostgreSQLServer_basicMaxStorage(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { @@ -283,21 +434,60 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 947200 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" + } + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + version = "9.6" + ssl_enforcement = "Enabled" +} +`, rInt, location, rInt) +} + +func testAccAzureRMPostgreSQLServer_generalPurpose(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_postgresql_server" "test" { + name = "acctestpsqlsvr-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + name = "GP_Gen5_32" + capacity = 32 + tier = "GeneralPurpose" + family = "Gen5" + } + + storage_profile { + storage_mb = 640000 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "9.6" - storage_mb = 947200 ssl_enforcement = "Enabled" } `, rInt, location, rInt) } -func testAccAzureRMPostgreSQLServer_standard(rInt int, location string) string { +func testAccAzureRMPostgreSQLServer_memoryOptimized(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -310,15 +500,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLS400" - capacity = 400 - tier = "Standard" + name = "MO_Gen5_16" + capacity = 16 + tier = "MemoryOptimized" + family = "Gen5" + } + + storage_profile { + storage_mb = 4194304 + backup_retention_days = 7 + geo_redundant_backup = "Enabled" } administrator_login = "acctestun" administrator_login_password = "H@Sh1CoR3!" version = "9.6" - storage_mb = 640000 ssl_enforcement = "Enabled" } `, rInt, location, rInt) diff --git a/azurerm/resource_arm_public_ip.go b/azurerm/resource_arm_public_ip.go index 9f9a9e34bf154..465248d6e4f45 100644 --- a/azurerm/resource_arm_public_ip.go +++ b/azurerm/resource_arm_public_ip.go @@ -6,7 +6,7 @@ import ( "regexp" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -46,6 +46,7 @@ func resourceArmPublicIp() *schema.Resource { "zones": singleZonesSchema(), + //should this perhaps be allocation_method? "public_ip_address_allocation": { Type: schema.TypeString, Required: true, @@ -128,18 +129,18 @@ func resourceArmPublicIpCreate(d *schema.ResourceData, meta interface{}) error { PublicIPAllocationMethod: ipAllocationMethod, } - dnl, hasDnl := d.GetOk("domain_name_label") - rfqdn, hasRfqdn := d.GetOk("reverse_fqdn") + dnl, dnlOk := d.GetOk("domain_name_label") + rfqdn, rfqdnOk := d.GetOk("reverse_fqdn") - if hasDnl || hasRfqdn { + if dnlOk || rfqdnOk { dnsSettings := network.PublicIPAddressDNSSettings{} - if hasRfqdn { + if rfqdnOk { reverseFqdn := rfqdn.(string) dnsSettings.ReverseFqdn = &reverseFqdn } - if hasDnl { + if dnlOk { domainNameLabel := dnl.(string) dnsSettings.DomainNameLabel = &domainNameLabel } @@ -148,8 +149,7 @@ func resourceArmPublicIpCreate(d *schema.ResourceData, meta interface{}) error { } if v, ok := d.GetOk("idle_timeout_in_minutes"); ok { - idleTimeout := int32(v.(int)) - properties.IdleTimeoutInMinutes = &idleTimeout + properties.IdleTimeoutInMinutes = utils.Int32(int32(v.(int))) } publicIp := network.PublicIPAddress{ @@ -227,6 +227,8 @@ func resourceArmPublicIpRead(d *schema.ResourceData, meta interface{}) error { } else { d.Set("fqdn", "") } + + d.Set("domain_name_label", settings.DomainNameLabel) } if ip := props.IPAddress; ip != nil { diff --git a/azurerm/resource_arm_public_ip_test.go b/azurerm/resource_arm_public_ip_test.go index 54765e0d536f2..54315ce633ad5 100644 --- a/azurerm/resource_arm_public_ip_test.go +++ b/azurerm/resource_arm_public_ip_test.go @@ -64,6 +64,30 @@ func TestAccAzureRMPublicIpStatic_basic(t *testing.T) { }) } +func TestAccAzureRMPublicIpStatic_basic_withDNSLabel(t *testing.T) { + resourceName := "azurerm_public_ip.test" + ri := acctest.RandInt() + dnl := fmt.Sprintf("acctestdnl-%d", ri) + config := testAccAzureRMPublicIPStatic_basic_withDNSLabel(ri, testLocation(), dnl) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMPublicIpDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMPublicIpExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "ip_address"), + resource.TestCheckResourceAttr(resourceName, "public_ip_address_allocation", "static"), + resource.TestCheckResourceAttr(resourceName, "domain_name_label", dnl), + ), + }, + }, + }) +} + func TestAccAzureRMPublicIpStatic_standard(t *testing.T) { ri := acctest.RandInt() config := testAccAzureRMPublicIPStatic_standard(ri, testLocation()) @@ -296,14 +320,15 @@ func testCheckAzureRMPublicIpDestroy(s *terraform.State) error { func testAccAzureRMPublicIPStatic_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_public_ip" "test" { - name = "acctestpublicip-%d" - location = "${azurerm_resource_group.test.location}" + name = "acctestpublicip-%d" + location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "static" } `, rInt, location, rInt) @@ -312,20 +337,39 @@ resource "azurerm_public_ip" "test" { func testAccAzureRMPublicIPStatic_basic_withZone(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_public_ip" "test" { - name = "acctestpublicip-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" + name = "acctestpublicip-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" public_ip_address_allocation = "static" + zones = ["1"] } `, rInt, location, rInt) } +func testAccAzureRMPublicIPStatic_basic_withDNSLabel(rInt int, location, dnsNameLabel string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_public_ip" "test" { + name = "acctestpublicip-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "static" + + domain_name_label = "%s" +} +`, rInt, location, rInt, dnsNameLabel) +} + func testAccAzureRMPublicIPStatic_standard(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/azurerm/resource_arm_role_assignment.go b/azurerm/resource_arm_role_assignment.go index 34fce15b56233..113c57dd04deb 100644 --- a/azurerm/resource_arm_role_assignment.go +++ b/azurerm/resource_arm_role_assignment.go @@ -5,7 +5,7 @@ import ( "log" "strings" - "github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization" + "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization" "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -99,7 +99,7 @@ func resourceArmRoleAssignmentCreate(d *schema.ResourceData, meta interface{}) e } properties := authorization.RoleAssignmentCreateParameters{ - Properties: &authorization.RoleAssignmentProperties{ + RoleAssignmentProperties: &authorization.RoleAssignmentProperties{ RoleDefinitionID: utils.String(roleDefinitionId), PrincipalID: utils.String(principalId), }, @@ -139,7 +139,7 @@ func resourceArmRoleAssignmentRead(d *schema.ResourceData, meta interface{}) err d.Set("name", resp.Name) - if props := resp.Properties; props != nil { + if props := resp.RoleAssignmentPropertiesWithScope; props != nil { d.Set("scope", props.Scope) d.Set("role_definition_id", props.RoleDefinitionID) d.Set("principal_id", props.PrincipalID) diff --git a/azurerm/resource_arm_role_assignment_test.go b/azurerm/resource_arm_role_assignment_test.go index c031b2d54b5c6..0b8fc4ebbd22a 100644 --- a/azurerm/resource_arm_role_assignment_test.go +++ b/azurerm/resource_arm_role_assignment_test.go @@ -16,10 +16,11 @@ func TestAccAzureRMRoleAssignment(t *testing.T) { // Azure only being happy about provisioning a couple at a time testCases := map[string]map[string]func(t *testing.T){ "basic": { - "emptyName": testAccAzureRMRoleAssignment_emptyName, - "roleName": testAccAzureRMRoleAssignment_roleName, - "builtin": testAccAzureRMRoleAssignment_builtin, - "custom": testAccAzureRMRoleAssignment_custom, + "emptyName": testAccAzureRMRoleAssignment_emptyName, + "roleName": testAccAzureRMRoleAssignment_roleName, + "dataActions": testAccAzureRMRoleAssignment_dataActions, + "builtin": testAccAzureRMRoleAssignment_builtin, + "custom": testAccAzureRMRoleAssignment_custom, }, "import": { "basic": testAccAzureRMRoleAssignment_importBasic, @@ -81,6 +82,27 @@ func testAccAzureRMRoleAssignment_roleName(t *testing.T) { }) } +func testAccAzureRMRoleAssignment_dataActions(t *testing.T) { + id := uuid.New().String() + resourceName := "azurerm_role_assignment.test" + config := testAccAzureRMRoleAssignment_dataActionsConfig(id) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMRoleAssignmentDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMRoleAssignmentExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "role_definition_id"), + ), + }, + }, + }) +} + func testAccAzureRMRoleAssignment_builtin(t *testing.T) { id := uuid.New().String() config := testAccAzureRMRoleAssignment_builtinConfig(id) @@ -180,7 +202,7 @@ data "azurerm_subscription" "primary" {} data "azurerm_client_config" "test" {} data "azurerm_builtin_role_definition" "test" { - name = "Reader" + name = "Monitoring Reader" } resource "azurerm_role_assignment" "test" { @@ -200,7 +222,22 @@ data "azurerm_client_config" "test" {} resource "azurerm_role_assignment" "test" { name = "%s" scope = "${data.azurerm_subscription.primary.id}" - role_definition_name = "Reader" + role_definition_name = "Log Analytics Reader" + principal_id = "${data.azurerm_client_config.test.service_principal_object_id}" +} +`, id) +} + +func testAccAzureRMRoleAssignment_dataActionsConfig(id string) string { + return fmt.Sprintf(` +data "azurerm_subscription" "primary" {} + +data "azurerm_client_config" "test" {} + +resource "azurerm_role_assignment" "test" { + name = "%s" + scope = "${data.azurerm_subscription.primary.id}" + role_definition_name = "Virtual Machine User Login" principal_id = "${data.azurerm_client_config.test.service_principal_object_id}" } `, id) @@ -213,7 +250,7 @@ data "azurerm_subscription" "primary" {} data "azurerm_client_config" "test" {} data "azurerm_builtin_role_definition" "test" { - name = "Reader" + name = "Site Recovery Reader" } resource "azurerm_role_assignment" "test" { diff --git a/azurerm/resource_arm_role_definition.go b/azurerm/resource_arm_role_definition.go index f5386d9d6101f..8584f7e412a38 100644 --- a/azurerm/resource_arm_role_definition.go +++ b/azurerm/resource_arm_role_definition.go @@ -2,10 +2,10 @@ package azurerm import ( "fmt" - "log" - "github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization" + "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization" + "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -23,7 +23,8 @@ func resourceArmRoleDefinition() *schema.Resource { Schema: map[string]*schema.Schema{ "role_definition_id": { Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, ForceNew: true, }, @@ -82,6 +83,15 @@ func resourceArmRoleDefinitionCreateUpdate(d *schema.ResourceData, meta interfac ctx := meta.(*ArmClient).StopContext roleDefinitionId := d.Get("role_definition_id").(string) + if roleDefinitionId == "" { + uuid, err := uuid.GenerateUUID() + if err != nil { + return fmt.Errorf("Error generating UUID for Role Assignment: %+v", err) + } + + roleDefinitionId = uuid + } + name := d.Get("name").(string) scope := d.Get("scope").(string) description := d.Get("description").(string) @@ -90,10 +100,10 @@ func resourceArmRoleDefinitionCreateUpdate(d *schema.ResourceData, meta interfac assignableScopes := expandRoleDefinitionAssignableScopes(d) properties := authorization.RoleDefinition{ - Properties: &authorization.RoleDefinitionProperties{ + RoleDefinitionProperties: &authorization.RoleDefinitionProperties{ RoleName: utils.String(name), Description: utils.String(description), - Type: utils.String(roleType), + RoleType: utils.String(roleType), Permissions: &permissions, AssignableScopes: &assignableScopes, }, @@ -131,7 +141,7 @@ func resourceArmRoleDefinitionRead(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Error loading Role Definition %q: %+v", d.Id(), err) } - if props := resp.Properties; props != nil { + if props := resp.RoleDefinitionProperties; props != nil { d.Set("name", props.RoleName) d.Set("description", props.Description) diff --git a/azurerm/resource_arm_role_definition_test.go b/azurerm/resource_arm_role_definition_test.go index 5186e4580aa33..3c72499a6f0a4 100644 --- a/azurerm/resource_arm_role_definition_test.go +++ b/azurerm/resource_arm_role_definition_test.go @@ -87,6 +87,28 @@ func TestAccAzureRMRoleDefinition_update(t *testing.T) { }) } +func TestAccAzureRMRoleDefinition_emptyName(t *testing.T) { + resourceName := "azurerm_role_definition.test" + + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMRoleDefinitionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMRoleDefinition_emptyId(ri), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMRoleDefinitionExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "id"), + resource.TestCheckResourceAttrSet(resourceName, "name"), + ), + }, + }, + }) +} + func testCheckAzureRMRoleDefinitionExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -201,3 +223,23 @@ resource "azurerm_role_definition" "test" { } `, id, rInt) } + +func testAccAzureRMRoleDefinition_emptyId(rInt int) string { + return fmt.Sprintf(` +data "azurerm_subscription" "primary" {} + +resource "azurerm_role_definition" "test" { + name = "acctestrd-%d" + scope = "${data.azurerm_subscription.primary.id}" + + permissions { + actions = ["*"] + not_actions = [] + } + + assignable_scopes = [ + "${data.azurerm_subscription.primary.id}", + ] +} +`, rInt) +} diff --git a/azurerm/resource_arm_route.go b/azurerm/resource_arm_route.go index 8e67fe15d5441..9105280fa9de7 100644 --- a/azurerm/resource_arm_route.go +++ b/azurerm/resource_arm_route.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_route_table.go b/azurerm/resource_arm_route_table.go index 9d550c756c692..763a215ae7d3b 100644 --- a/azurerm/resource_arm_route_table.go +++ b/azurerm/resource_arm_route_table.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" @@ -19,15 +19,17 @@ func resourceArmRouteTable() *schema.Resource { Read: resourceArmRouteTableRead, Update: resourceArmRouteTableCreate, Delete: resourceArmRouteTableDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.NoZeroValues, }, "location": locationSchema(), @@ -41,13 +43,15 @@ func resourceArmRouteTable() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, }, "address_prefix": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, }, "next_hop_type": { @@ -64,14 +68,21 @@ func resourceArmRouteTable() *schema.Resource { }, "next_hop_in_ip_address": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.NoZeroValues, }, }, }, }, + "disable_bgp_route_propagation": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "subnets": { Type: schema.TypeSet, Computed: true, @@ -105,6 +116,7 @@ func resourceArmRouteTableCreate(d *schema.ResourceData, meta interface{}) error Location: &location, RouteTablePropertiesFormat: &network.RouteTablePropertiesFormat{ Routes: &routes, + DisableBgpRoutePropagation: utils.Bool(d.Get("disable_bgp_route_propagation").(bool)), }, Tags: expandTags(tags), } @@ -159,6 +171,7 @@ func resourceArmRouteTableRead(d *schema.ResourceData, meta interface{}) error { } if props := resp.RouteTablePropertiesFormat; props != nil { + d.Set("disable_bgp_route_propagation", props.DisableBgpRoutePropagation) if err := d.Set("route", flattenRouteTableRoutes(props.Routes)); err != nil { return err } diff --git a/azurerm/resource_arm_route_table_test.go b/azurerm/resource_arm_route_table_test.go index c21e4a22c59f5..47d0ceca7578c 100644 --- a/azurerm/resource_arm_route_table_test.go +++ b/azurerm/resource_arm_route_table_test.go @@ -12,8 +12,8 @@ import ( ) func TestAccAzureRMRouteTable_basic(t *testing.T) { + resourceName := "azurerm_route_table.test" ri := acctest.RandInt() - config := testAccAzureRMRouteTable_basic(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -21,9 +21,61 @@ func TestAccAzureRMRouteTable_basic(t *testing.T) { CheckDestroy: testCheckAzureRMRouteTableDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccAzureRMRouteTable_basic(ri, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMRouteTableExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "disable_bgp_route_propagation", "false"), + resource.TestCheckResourceAttr(resourceName, "route.#", "0"), + ), + }, + }, + }) +} + +func TestAccAzureRMRouteTable_complete(t *testing.T) { + resourceName := "azurerm_route_table.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMRouteTableDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMRouteTable_complete(ri, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMRouteTableExists("azurerm_route_table.test"), + resource.TestCheckResourceAttr(resourceName, "disable_bgp_route_propagation", "true"), + resource.TestCheckResourceAttr(resourceName, "route.#", "1"), + ), + }, + }, + }) +} + +func TestAccAzureRMRouteTable_update(t *testing.T) { + resourceName := "azurerm_route_table.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMRouteTableDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMRouteTable_basic(ri, testLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMRouteTableExists("azurerm_route_table.test"), + resource.TestCheckResourceAttr(resourceName, "disable_bgp_route_propagation", "false"), + resource.TestCheckResourceAttr(resourceName, "route.#", "0"), + ), + }, + { + Config: testAccAzureRMRouteTable_complete(ri, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMRouteTableExists("azurerm_route_table.test"), + resource.TestCheckResourceAttr(resourceName, "disable_bgp_route_propagation", "true"), + resource.TestCheckResourceAttr(resourceName, "route.#", "1"), ), }, }, @@ -292,18 +344,41 @@ func testCheckAzureRMRouteTableDestroy(s *terraform.State) error { func testAccAzureRMRouteTable_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_route_table" "test" { - name = "acctestrt%d" - location = "${azurerm_resource_group.test.location}" + name = "acctestrt%d" + location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } `, rInt, location, rInt) } +func testAccAzureRMRouteTable_complete(rInt int, location string) string { + return fmt.Sprintf(` +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 = "acctestRoute" + address_prefix = "10.1.0.0/16" + next_hop_type = "vnetlocal" + } + + disable_bgp_route_propagation = true +} +`, rInt, location, rInt) +} + func testAccAzureRMRouteTable_singleRoute(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { @@ -442,7 +517,7 @@ resource "azurerm_virtual_network" "test" { resource "azurerm_subnet" "subnet1" { name = "subnet1" - resource_group_name = "${azurerm_resource_group.test.name}" + resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.1.0/24" route_table_id = "${azurerm_route_table.test.id}" diff --git a/azurerm/resource_arm_scheduler_job.go b/azurerm/resource_arm_scheduler_job.go new file mode 100644 index 0000000000000..4ecc681215986 --- /dev/null +++ b/azurerm/resource_arm_scheduler_job.go @@ -0,0 +1,911 @@ +package azurerm + +import ( + "bytes" + "fmt" + "log" + "regexp" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler" + "github.com/Azure/go-autorest/autorest/date" + + "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/set" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmSchedulerJob() *schema.Resource { + return &schema.Resource{ + Create: resourceArmSchedulerJobCreateUpdate, + Read: resourceArmSchedulerJobRead, + Update: resourceArmSchedulerJobCreateUpdate, + Delete: resourceArmSchedulerJobDelete, + + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + CustomizeDiff: resourceArmSchedulerJobCustomizeDiff, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile("^[a-zA-Z][-_a-zA-Z0-9].*$"), + "Job Collection Name name must start with a letter and contain only letters, numbers, hyphens and underscores.", + ), + }, + + "resource_group_name": resourceGroupNameSchema(), + + "job_collection_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.NoZeroValues, + }, + + //actions + "action_web": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: resourceArmSchedulerJobActionWebSchema("action_web"), + }, + + //actions + "error_action_web": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: resourceArmSchedulerJobActionWebSchema("error_action_web"), + }, + + //retry policy + "retry": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + //silently fails if the duration is not in the correct format + //todo validation + "interval": { + Type: schema.TypeString, + Optional: true, + Default: "00:00:30", + ValidateFunc: validation.NoZeroValues, + }, + + "count": { + Type: schema.TypeInt, + Optional: true, + Default: 4, + ValidateFunc: validation.IntBetween(1, 20), + }, + }, + }, + }, + + //recurrences (schedule in portal, recurrence in API) + "recurrence": { + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "frequency": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: validation.StringInSlice([]string{ + string(scheduler.Minute), + string(scheduler.Hour), + string(scheduler.Day), + string(scheduler.Week), + string(scheduler.Month), + }, true), + }, + + "interval": { + Type: schema.TypeInt, + Optional: true, + Default: 1, //defaults to 1 in the portal + + //maximum is dynamic: 1 min <= interval * frequency <= 500 days (bounded by JobCollection quotas) + ValidateFunc: validation.IntAtLeast(1), + }, + + "count": { + Type: schema.TypeInt, + Optional: true, + //silently fails/produces odd results at >2147483647 + ValidateFunc: validation.IntBetween(1, 2147483647), + }, + + "end_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: suppress.RFC3339Time, + ValidateFunc: validate.RFC3339Time, + }, + + "minutes": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + ValidateFunc: validation.IntBetween(0, 59), + }, + Set: set.HashInt, + }, + + "hours": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + ValidateFunc: validation.IntBetween(0, 23), + }, + Set: set.HashInt, + }, + + "week_days": { //used with weekly + Type: schema.TypeSet, + Optional: true, + ConflictsWith: []string{"recurrence.0.month_days", "recurrence.0.monthly_occurrences"}, + // the constants are title cased but the API returns all lowercase + // so lets ignore the case + Set: set.HashStringIgnoreCase, + Elem: &schema.Schema{ + Type: schema.TypeString, + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: validation.StringInSlice([]string{ + string(scheduler.Sunday), + string(scheduler.Monday), + string(scheduler.Tuesday), + string(scheduler.Wednesday), + string(scheduler.Thursday), + string(scheduler.Friday), + string(scheduler.Saturday), + }, true), + }, + }, + + "month_days": { //used with monthly, + Type: schema.TypeSet, + Optional: true, + ConflictsWith: []string{"recurrence.0.week_days", "recurrence.0.monthly_occurrences"}, + MinItems: 1, + Elem: &schema.Schema{ + Type: schema.TypeInt, + ValidateFunc: validate.IntBetweenAndNot(-31, 31, 0), + }, + Set: set.HashInt, + }, + + "monthly_occurrences": { + Type: schema.TypeSet, + Optional: true, + ConflictsWith: []string{"recurrence.0.week_days", "recurrence.0.month_days"}, + MinItems: 1, + Set: resourceAzureRMSchedulerJobMonthlyOccurrenceHash, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "day": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: validation.StringInSlice([]string{ + string(scheduler.Sunday), + string(scheduler.Monday), + string(scheduler.Tuesday), + string(scheduler.Wednesday), + string(scheduler.Thursday), + string(scheduler.Friday), + string(scheduler.Saturday), + }, true), + }, + + "occurrence": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validate.IntBetweenAndNot(-5, 5, 0), + }, + }, + }, + }, + }, + }, + }, + + "start_time": { + Type: schema.TypeString, + Optional: true, + Computed: true, //defaults to now in create function + DiffSuppressFunc: suppress.RFC3339Time, + ValidateFunc: validate.RFC3339Time, //times in the past just start immediately + }, + + "state": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: validation.StringInSlice([]string{ + string(scheduler.JobStateEnabled), + string(scheduler.JobStateDisabled), + // JobStateFaulted & JobStateCompleted are also possible, but silly + }, true), + }, + }, + } +} + +func resourceArmSchedulerJobActionWebSchema(propertyName string) *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + // we can determine the type (HTTP/HTTPS) from the url + // but we need to make sure the url starts with http/https + // both so we can determine the type and as azure requires it + "url": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: validate.UrlIsHttpOrHttps(), + }, + + "method": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "Get", "Put", "Post", "Delete", + }, true), + }, + + //only valid/used when action type is put + "body": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.NoZeroValues, + }, + + "headers": { + Type: schema.TypeMap, + Optional: true, + }, + + //authentication requires HTTPS + "authentication_basic": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + ConflictsWith: []string{ + fmt.Sprintf("%s.0.authentication_certificate", propertyName), + fmt.Sprintf("%s.0.authentication_active_directory", propertyName), + }, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, + }, + + "password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.NoZeroValues, + }, + }, + }, + }, + + "authentication_certificate": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + ConflictsWith: []string{ + fmt.Sprintf("%s.0.authentication_basic", propertyName), + fmt.Sprintf("%s.0.authentication_active_directory", propertyName), + }, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "pfx": { + Type: schema.TypeString, + Required: true, + Sensitive: true, //sensitive & shortens diff + ValidateFunc: validation.NoZeroValues, + }, + + "password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.NoZeroValues, + }, + + "thumbprint": { + Type: schema.TypeString, + Computed: true, + }, + + "expiration": { + Type: schema.TypeString, + Computed: true, + }, + + "subject_name": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + + "authentication_active_directory": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + ConflictsWith: []string{ + fmt.Sprintf("%s.0.authentication_basic", propertyName), + fmt.Sprintf("%s.0.authentication_certificate", propertyName), + }, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tenant_id": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, + }, + + "client_id": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, + }, + "secret": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.NoZeroValues, + }, + + "audience": { + Type: schema.TypeString, + Optional: true, + Computed: true, //is defaulted to the ServiceManagementEndpoint in create + }, + }, + }, + }, + }, + } +} + +func resourceArmSchedulerJobCustomizeDiff(diff *schema.ResourceDiff, v interface{}) error { + + _, hasWeb := diff.GetOk("action_web") + if !hasWeb { + return fmt.Errorf("One of `action_web`, `action_servicebus` or `action_storagequeue` must be set") + } + + if b, ok := diff.GetOk("recurrence"); ok { + if recurrence, ok := b.([]interface{})[0].(map[string]interface{}); ok { + + //if neither count nor end time is set the API will silently fail + _, hasCount := recurrence["count"] + _, hasEnd := recurrence["end_time"] + if !hasCount && !hasEnd { + return fmt.Errorf("One of `count` or `end_time` must be set for the 'recurrence' block.") + } + } + } + + return nil +} + +func resourceArmSchedulerJobCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).schedulerJobsClient + ctx := meta.(*ArmClient).StopContext + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + jobCollection := d.Get("job_collection_name").(string) + + job := scheduler.JobDefinition{ + Properties: &scheduler.JobProperties{ + Action: expandAzureArmSchedulerJobAction(d, meta), + }, + } + + log.Printf("[DEBUG] Creating/updating Scheduler Job %q (resource group %q)", name, resourceGroup) + + //schedule (recurrence) + if b, ok := d.GetOk("recurrence"); ok { + job.Properties.Recurrence = expandAzureArmSchedulerJobRecurrence(b) + } + + //start time, should be validated by schema, also defaults to now if not set + if v, ok := d.GetOk("start_time"); ok { + startTime, _ := time.Parse(time.RFC3339, v.(string)) + job.Properties.StartTime = &date.Time{Time: startTime} + } else { + job.Properties.StartTime = &date.Time{Time: time.Now()} + } + + //state + if state, ok := d.GetOk("state"); ok { + job.Properties.State = scheduler.JobState(state.(string)) + } + + resp, err := client.CreateOrUpdate(ctx, resourceGroup, jobCollection, name, job) + if err != nil { + return fmt.Errorf("Error creating/updating Scheduler Job %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.SetId(*resp.ID) + + return resourceArmSchedulerJobRead(d, meta) +} + +func resourceArmSchedulerJobRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).schedulerJobsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + name := id.Path["jobs"] + resourceGroup := id.ResourceGroup + jobCollection := id.Path["jobCollections"] + + log.Printf("[DEBUG] Reading Scheduler Job %q (resource group %q)", name, resourceGroup) + + job, err := client.Get(ctx, resourceGroup, jobCollection, name) + if err != nil { + if utils.ResponseWasNotFound(job.Response) { + d.SetId("") + return nil + } + + return fmt.Errorf("Error making Read request on Scheduler Job %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + //standard properties + d.Set("name", name) + d.Set("resource_group_name", resourceGroup) + d.Set("job_collection_name", jobCollection) + + //check & get properties + properties := job.Properties + if properties != nil { + + //action + action := properties.Action + if action != nil { + actionType := strings.ToLower(string(action.Type)) + if strings.EqualFold(actionType, string(scheduler.HTTP)) || strings.EqualFold(actionType, string(scheduler.HTTPS)) { + if err := d.Set("action_web", flattenAzureArmSchedulerJobActionRequest(d, "action_web", action.Request)); err != nil { + return err + } + } + + //error action + if errorAction := action.ErrorAction; errorAction != nil { + if strings.EqualFold(actionType, string(scheduler.HTTP)) || strings.EqualFold(actionType, string(scheduler.HTTPS)) { + if err := d.Set("error_action_web", flattenAzureArmSchedulerJobActionRequest(d, "error_action_web", errorAction.Request)); err != nil { + return err + } + } + } + + //retry + if retry := action.RetryPolicy; retry != nil { + //if its not fixed we should not have a retry block + //api returns whatever casing it gets so do a case insensitive comparison + if strings.EqualFold(string(retry.RetryType), string(scheduler.Fixed)) { + if err := d.Set("retry", flattenAzureArmSchedulerJobActionRetry(retry)); err != nil { + return err + } + } + } + } + + //schedule + if recurrence := properties.Recurrence; recurrence != nil { + if err := d.Set("recurrence", flattenAzureArmSchedulerJobSchedule(recurrence)); err != nil { + return err + } + } + + if v := properties.StartTime; v != nil { + d.Set("start_time", (*v).Format(time.RFC3339)) + } + + //status && state + d.Set("state", properties.State) + } + + return nil +} + +func resourceArmSchedulerJobDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).schedulerJobsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + name := id.Path["jobs"] + resourceGroup := id.ResourceGroup + jobCollection := id.Path["jobCollections"] + + log.Printf("[DEBUG] Deleting Scheduler Job %q (resource group %q)", name, resourceGroup) + + resp, err := client.Delete(ctx, resourceGroup, jobCollection, name) + if err != nil { + if !utils.ResponseWasNotFound(resp) { + return fmt.Errorf("Error issuing delete request for Scheduler Job %q (Resource Group %q): %+v", name, resourceGroup, err) + } + } + + return nil +} + +func expandAzureArmSchedulerJobAction(d *schema.ResourceData, meta interface{}) *scheduler.JobAction { + + action := scheduler.JobAction{} + + //action + if b, ok := d.GetOk("action_web"); ok { + action.Request, action.Type = expandAzureArmSchedulerJobActionRequest(b, meta) + } + + //error action + if b, ok := d.GetOk("error_action_web"); ok { + action.ErrorAction = &scheduler.JobErrorAction{} + action.ErrorAction.Request, action.ErrorAction.Type = expandAzureArmSchedulerJobActionRequest(b, meta) + } + + //retry policy + if b, ok := d.GetOk("retry"); ok { + action.RetryPolicy = expandAzureArmSchedulerJobActionRetry(b) + } else { + action.RetryPolicy = &scheduler.RetryPolicy{ + RetryType: scheduler.None, + } + } + + return &action +} + +func expandAzureArmSchedulerJobActionRequest(b interface{}, meta interface{}) (*scheduler.HTTPRequest, scheduler.JobActionType) { + + block := b.([]interface{})[0].(map[string]interface{}) + + url := block["url"].(string) + + request := scheduler.HTTPRequest{ + URI: &url, + Method: utils.String(block["method"].(string)), + Headers: map[string]*string{}, + } + + // determine type from the url, the property validation must ensure this + // otherwise we need to worry about what happens if neither is true + var jobType scheduler.JobActionType + if strings.HasPrefix(strings.ToLower(url), "https://") { + jobType = scheduler.HTTPS + } else { + jobType = scheduler.HTTP + } + + //load headers + for k, v := range block["headers"].(map[string]interface{}) { + request.Headers[k] = utils.String(v.(string)) + } + + //only valid for a set + if v, ok := block["body"].(string); ok && v != "" { + request.Body = utils.String(block["body"].(string)) + } + + //authentications + if v, ok := block["authentication_basic"].([]interface{}); ok && len(v) > 0 { + b := v[0].(map[string]interface{}) + request.Authentication = &scheduler.BasicAuthentication{ + Type: scheduler.TypeBasic, + Username: utils.String(b["username"].(string)), + Password: utils.String(b["password"].(string)), + } + } + + if v, ok := block["authentication_certificate"].([]interface{}); ok && len(v) > 0 { + b := v[0].(map[string]interface{}) + request.Authentication = &scheduler.ClientCertAuthentication{ + Type: scheduler.TypeClientCertificate, + Pfx: utils.String(b["pfx"].(string)), + Password: utils.String(b["password"].(string)), + } + } + + if v, ok := block["authentication_active_directory"].([]interface{}); ok && len(v) > 0 { + b := v[0].(map[string]interface{}) + oauth := &scheduler.OAuthAuthentication{ + Type: scheduler.TypeActiveDirectoryOAuth, + Tenant: utils.String(b["tenant_id"].(string)), + ClientID: utils.String(b["client_id"].(string)), + Secret: utils.String(b["secret"].(string)), + } + + //default to the service Management Endpoint + if v, ok := b["audience"].(string); ok { + oauth.Audience = utils.String(v) + } else { + oauth.Audience = utils.String(meta.(*ArmClient).environment.ServiceManagementEndpoint) + } + + request.Authentication = oauth + } + + return &request, jobType +} + +func expandAzureArmSchedulerJobActionRetry(b interface{}) *scheduler.RetryPolicy { + block := b.([]interface{})[0].(map[string]interface{}) + retry := scheduler.RetryPolicy{ + RetryType: scheduler.Fixed, + } + + if v, ok := block["interval"].(string); ok && v != "" { + retry.RetryInterval = utils.String(v) + } + if v, ok := block["count"].(int); ok { + retry.RetryCount = utils.Int32(int32(v)) + } + + return &retry +} + +func expandAzureArmSchedulerJobRecurrence(b interface{}) *scheduler.JobRecurrence { + block := b.([]interface{})[0].(map[string]interface{}) + + recurrence := scheduler.JobRecurrence{ + Frequency: scheduler.RecurrenceFrequency(block["frequency"].(string)), + Interval: utils.Int32(int32(block["interval"].(int))), + } + if v, ok := block["count"].(int); ok { + recurrence.Count = utils.Int32(int32(v)) + } + if v, ok := block["end_time"].(string); ok && v != "" { + endTime, _ := time.Parse(time.RFC3339, v) //validated by schema + recurrence.EndTime = &date.Time{Time: endTime} + } + + schedule := scheduler.JobRecurrenceSchedule{} + if s, ok := block["minutes"].(*schema.Set); ok && s.Len() > 0 { + schedule.Minutes = set.ToSliceInt32P(s) + } + if s, ok := block["hours"].(*schema.Set); ok && s.Len() > 0 { + schedule.Hours = set.ToSliceInt32P(s) + } + + if s, ok := block["week_days"].(*schema.Set); ok && s.Len() > 0 { + var slice []scheduler.DayOfWeek + for _, m := range s.List() { + slice = append(slice, scheduler.DayOfWeek(m.(string))) + } + schedule.WeekDays = &slice + } + + if s, ok := block["month_days"].(*schema.Set); ok && s.Len() > 0 { + schedule.MonthDays = set.ToSliceInt32P(s) + } + if s, ok := block["monthly_occurrences"].(*schema.Set); ok && s.Len() > 0 { + var slice []scheduler.JobRecurrenceScheduleMonthlyOccurrence + for _, e := range s.List() { + b := e.(map[string]interface{}) + slice = append(slice, scheduler.JobRecurrenceScheduleMonthlyOccurrence{ + Day: scheduler.JobScheduleDay(b["day"].(string)), + Occurrence: utils.Int32(int32(b["occurrence"].(int))), + }) + } + schedule.MonthlyOccurrences = &slice + } + + // if non of these are set and we try and send out a empty JobRecurrenceSchedule block + // the API will not respond so kindly + if schedule.Minutes != nil || + schedule.Hours != nil || + schedule.WeekDays != nil || + schedule.MonthDays != nil || + schedule.MonthlyOccurrences != nil { + recurrence.Schedule = &schedule + } + return &recurrence +} + +// flatten (API --> terraform) + +func flattenAzureArmSchedulerJobActionRequest(d *schema.ResourceData, blockName string, request *scheduler.HTTPRequest) []interface{} { + + block := map[string]interface{}{} + + if v := request.URI; v != nil { + block["url"] = *v + } + if v := request.Method; v != nil { + block["method"] = *v + } + if v := request.Body; v != nil { + block["body"] = *v + } + + if v := request.Headers; v != nil { + headers := map[string]interface{}{} + for k, v := range v { + headers[k] = *v + } + + block["headers"] = headers + } + + if auth := request.Authentication; auth != nil { + + authBlock := map[string]interface{}{} + + if basic, ok := auth.AsBasicAuthentication(); ok { + block["authentication_basic"] = []interface{}{authBlock} + + if v := basic.Username; v != nil { + authBlock["username"] = *v + } + + //password is not returned so lets fetch it + if v, ok := d.GetOk(fmt.Sprintf("%s.0.authentication_basic.0.password", blockName)); ok { + authBlock["password"] = v.(string) + } + + } else if cert, ok := auth.AsClientCertAuthentication(); ok { + block["authentication_certificate"] = []interface{}{authBlock} + + if v := cert.CertificateThumbprint; v != nil { + authBlock["thumbprint"] = *v + } + if v := cert.CertificateExpirationDate; v != nil { + authBlock["expiration"] = (*v).Format(time.RFC3339) + } + if v := cert.CertificateSubjectName; v != nil { + authBlock["subject_name"] = *v + } + + //these properties not returned, so lets grab them + if v, ok := d.GetOk(fmt.Sprintf("%s.0.authentication_certificate.0.pfx", blockName)); ok { + authBlock["pfx"] = v.(string) + } + if v, ok := d.GetOk(fmt.Sprintf("%s.0.authentication_certificate.0.password", blockName)); ok { + authBlock["password"] = v.(string) + } + + } else if oauth, ok := auth.AsOAuthAuthentication(); ok { + block["authentication_active_directory"] = []interface{}{authBlock} + + if v := oauth.Audience; v != nil { + authBlock["audience"] = *v + } + if v := oauth.ClientID; v != nil { + authBlock["client_id"] = *v + } + if v := oauth.Tenant; v != nil { + authBlock["tenant_id"] = *v + } + + //secret is not returned + if v, ok := d.GetOk(fmt.Sprintf("%s.0.authentication_active_directory.0.secret", blockName)); ok { + authBlock["secret"] = v.(string) + } + } + } + + return []interface{}{block} +} + +func flattenAzureArmSchedulerJobActionRetry(retry *scheduler.RetryPolicy) []interface{} { + block := map[string]interface{}{} + + if v := retry.RetryInterval; v != nil { + block["interval"] = *v + } + if v := retry.RetryCount; v != nil { + block["count"] = *v + } + + return []interface{}{block} +} + +func flattenAzureArmSchedulerJobSchedule(recurrence *scheduler.JobRecurrence) []interface{} { + block := map[string]interface{}{} + + block["frequency"] = string(recurrence.Frequency) + + if v := recurrence.Interval; v != nil { + block["interval"] = *v + } + if v := recurrence.Count; v != nil { + block["count"] = *v + } + if v := recurrence.EndTime; v != nil { + block["end_time"] = (*v).Format(time.RFC3339) + } + + if schedule := recurrence.Schedule; schedule != nil { + + if v := schedule.Minutes; v != nil { + block["minutes"] = set.FromInt32Slice(*v) + } + if v := schedule.Hours; v != nil { + block["hours"] = set.FromInt32Slice(*v) + } + + if v := schedule.WeekDays; v != nil { + set := &schema.Set{F: schema.HashString} + for _, v := range *v { + set.Add(string(v)) + } + block["week_days"] = set + } + if v := schedule.MonthDays; v != nil { + block["month_days"] = set.FromInt32Slice(*v) + } + + if monthly := schedule.MonthlyOccurrences; monthly != nil { + set := &schema.Set{F: resourceAzureRMSchedulerJobMonthlyOccurrenceHash} + for _, e := range *monthly { + + m := map[string]interface{}{ + "day": string(e.Day), + } + + if v := e.Occurrence; v != nil { + m["occurrence"] = int(*v) + } + + set.Add(m) + } + block["monthly_occurrences"] = set + } + } + + return []interface{}{block} +} + +func resourceAzureRMSchedulerJobMonthlyOccurrenceHash(v interface{}) int { + var buf bytes.Buffer + + if m, ok := v.(map[string]interface{}); ok { + //day returned by azure is in a different case then the API constants + buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(m["day"].(string)))) + buf.WriteString(fmt.Sprintf("%d-", m["occurrence"].(int))) + } + + return hashcode.String(buf.String()) +} diff --git a/azurerm/resource_arm_scheduler_job_collection.go b/azurerm/resource_arm_scheduler_job_collection.go index 81d4aa1fb1a86..fa9fb1f195458 100644 --- a/azurerm/resource_arm_scheduler_job_collection.go +++ b/azurerm/resource_arm_scheduler_job_collection.go @@ -94,7 +94,7 @@ func resourceArmSchedulerJobCollection() *schema.Resource { }, true), }, - // API documentation states the MaxRecurrance.Interval "Gets or sets the interval between retries." + // API documentation states the MaxRecurrence.Interval "Gets or sets the interval between retries." // however it does appear it is the max interval allowed for recurrences "max_retry_interval": { Type: schema.TypeInt, diff --git a/azurerm/resource_arm_scheduler_job_test.go b/azurerm/resource_arm_scheduler_job_test.go new file mode 100644 index 0000000000000..ff5f64c1360a5 --- /dev/null +++ b/azurerm/resource_arm_scheduler_job_test.go @@ -0,0 +1,786 @@ +package azurerm + +import ( + "fmt" + "os" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func TestAccAzureRMSchedulerJob_web_basic(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_basic(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "http://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_put(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_put(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "http://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "put"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.body", "this is some text"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_authBasic(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_authBasic(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_basic.0.username", "login"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"action_web.0.authentication_basic.0.password"}, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_authCert(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_authCert(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_certificate.0.thumbprint", "42C107874FD0E4A9583292A2F1098E8FE4B2EDDA"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_certificate.0.subject_name", "CN=Terraform App Gateway, OU=Azure, O=Terraform Tests, S=Some-State, C=US"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "action_web.0.authentication_certificate.0.pfx", + "action_web.0.authentication_certificate.0.password", + }, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_authAd(t *testing.T) { + if os.Getenv(resource.TestEnvVar) == "" { + t.Skipf("Skipping since %q isn't set", resource.TestEnvVar) + return + } + + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + clientId := os.Getenv("ARM_CLIENT_ID") + tenantId := os.Getenv("ARM_TENANT_ID") + secret := os.Getenv("ARM_CLIENT_SECRET") + + env, err := testArmEnvironment() + if err != nil { + t.Fatalf("Error loading Environment: %+v", err) + return + } + + audience := env.ServiceManagementEndpoint + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_authAd(ri, testLocation(), tenantId, clientId, secret, audience), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_active_directory.0.tenant_id", tenantId), + resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_active_directory.0.client_id", clientId), + resource.TestCheckResourceAttrSet(resourceName, "action_web.0.authentication_active_directory.0.audience"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"action_web.0.authentication_active_directory.0.secret"}, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_retry(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_retry(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "retry.0.interval", "00:05:00"), + resource.TestCheckResourceAttr(resourceName, "retry.0.count", "10"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_recurring(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_recurring(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.frequency", "minute"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.interval", "5"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.count", "10"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_recurringDaily(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_recurringDaily(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.frequency", "day"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.count", "100"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.hours.#", "2"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.minutes.#", "4"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_recurringWeekly(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_recurringWeekly(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.frequency", "week"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.count", "100"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.week_days.#", "2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_recurringMonthly(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_recurringMonthly(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.frequency", "month"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.count", "100"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.month_days.#", "4"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_recurringMonthlyOccurrences(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_recurringMonthlyOccurrences(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.frequency", "month"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.count", "100"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.monthly_occurrences.#", "3"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.monthly_occurrences.2181640481.day", "sunday"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.monthly_occurrences.2181640481.occurrence", "1"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.monthly_occurrences.2956940195.day", "sunday"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.monthly_occurrences.2956940195.occurrence", "3"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.monthly_occurrences.679325150.day", "sunday"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.monthly_occurrences.679325150.occurrence", "-1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_errorAction(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_errorAction(ri, testLocation()), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "get"), + resource.TestCheckResourceAttr(resourceName, "error_action_web.0.url", "https://example.com"), + resource.TestCheckResourceAttr(resourceName, "error_action_web.0.method", "get"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSchedulerJob_web_complete(t *testing.T) { + resourceName := "azurerm_scheduler_job.test" + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSchedulerJobDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSchedulerJob_web_complete(ri, testLocation(), "2019-07-07T07:07:07-07:00"), + Check: resource.ComposeAggregateTestCheckFunc( + testCheckAzureRMSchedulerJobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "action_web.0.url", "http://example.com"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.method", "put"), + resource.TestCheckResourceAttr(resourceName, "action_web.0.body", "this is some text"), + resource.TestCheckResourceAttr(resourceName, "retry.0.interval", "00:05:00"), + resource.TestCheckResourceAttr(resourceName, "retry.0.count", "10"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.frequency", "month"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.count", "100"), + resource.TestCheckResourceAttr(resourceName, "recurrence.0.month_days.#", "4"), + resource.TestCheckResourceAttr(resourceName, "start_time", "2019-07-07T14:07:07Z"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testCheckAzureRMSchedulerJobDestroy(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_scheduler_job.test" { + continue + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + jobCollection := rs.Primary.Attributes["job_collection_name"] + + client := testAccProvider.Meta().(*ArmClient).schedulerJobsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + resp, err := client.Get(ctx, resourceGroup, jobCollection, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return nil + } + + return err + } + + return fmt.Errorf("Scheduler Job Collection still exists:\n%#v", resp) + } + + return nil +} + +func testCheckAzureRMSchedulerJobExists(name string) resource.TestCheckFunc { + return func(s *terraform.State) error { + // Ensure we have enough information in state to look up in API + rs, ok := s.RootModule().Resources[name] + if !ok { + return fmt.Errorf("Not found: %q", name) + } + + name := rs.Primary.Attributes["name"] + resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] + jobCollection := rs.Primary.Attributes["job_collection_name"] + + if !hasResourceGroup { + return fmt.Errorf("Bad: no resource group found in state for Scheduler Job: %q", name) + } + + client := testAccProvider.Meta().(*ArmClient).schedulerJobsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + resp, err := client.Get(ctx, resourceGroup, jobCollection, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Scheduler Job %q (resource group: %q) was not found: %+v", name, resourceGroup, err) + } + + return fmt.Errorf("Bad: Get on schedulerJobsClient: %+v", err) + } + + return nil + } +} + +func testAccAzureRMSchedulerJob_template(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_scheduler_job_collection" "test" { + name = "acctestRG-%[1]d-job_collection" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "standard" +} + +`, rInt, location) +} + +func testAccAzureRMSchedulerJob_web_basic(rInt int, location string) string { + //need a valid URL here otherwise on a slow connection job might fault before the test check + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + action_web { + url = "http://example.com" + method = "get" + } +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_put(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "http://example.com" + method = "put" + body = "this is some text" + + headers = { + "Content-Type" = "text" + } + } +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_authBasic(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + + authentication_basic { + username = "login" + password = "apassword" + } + } +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_authCert(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + + authentication_certificate { + pfx = "${base64encode(file("testdata/application_gateway_test.pfx"))}" + password = "terraform" + } + } +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_authAd(rInt int, location, tenantId, clientId, secret, audience string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + + authentication_active_directory { + tenant_id = "%s" + client_id = "%s" + secret = "%s" + audience = "%s" + } + } +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt, tenantId, clientId, secret, audience) +} + +func testAccAzureRMSchedulerJob_web_retry(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + } + + retry { + interval = "00:05:00" //5 min + count = 10 + } + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_recurring(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + } + + recurrence { + frequency = "minute" + interval = 5 + count = 10 + } + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_recurringDaily(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + } + + recurrence { + frequency = "day" + count = 100 + hours = [0,12] + minutes = [0,15,30,45] + } + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_recurringWeekly(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + } + + recurrence { + frequency = "week" + count = 100 + week_days = ["Sunday", "Saturday"] + } + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_recurringMonthly(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + } + + recurrence { + frequency = "month" + count = 100 + month_days = [-11,-1,1,11] + } + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_recurringMonthlyOccurrences(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + } + + recurrence { + frequency = "month" + count = 100 + monthly_occurrences = [ + { + day = "sunday" + occurrence = 1 + }, + { + day = "sunday" + occurrence = 3 + }, + { + day = "sunday" + occurrence = -1 + } + ] + } + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_errorAction(rInt int, location string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "https://example.com" + method = "get" + } + + error_action_web { + url = "https://example.com" + method = "get" + } + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt) +} + +func testAccAzureRMSchedulerJob_web_complete(rInt int, location, time string) string { + return fmt.Sprintf(`%s +resource "azurerm_scheduler_job" "test" { + name = "acctestRG-%d-job" + resource_group_name = "${azurerm_resource_group.test.name}" + job_collection_name = "${azurerm_scheduler_job_collection.test.name}" + + + action_web { + url = "http://example.com" + method = "put" + body = "this is some text" + + headers = { + "Content-Type" = "text" + } + } + + retry { + interval = "00:05:00" //5 min + count = 10 + } + + recurrence { + frequency = "month" + count = 100 + month_days = [-11,-1,1,11] + } + + start_time = "%s" + +}`, testAccAzureRMSchedulerJob_template(rInt, location), rInt, time) +} diff --git a/azurerm/resource_arm_search_service_test.go b/azurerm/resource_arm_search_service_test.go index 0a92ca9f98b72..7982a8e14ecec 100644 --- a/azurerm/resource_arm_search_service_test.go +++ b/azurerm/resource_arm_search_service_test.go @@ -112,7 +112,7 @@ func testCheckAzureRMSearchServiceDestroy(s *terraform.State) error { func testAccAzureRMSearchService_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -132,7 +132,7 @@ resource "azurerm_search_service" "test" { func testAccAzureRMSearchService_complete(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_search_service" "test" { diff --git a/azurerm/resource_arm_servicebus_namespace.go b/azurerm/resource_arm_servicebus_namespace.go index 3a8e115188a62..2fdb29855bc0d 100644 --- a/azurerm/resource_arm_servicebus_namespace.go +++ b/azurerm/resource_arm_servicebus_namespace.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" + "regexp" ) // Default Authorization Rule/Policy created by Azure, used to populate the @@ -21,9 +22,11 @@ func resourceArmServiceBusNamespace() *schema.Resource { Read: resourceArmServiceBusNamespaceRead, Update: resourceArmServiceBusNamespaceCreate, Delete: resourceArmServiceBusNamespaceDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, + MigrateState: resourceAzureRMServiceBusNamespaceMigrateState, SchemaVersion: 1, @@ -32,6 +35,10 @@ func resourceArmServiceBusNamespace() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile("^[a-zA-Z][-a-zA-Z0-9]{0,100}[a-zA-Z0-9]$"), + "The namespace can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number.", + ), }, "location": locationSchema(), @@ -53,8 +60,7 @@ func resourceArmServiceBusNamespace() *schema.Resource { "capacity": { Type: schema.TypeInt, Optional: true, - ForceNew: true, - ValidateFunc: validateServiceBusNamespaceCapacity, + ValidateFunc: validateIntInSlice([]int{1, 2, 4}), }, "default_primary_connection_string": { @@ -83,12 +89,27 @@ func resourceArmServiceBusNamespace() *schema.Resource { "tags": tagsSchema(), }, + + CustomizeDiff: func(d *schema.ResourceDiff, v interface{}) error { + + //If the SKU is not premium the API will always return 0 for capacity + //so lets only allow it to be set if the SKU is premium + if _, ok := d.GetOk("capacity"); ok { + sku := d.Get("sku").(string) + if strings.ToLower(sku) != strings.ToLower(string(servicebus.Premium)) { + return fmt.Errorf("`capacity` can only be set for a Premium SKU") + } + } + + return nil + }, } } func resourceArmServiceBusNamespaceCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).serviceBusNamespacesClient ctx := meta.(*ArmClient).StopContext + log.Printf("[INFO] preparing arguments for AzureRM ServiceBus Namespace creation.") name := d.Get("name").(string) @@ -106,15 +127,8 @@ func resourceArmServiceBusNamespaceCreate(d *schema.ResourceData, meta interface Tags: expandTags(tags), } - capacity := d.Get("capacity").(int) - if capacity > 0 { - skuName := strings.ToLower(string(parameters.Sku.Name)) - premiumSku := strings.ToLower(string(servicebus.Premium)) - if skuName != premiumSku { - return fmt.Errorf("`capacity` can only be set for a Premium SKU") - } - - parameters.Sku.Capacity = utils.Int32(int32(capacity)) + if capacity, ok := d.GetOk("capacity"); ok { + parameters.Sku.Capacity = utils.Int32(int32(capacity.(int))) } future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) @@ -205,17 +219,3 @@ func resourceArmServiceBusNamespaceDelete(d *schema.ResourceData, meta interface return nil } - -func validateServiceBusNamespaceCapacity(v interface{}, k string) (ws []string, errors []error) { - value := v.(int) - capacities := map[int]bool{ - 1: true, - 2: true, - 4: true, - } - - if !capacities[value] { - errors = append(errors, fmt.Errorf("ServiceBus Namespace Capacity can only be 1, 2 or 4")) - } - return -} diff --git a/azurerm/resource_arm_servicebus_namespace_test.go b/azurerm/resource_arm_servicebus_namespace_test.go index cd03c884fe7c8..8fa6637acfa3d 100644 --- a/azurerm/resource_arm_servicebus_namespace_test.go +++ b/azurerm/resource_arm_servicebus_namespace_test.go @@ -62,38 +62,6 @@ func testSweepServiceBusNamespace(region string) error { return nil } -func TestAccAzureRMServiceBusNamespaceCapacity_validation(t *testing.T) { - cases := []struct { - Value int - ErrCount int - }{ - { - Value: 17, - ErrCount: 1, - }, - { - Value: 1, - ErrCount: 0, - }, - { - Value: 2, - ErrCount: 0, - }, - { - Value: 4, - ErrCount: 0, - }, - } - - for _, tc := range cases { - _, errors := validateServiceBusNamespaceCapacity(tc.Value, "azurerm_servicebus_namespace") - - if len(errors) != tc.ErrCount { - t.Fatalf("Expected the Azure RM ServiceBus Namespace Capacity to trigger a validation error") - } - } -} - func TestAccAzureRMServiceBusNamespace_basic(t *testing.T) { resourceName := "azurerm_servicebus_namespace.test" ri := acctest.RandInt() diff --git a/azurerm/resource_arm_servicebus_queue.go b/azurerm/resource_arm_servicebus_queue.go index a4986c9807714..7676c0b65ddc9 100644 --- a/azurerm/resource_arm_servicebus_queue.go +++ b/azurerm/resource_arm_servicebus_queue.go @@ -161,15 +161,9 @@ func resourceArmServiceBusQueueCreateUpdate(d *schema.ResourceData, meta interfa // We need to retrieve the namespace because Premium namespace works differently from Basic and Standard, // so it needs different rules applied to it. namespacesClient := meta.(*ArmClient).serviceBusNamespacesClient - namespace, nsErr := namespacesClient.Get(ctx, resourceGroup, namespaceName) - if nsErr != nil { - return nsErr - } - - // Enforce Premium namespace to have partitioning enabled in Terraform. It is always enabled in Azure for - // Premium SKU. - if namespace.Sku.Name == servicebus.Premium && !d.Get("enable_partitioning").(bool) { - return fmt.Errorf("ServiceBus Queue (%s) must have Partitioning enabled for Premium SKU", name) + namespace, err := namespacesClient.Get(ctx, resourceGroup, namespaceName) + if err != nil { + return fmt.Errorf("Error retrieving ServiceBus Namespace %q (Resource Group %q): %+v", resourceGroup, namespaceName, err) } // Enforce Premium namespace to have Express Entities disabled in Terraform since they are not supported for @@ -178,7 +172,7 @@ func resourceArmServiceBusQueueCreateUpdate(d *schema.ResourceData, meta interfa return fmt.Errorf("ServiceBus Queue (%s) does not support Express Entities in Premium SKU and must be disabled", name) } - _, err := client.CreateOrUpdate(ctx, resourceGroup, namespaceName, name, parameters) + _, err = client.CreateOrUpdate(ctx, resourceGroup, namespaceName, name, parameters) if err != nil { return err } diff --git a/azurerm/resource_arm_servicebus_queue_test.go b/azurerm/resource_arm_servicebus_queue_test.go index 5e92900127e41..11e5c2a53b0c4 100644 --- a/azurerm/resource_arm_servicebus_queue_test.go +++ b/azurerm/resource_arm_servicebus_queue_test.go @@ -108,7 +108,7 @@ func TestAccAzureRMServiceBusQueue_defaultEnablePartitioningPremium(t *testing.T Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMServiceBusQueueExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "enable_partitioning", "true"), + resource.TestCheckResourceAttr(resourceName, "enable_partitioning", "false"), resource.TestCheckResourceAttr(resourceName, "enable_express", "false"), ), }, @@ -331,7 +331,7 @@ resource "azurerm_servicebus_queue" "test" { name = "acctestservicebusqueue-%d" resource_group_name = "${azurerm_resource_group.test.name}" namespace_name = "${azurerm_servicebus_namespace.test.name}" - enable_partitioning = true + enable_partitioning = false enable_express = false } `, rInt, location, rInt, rInt) diff --git a/azurerm/resource_arm_servicebus_topic.go b/azurerm/resource_arm_servicebus_topic.go index 4121bda84f5dd..45ab5ba836c9b 100644 --- a/azurerm/resource_arm_servicebus_topic.go +++ b/azurerm/resource_arm_servicebus_topic.go @@ -214,7 +214,7 @@ func resourceArmServiceBusTopicRead(d *schema.ResourceData, meta interface{}) er // if the topic is in a premium namespace and partitioning is enabled then the // max size returned by the API will be 16 times greater than the value set - if *props.EnablePartitioning { + if partitioning := props.EnablePartitioning; partitioning != nil && *partitioning { namespacesClient := meta.(*ArmClient).serviceBusNamespacesClient namespace, err := namespacesClient.Get(ctx, resourceGroup, namespaceName) if err != nil { diff --git a/azurerm/resource_arm_servicebus_topic_test.go b/azurerm/resource_arm_servicebus_topic_test.go index a1930296d46f5..33146c282ccfe 100644 --- a/azurerm/resource_arm_servicebus_topic_test.go +++ b/azurerm/resource_arm_servicebus_topic_test.go @@ -165,7 +165,7 @@ func TestAccAzureRMServiceBusTopic_enablePartitioningPremium(t *testing.T) { { Config: postConfig, Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "enable_partitioning", "true"), + resource.TestCheckResourceAttr(resourceName, "enable_partitioning", "false"), resource.TestCheckResourceAttr(resourceName, "max_size_in_megabytes", "81920"), ), }, @@ -349,7 +349,7 @@ resource "azurerm_servicebus_topic" "test" { name = "acctestservicebustopic-%d" namespace_name = "${azurerm_servicebus_namespace.test.name}" resource_group_name = "${azurerm_resource_group.test.name}" - enable_partitioning = true + enable_partitioning = false } `, rInt, location, rInt, rInt) } @@ -397,7 +397,7 @@ resource "azurerm_servicebus_topic" "test" { name = "acctestservicebustopic-%d" namespace_name = "${azurerm_servicebus_namespace.test.name}" resource_group_name = "${azurerm_resource_group.test.name}" - enable_partitioning = true + enable_partitioning = false max_size_in_megabytes = 81920 } `, rInt, location, rInt, rInt) diff --git a/azurerm/resource_arm_snapshot_test.go b/azurerm/resource_arm_snapshot_test.go index 47bc96711cdeb..d996ead4bf325 100644 --- a/azurerm/resource_arm_snapshot_test.go +++ b/azurerm/resource_arm_snapshot_test.go @@ -242,7 +242,7 @@ func testCheckAzureRMSnapshotExists(name string) resource.TestCheckFunc { func testAccAzureRMSnapshot_fromManagedDisk(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -268,7 +268,7 @@ resource "azurerm_snapshot" "test" { func testAccAzureRMSnapshot_fromManagedDiskUpdated(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -300,7 +300,7 @@ func testAccAzureRMSnapshot_encryption(rInt int, rString string, location string data "azurerm_client_config" "current" {} resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -393,7 +393,7 @@ resource "azurerm_snapshot" "test" { func testAccAzureRMSnapshot_extendingManagedDisk(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -420,7 +420,7 @@ resource "azurerm_snapshot" "test" { func testAccAzureRMSnapshot_fromExistingSnapshot(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -454,7 +454,7 @@ resource "azurerm_snapshot" "second" { func testAccAzureRMSnapshot_fromUnmanagedDisk(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_sql_administrator.go b/azurerm/resource_arm_sql_administrator.go index 9e065ab3c7d36..d7b9e0fa93a21 100644 --- a/azurerm/resource_arm_sql_administrator.go +++ b/azurerm/resource_arm_sql_administrator.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" "github.com/hashicorp/terraform/helper/schema" uuid "github.com/satori/go.uuid" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_sql_administrator_test.go b/azurerm/resource_arm_sql_administrator_test.go index 9d2a7b5ff123b..dda4c421ff5ed 100644 --- a/azurerm/resource_arm_sql_administrator_test.go +++ b/azurerm/resource_arm_sql_administrator_test.go @@ -137,7 +137,7 @@ func testAccAzureRMSqlAdministrator_basic(rInt int, location string) string { data "azurerm_client_config" "current" {} resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -165,7 +165,7 @@ func testAccAzureRMSqlAdministrator_withUpdates(rInt int, location string) strin data "azurerm_client_config" "current" {} resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_sql_database.go b/azurerm/resource_arm_sql_database.go index 847e6e35165e4..0483646ac8db1 100644 --- a/azurerm/resource_arm_sql_database.go +++ b/azurerm/resource_arm_sql_database.go @@ -3,9 +3,10 @@ package azurerm import ( "fmt" "log" + "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -57,6 +58,61 @@ func resourceArmSqlDatabase() *schema.Resource { DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, + "import": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_uri": { + Type: schema.TypeString, + Required: true, + }, + "storage_key": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "storage_key_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "StorageAccessKey", + "SharedAccessKey", + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + "administrator_login": { + Type: schema.TypeString, + Required: true, + }, + "administrator_login_password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "authentication_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "ADPassword", + "SQL", + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + "operation_mode": { + Type: schema.TypeString, + Optional: true, + Default: "Import", + ValidateFunc: validation.StringInSlice([]string{ + "Import", + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + }, + }, + }, + "source_database_id": { Type: schema.TypeString, Optional: true, @@ -238,6 +294,27 @@ func resourceArmSqlDatabaseCreateUpdate(d *schema.ResourceData, meta interface{} return err } + if _, ok := d.GetOk("import"); ok { + if !strings.EqualFold(createMode, "default") { + return fmt.Errorf("import can only be used when create_mode is Default") + } + importParameters := expandAzureRmSqlDatabaseImport(d) + importFuture, err := client.CreateImportOperation(ctx, resourceGroup, serverName, name, importParameters) + if err != nil { + return err + } + + // this is set in config.go, but something sets + // it back to 15 minutes, which isn't long enough + // for most imports + client.Client.PollingDuration = 60 * time.Minute + + err = importFuture.WaitForCompletion(ctx, client.Client) + if err != nil { + return err + } + } + resp, err := client.Get(ctx, resourceGroup, serverName, name, "") if err != nil { return err @@ -356,3 +433,21 @@ func flattenEncryptionStatus(encryption *[]sql.TransparentDataEncryption) string return "" } + +func expandAzureRmSqlDatabaseImport(d *schema.ResourceData) sql.ImportExtensionRequest { + v := d.Get("import") + dbimportRefs := v.([]interface{}) + dbimportRef := dbimportRefs[0].(map[string]interface{}) + return sql.ImportExtensionRequest{ + Name: utils.String("terraform"), + ImportExtensionProperties: &sql.ImportExtensionProperties{ + StorageKeyType: sql.StorageKeyType(dbimportRef["storage_key_type"].(string)), + StorageKey: utils.String(dbimportRef["storage_key"].(string)), + StorageURI: utils.String(dbimportRef["storage_uri"].(string)), + AdministratorLogin: utils.String(dbimportRef["administrator_login"].(string)), + AdministratorLoginPassword: utils.String(dbimportRef["administrator_login_password"].(string)), + AuthenticationType: sql.AuthenticationType(dbimportRef["authentication_type"].(string)), + OperationMode: utils.String(dbimportRef["operation_mode"].(string)), + }, + } +} diff --git a/azurerm/resource_arm_sql_database_test.go b/azurerm/resource_arm_sql_database_test.go index 24eb65fc53dcd..cc8fbfd022d58 100644 --- a/azurerm/resource_arm_sql_database_test.go +++ b/azurerm/resource_arm_sql_database_test.go @@ -265,10 +265,29 @@ func testCheckAzureRMSqlDatabaseDisappears(name string) resource.TestCheckFunc { } } +func TestAccAzureRMSqlDatabase_bacpac(t *testing.T) { + ri := acctest.RandInt() + config := testAccAzureRMSqlDatabase_bacpac(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSqlDatabaseDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSqlDatabaseExists("azurerm_sql_database.test"), + ), + }, + }, + }) +} + func testAccAzureRMSqlDatabase_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -297,7 +316,7 @@ resource "azurerm_sql_database" "test" { func testAccAzureRMSqlDatabase_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -331,7 +350,7 @@ resource "azurerm_sql_database" "test" { func testAccAzureRMSqlDatabase_withTagsUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -392,7 +411,7 @@ resource "azurerm_sql_database" "test" { func testAccAzureRMSqlDatabase_restorePointInTime(rInt int, formattedTime string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -431,7 +450,7 @@ resource "azurerm_sql_database" "test_restore" { func testAccAzureRMSqlDatabase_elasticPool(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -471,7 +490,7 @@ resource "azurerm_sql_database" "test" { func testAccAzureRMSqlDatabase_collationUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -496,3 +515,73 @@ resource "azurerm_sql_database" "test" { } `, rInt, location, rInt, rInt) } + +func testAccAzureRMSqlDatabase_bacpac(rInt int, location string) string { + return fmt.Sprintf(` + resource "azurerm_resource_group" "test" { + name = "acctestRG_%d" + location = "%s" + } + + resource "azurerm_storage_account" "test" { + name = "accsa%d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + } + + resource "azurerm_storage_container" "test" { + name = "bacpac" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" + } + + resource "azurerm_storage_blob" "test" { + name = "test.bacpac" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + storage_container_name = "${azurerm_storage_container.test.name}" + type = "block" + source = "testdata/sql_import.bacpac" + } + + resource "azurerm_sql_server" "test" { + name = "acctestsqlserver%d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + version = "12.0" + administrator_login = "mradministrator" + administrator_login_password = "thisIsDog11" + } + + resource "azurerm_sql_firewall_rule" "test" { + name = "allowazure" + resource_group_name = "${azurerm_resource_group.test.name}" + server_name = "${azurerm_sql_server.test.name}" + start_ip_address = "0.0.0.0" + end_ip_address = "0.0.0.0" + } + + resource "azurerm_sql_database" "test" { + name = "acctestdb%d" + resource_group_name = "${azurerm_resource_group.test.name}" + server_name = "${azurerm_sql_server.test.name}" + location = "${azurerm_resource_group.test.location}" + edition = "Standard" + collation = "SQL_Latin1_General_CP1_CI_AS" + max_size_bytes = "1073741824" + requested_service_objective_name = "S0" + + import { + storage_uri = "${azurerm_storage_blob.test.url}" + storage_key = "${azurerm_storage_account.test.primary_access_key}" + storage_key_type = "StorageAccessKey" + administrator_login = "${azurerm_sql_server.test.administrator_login}" + administrator_login_password = "${azurerm_sql_server.test.administrator_login_password}" + authentication_type = "SQL" + } + } + `, rInt, location, rInt, rInt, rInt) +} diff --git a/azurerm/resource_arm_sql_elasticpool.go b/azurerm/resource_arm_sql_elasticpool.go index 7e4aafdac3e90..bf1e1add71413 100644 --- a/azurerm/resource_arm_sql_elasticpool.go +++ b/azurerm/resource_arm_sql_elasticpool.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_sql_firewall_rule.go b/azurerm/resource_arm_sql_firewall_rule.go index dc09817706dfa..24f501f1e3502 100644 --- a/azurerm/resource_arm_sql_firewall_rule.go +++ b/azurerm/resource_arm_sql_firewall_rule.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_sql_firewall_rule_test.go b/azurerm/resource_arm_sql_firewall_rule_test.go index 31f01f78ede23..391e1a9e1b06f 100644 --- a/azurerm/resource_arm_sql_firewall_rule_test.go +++ b/azurerm/resource_arm_sql_firewall_rule_test.go @@ -149,7 +149,7 @@ func testCheckAzureRMSqlFirewallRuleDisappears(name string) resource.TestCheckFu func testAccAzureRMSqlFirewallRule_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -175,7 +175,7 @@ resource "azurerm_sql_firewall_rule" "test" { func testAccAzureRMSqlFirewallRule_withUpdates(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_sql_server.go b/azurerm/resource_arm_sql_server.go index c7eafb23ac501..50805b167db2f 100644 --- a/azurerm/resource_arm_sql_server.go +++ b/azurerm/resource_arm_sql_server.go @@ -5,7 +5,7 @@ import ( "log" "regexp" - "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" diff --git a/azurerm/resource_arm_sql_server_test.go b/azurerm/resource_arm_sql_server_test.go index 2039e1474b543..b9c0cbb451936 100644 --- a/azurerm/resource_arm_sql_server_test.go +++ b/azurerm/resource_arm_sql_server_test.go @@ -220,7 +220,7 @@ func testCheckAzureRMSqlServerDisappears(name string) resource.TestCheckFunc { func testAccAzureRMSqlServer_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -238,7 +238,7 @@ resource "azurerm_sql_server" "test" { func testAccAzureRMSqlServer_withTags(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } @@ -261,7 +261,7 @@ resource "azurerm_sql_server" "test" { func testAccAzureRMSqlServer_withTagsUpdated(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_sql_virtual_network_rule.go b/azurerm/resource_arm_sql_virtual_network_rule.go index 19fbef32df860..6b8be15a7844c 100644 --- a/azurerm/resource_arm_sql_virtual_network_rule.go +++ b/azurerm/resource_arm_sql_virtual_network_rule.go @@ -7,7 +7,7 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" diff --git a/azurerm/resource_arm_sql_virtual_network_rule_test.go b/azurerm/resource_arm_sql_virtual_network_rule_test.go index 3da6afbb0b9f9..f278cc522dee7 100644 --- a/azurerm/resource_arm_sql_virtual_network_rule_test.go +++ b/azurerm/resource_arm_sql_virtual_network_rule_test.go @@ -423,7 +423,7 @@ func testCheckAzureRMSqlVirtualNetworkRuleDisappears(name string) resource.TestC func testAccAzureRMSqlVirtualNetworkRule_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "test" { @@ -465,7 +465,7 @@ resource "azurerm_sql_virtual_network_rule" "test" { func testAccAzureRMSqlVirtualNetworkRule_withUpdates(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "test" { @@ -507,7 +507,7 @@ resource "azurerm_sql_virtual_network_rule" "test" { func testAccAzureRMSqlVirtualNetworkRule_subnetSwitchPre(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "test" { @@ -556,7 +556,7 @@ resource "azurerm_sql_virtual_network_rule" "test" { func testAccAzureRMSqlVirtualNetworkRule_subnetSwitchPost(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "test" { @@ -605,7 +605,7 @@ resource "azurerm_sql_virtual_network_rule" "test" { func testAccAzureRMSqlVirtualNetworkRule_ignoreEndpointValid(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "test" { @@ -648,7 +648,7 @@ resource "azurerm_sql_virtual_network_rule" "test" { func testAccAzureRMSqlVirtualNetworkRule_ignoreEndpointInvalid(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "test" { @@ -690,7 +690,7 @@ resource "azurerm_sql_virtual_network_rule" "test" { func testAccAzureRMSqlVirtualNetworkRule_multipleSubnets(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG_%d" + name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "vnet1" { diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go index c95c8839d337f..be90c7050a595 100644 --- a/azurerm/resource_arm_storage_account.go +++ b/azurerm/resource_arm_storage_account.go @@ -127,13 +127,13 @@ func resourceArmStorageAccount() *schema.Resource { "enable_blob_encryption": { Type: schema.TypeBool, Optional: true, - Computed: true, + Default: true, }, "enable_file_encryption": { Type: schema.TypeBool, Optional: true, - Computed: true, + Default: true, }, "enable_https_traffic_only": { @@ -141,6 +141,43 @@ func resourceArmStorageAccount() *schema.Resource { Optional: true, }, + "network_rules": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bypass": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(storage.AzureServices), + string(storage.Logging), + string(storage.Metrics), + string(storage.None), + }, true), + }, + Set: schema.HashString, + }, + "ip_rules": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + }, + "virtual_network_subnet_ids": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + }, + }, + }, + }, + "primary_location": { Type: schema.TypeString, Computed: true, @@ -223,6 +260,33 @@ func resourceArmStorageAccount() *schema.Resource { Sensitive: true, }, + "identity": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: validation.StringInSlice([]string{ + "SystemAssigned", + }, true), + }, + "principal_id": { + Type: schema.TypeString, + Computed: true, + }, + "tenant_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "tags": tagsSchema(), }, } @@ -238,6 +302,7 @@ func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) e location := azureRMNormalizeLocation(d.Get("location").(string)) tags := d.Get("tags").(map[string]interface{}) enableBlobEncryption := d.Get("enable_blob_encryption").(bool) + enableFileEncryption := d.Get("enable_file_encryption").(bool) enableHTTPSTrafficOnly := d.Get("enable_https_traffic_only").(bool) accountTier := d.Get("account_tier").(string) @@ -245,6 +310,8 @@ func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) e storageType := fmt.Sprintf("%s_%s", accountTier, replicationType) storageAccountEncryptionSource := d.Get("account_encryption_source").(string) + networkRules := expandStorageAccountNetworkRules(d) + parameters := storage.AccountCreateParameters{ Location: &location, Sku: &storage.Sku{ @@ -257,17 +324,20 @@ func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) e Services: &storage.EncryptionServices{ Blob: &storage.EncryptionService{ Enabled: utils.Bool(enableBlobEncryption), + }, + File: &storage.EncryptionService{ + Enabled: utils.Bool(enableFileEncryption), }}, KeySource: storage.KeySource(storageAccountEncryptionSource), }, EnableHTTPSTrafficOnly: &enableHTTPSTrafficOnly, + NetworkRuleSet: networkRules, }, } - if v, ok := d.GetOk("enable_file_encryption"); ok { - parameters.Encryption.Services.File = &storage.EncryptionService{ - Enabled: utils.Bool(v.(bool)), - } + if _, ok := d.GetOk("identity"); ok { + storageAccountIdentity := expandAzureRmStorageAccountIdentity(d) + parameters.Identity = storageAccountIdentity } if _, ok := d.GetOk("custom_domain"); ok { @@ -457,8 +527,36 @@ func resourceArmStorageAccountUpdate(d *schema.ResourceData, meta interface{}) e d.SetPartial("enable_https_traffic_only") } + if d.HasChange("identity") { + storageAccountIdentity := expandAzureRmStorageAccountIdentity(d) + + opts := storage.AccountUpdateParameters{ + Identity: storageAccountIdentity, + } + _, err := client.Update(ctx, resourceGroupName, storageAccountName, opts) + if err != nil { + return fmt.Errorf("Error updating Azure Storage Account identity %q: %+v", storageAccountName, err) + } + } + + if d.HasChange("network_rules") { + networkRules := expandStorageAccountNetworkRules(d) + + opts := storage.AccountUpdateParameters{ + AccountPropertiesUpdateParameters: &storage.AccountPropertiesUpdateParameters{ + NetworkRuleSet: networkRules, + }, + } + _, err := client.Update(ctx, resourceGroupName, storageAccountName, opts) + if err != nil { + return fmt.Errorf("Error updating Azure Storage Account network_rules %q: %+v", storageAccountName, err) + } + + d.SetPartial("network_rules") + } + d.Partial(false) - return nil + return resourceArmStorageAccountRead(d, meta) } func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) error { @@ -571,11 +669,23 @@ func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) err d.Set("secondary_table_endpoint", "") } } + + networkRules := props.NetworkRuleSet + if networkRules != nil && len(*networkRules.IPRules) > 0 && len(*networkRules.VirtualNetworkRules) > 0 { + if err := d.Set("network_rules", flattenStorageAccountNetworkRules(networkRules)); err != nil { + return fmt.Errorf("Error flattening `network_rules`: %+v", err) + } + } } d.Set("primary_access_key", accessKeys[0].Value) d.Set("secondary_access_key", accessKeys[1].Value) + identity := flattenAzureRmStorageAccountIdentity(resp.Identity) + if err := d.Set("identity", identity); err != nil { + return err + } + flattenAndSetTags(d, resp.Tags) return nil @@ -626,6 +736,107 @@ func flattenStorageAccountCustomDomain(input *storage.CustomDomain) []interface{ return []interface{}{domain} } +func expandStorageAccountNetworkRules(d *schema.ResourceData) *storage.NetworkRuleSet { + networkRules := d.Get("network_rules").([]interface{}) + if networkRules == nil || len(networkRules) == 0 { + // Default access is enabled when no network rules are set. + return &storage.NetworkRuleSet{DefaultAction: storage.DefaultActionAllow} + } + + networkRule := networkRules[0].(map[string]interface{}) + networkRuleSet := &storage.NetworkRuleSet{} + + networkRuleSet.IPRules = expandStorageAccountIPRules(networkRule) + networkRuleSet.VirtualNetworkRules = expandStorageAccountVirtualNetworks(networkRule) + networkRuleSet.Bypass = expandStorageAccountBypass(networkRule) + // Default Access is disabled when network rules are set. + networkRuleSet.DefaultAction = storage.DefaultActionDeny + + return networkRuleSet +} + +func expandStorageAccountIPRules(networkRule map[string]interface{}) *[]storage.IPRule { + ipRulesInfo := networkRule["ip_rules"].(*schema.Set).List() + ipRules := make([]storage.IPRule, len(ipRulesInfo)) + + for i, ipRuleConfig := range ipRulesInfo { + attrs := ipRuleConfig.(string) + ipRule := storage.IPRule{ + IPAddressOrRange: utils.String(attrs), + Action: storage.Allow, + } + ipRules[i] = ipRule + } + + return &ipRules +} + +func expandStorageAccountVirtualNetworks(networkRule map[string]interface{}) *[]storage.VirtualNetworkRule { + virtualNetworkInfo := networkRule["virtual_network_subnet_ids"].(*schema.Set).List() + virtualNetworks := make([]storage.VirtualNetworkRule, len(virtualNetworkInfo)) + + for i, virtualNetworkConfig := range virtualNetworkInfo { + attrs := virtualNetworkConfig.(string) + virtualNetwork := storage.VirtualNetworkRule{ + VirtualNetworkResourceID: utils.String(attrs), + Action: storage.Allow, + } + virtualNetworks[i] = virtualNetwork + } + + return &virtualNetworks +} + +func expandStorageAccountBypass(networkRule map[string]interface{}) storage.Bypass { + bypassInfo := networkRule["bypass"].(*schema.Set).List() + + var bypassValues []string + for _, bypassConfig := range bypassInfo { + bypassValues = append(bypassValues, bypassConfig.(string)) + } + + return storage.Bypass(strings.Join(bypassValues, ", ")) +} + +func flattenStorageAccountNetworkRules(input *storage.NetworkRuleSet) []interface{} { + networkRules := make(map[string]interface{}, 0) + + networkRules["ip_rules"] = schema.NewSet(schema.HashString, flattenStorageAccountIPRules(input.IPRules)) + networkRules["virtual_network_subnet_ids"] = schema.NewSet(schema.HashString, flattenStorageAccountVirtualNetworks(input.VirtualNetworkRules)) + networkRules["bypass"] = schema.NewSet(schema.HashString, flattenStorageAccountBypass(input.Bypass)) + + return []interface{}{networkRules} +} + +func flattenStorageAccountIPRules(input *[]storage.IPRule) []interface{} { + ipRules := make([]interface{}, len(*input)) + for i, ipRule := range *input { + ipRules[i] = *ipRule.IPAddressOrRange + } + + return ipRules +} + +func flattenStorageAccountVirtualNetworks(input *[]storage.VirtualNetworkRule) []interface{} { + virtualNetworks := make([]interface{}, len(*input)) + for i, virtualNetwork := range *input { + virtualNetworks[i] = *virtualNetwork.VirtualNetworkResourceID + } + + return virtualNetworks +} + +func flattenStorageAccountBypass(input storage.Bypass) []interface{} { + bypassValues := strings.Split(string(input), ", ") + bypass := make([]interface{}, len(bypassValues)) + + for i, value := range bypassValues { + bypass[i] = value + } + + return bypass +} + func validateArmStorageAccountName(v interface{}, k string) (ws []string, es []error) { input := v.(string) @@ -651,3 +862,31 @@ func validateArmStorageAccountType(v interface{}, k string) (ws []string, es []e es = append(es, fmt.Errorf("Invalid storage account type %q", input)) return } + +func expandAzureRmStorageAccountIdentity(d *schema.ResourceData) *storage.Identity { + identities := d.Get("identity").([]interface{}) + identity := identities[0].(map[string]interface{}) + identityType := identity["type"].(string) + return &storage.Identity{ + Type: &identityType, + } +} + +func flattenAzureRmStorageAccountIdentity(identity *storage.Identity) []interface{} { + if identity == nil { + return make([]interface{}, 0) + } + + result := make(map[string]interface{}) + if identity.Type != nil { + result["type"] = *identity.Type + } + if identity.PrincipalID != nil { + result["principal_id"] = *identity.PrincipalID + } + if identity.TenantID != nil { + result["tenant_id"] = *identity.TenantID + } + + return []interface{}{result} +} diff --git a/azurerm/resource_arm_storage_account_test.go b/azurerm/resource_arm_storage_account_test.go index 8a50dca6654d9..3b8a167f275b8 100644 --- a/azurerm/resource_arm_storage_account_test.go +++ b/azurerm/resource_arm_storage_account_test.go @@ -3,6 +3,7 @@ package azurerm import ( "fmt" "net/http" + "regexp" "testing" "github.com/hashicorp/terraform/helper/acctest" @@ -345,6 +346,135 @@ func TestAccAzureRMStorageAccount_NonStandardCasing(t *testing.T) { }) } +func TestAccAzureRMStorageAccount_enableIdentity(t *testing.T) { + resourceName := "azurerm_storage_account.testsa" + + ri := acctest.RandInt() + rs := acctest.RandString(4) + config := testAccAzureRMStorageAccount_identity(ri, rs, testLocation()) + + uuidMatch := regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMStorageAccountDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageAccountExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", uuidMatch), + resource.TestMatchResourceAttr(resourceName, "identity.0.tenant_id", uuidMatch), + ), + }, + }, + }) +} + +func TestAccAzureRMStorageAccount_updateResourceByEnablingIdentity(t *testing.T) { + resourceName := "azurerm_storage_account.testsa" + + ri := acctest.RandInt() + rs := acctest.RandString(4) + + basicResourceNoManagedIdentity := testAccAzureRMStorageAccount_basic(ri, rs, testLocation()) + managedIdentityEnabled := testAccAzureRMStorageAccount_identity(ri, rs, testLocation()) + + uuidMatch := regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMStorageAccountDestroy, + Steps: []resource.TestStep{ + { + Config: basicResourceNoManagedIdentity, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageAccountExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.#", "0"), + ), + }, + { + Config: managedIdentityEnabled, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageAccountExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", uuidMatch), + resource.TestMatchResourceAttr(resourceName, "identity.0.tenant_id", uuidMatch), + ), + }, + }, + }) +} + +func TestAccAzureRMStorageAccount_networkRules(t *testing.T) { + resourceName := "azurerm_storage_account.testsa" + ri := acctest.RandInt() + rs := acctest.RandString(4) + location := testLocation() + preConfig := testAccAzureRMStorageAccount_networkRules(ri, rs, location) + postConfig := testAccAzureRMStorageAccount_networkRulesUpdate(ri, rs, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMStorageAccountDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageAccountExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "network_rules.0.ip_rules.#", "1"), + resource.TestCheckResourceAttr(resourceName, "network_rules.0.virtual_network_subnet_ids.#", "1"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageAccountExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "network_rules.0.ip_rules.#", "2"), + resource.TestCheckResourceAttr(resourceName, "network_rules.0.virtual_network_subnet_ids.#", "0"), + resource.TestCheckResourceAttr(resourceName, "network_rules.0.bypass.#", "2"), + ), + }, + }, + }) +} + +func TestAccAzureRMStorageAccount_networkRulesDeleted(t *testing.T) { + resourceName := "azurerm_storage_account.testsa" + ri := acctest.RandInt() + rs := acctest.RandString(4) + location := testLocation() + preConfig := testAccAzureRMStorageAccount_networkRules(ri, rs, location) + postConfig := testAccAzureRMStorageAccount_basic(ri, rs, location) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMStorageAccountDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageAccountExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "network_rules.0.ip_rules.#", "1"), + resource.TestCheckResourceAttr(resourceName, "network_rules.0.virtual_network_subnet_ids.#", "1"), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageAccountExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "network_rules.#", "0"), + ), + }, + }, + }) +} + func testCheckAzureRMStorageAccountExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API @@ -738,3 +868,103 @@ resource "azurerm_storage_account" "testsa" { } `, rInt, location, rString) } + +func testAccAzureRMStorageAccount_identity(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "testrg" { + name = "testAccAzureRMSA-%d" + location = "%s" +} + +resource "azurerm_storage_account" "testsa" { + name = "unlikely23exst2acct%s" + resource_group_name = "${azurerm_resource_group.testrg.name}" + + location = "${azurerm_resource_group.testrg.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + identity { + type = "SystemAssigned" + } + + tags { + environment = "production" + } +} +`, rInt, location, rString) +} + +func testAccAzureRMStorageAccount_networkRules(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "testrg" { + name = "testAccAzureRMSA-%d" + location = "%s" +} +resource "azurerm_virtual_network" "test" { + name = "acctestvirtnet%d" + address_space = ["10.0.0.0/16"] + location = "${azurerm_resource_group.testrg.location}" + resource_group_name = "${azurerm_resource_group.testrg.name}" +} +resource "azurerm_subnet" "test" { + name = "acctestsubnet%d" + resource_group_name = "${azurerm_resource_group.testrg.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" + service_endpoints = ["Microsoft.Storage"] + } +resource "azurerm_storage_account" "testsa" { + name = "unlikely23exst2acct%s" + resource_group_name = "${azurerm_resource_group.testrg.name}" + location = "${azurerm_resource_group.testrg.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + network_rules { + ip_rules = ["127.0.0.1"] + virtual_network_subnet_ids = ["${azurerm_subnet.test.id}"] + } + tags { + environment = "production" + } +} +`, rInt, location, rInt, rInt, rString) +} + +func testAccAzureRMStorageAccount_networkRulesUpdate(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "testrg" { + name = "testAccAzureRMSA-%d" + location = "%s" +} +resource "azurerm_virtual_network" "test" { + name = "acctestvirtnet%d" + address_space = ["10.0.0.0/16"] + location = "${azurerm_resource_group.testrg.location}" + resource_group_name = "${azurerm_resource_group.testrg.name}" +} +resource "azurerm_subnet" "test" { + name = "acctestsubnet%d" + resource_group_name = "${azurerm_resource_group.testrg.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" + service_endpoints = ["Microsoft.Storage"] + } +resource "azurerm_storage_account" "testsa" { + name = "unlikely23exst2acct%s" + resource_group_name = "${azurerm_resource_group.testrg.name}" + location = "${azurerm_resource_group.testrg.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + network_rules { + ip_rules = ["127.0.0.1", "127.0.0.2"] + bypass = ["Logging", "Metrics"] + } + tags { + environment = "production" + } +} +`, rInt, location, rInt, rInt, rString) +} diff --git a/azurerm/resource_arm_storage_blob.go b/azurerm/resource_arm_storage_blob.go index dffc59b68496d..ca40247cae1f7 100644 --- a/azurerm/resource_arm_storage_blob.go +++ b/azurerm/resource_arm_storage_blob.go @@ -20,6 +20,7 @@ func resourceArmStorageBlob() *schema.Resource { return &schema.Resource{ Create: resourceArmStorageBlobCreate, Read: resourceArmStorageBlobRead, + Update: resourceArmStorageBlobUpdate, Exists: resourceArmStorageBlobExists, Delete: resourceArmStorageBlobDelete, @@ -53,6 +54,12 @@ func resourceArmStorageBlob() *schema.Resource { Default: 0, ValidateFunc: validateArmStorageBlobSize, }, + "content_type": { + Type: schema.TypeString, + Optional: true, + Default: "application/octet-stream", + ConflictsWith: []string{"source_uri"}, + }, "source": { Type: schema.TypeString, Optional: true, @@ -149,6 +156,7 @@ func resourceArmStorageBlobCreate(d *schema.ResourceData, meta interface{}) erro blobType := d.Get("type").(string) cont := d.Get("storage_container_name").(string) sourceUri := d.Get("source_uri").(string) + contentType := d.Get("content_type").(string) log.Printf("[INFO] Creating blob %q in storage account %q", name, storageAccountName) if sourceUri != "" { @@ -174,7 +182,7 @@ func resourceArmStorageBlobCreate(d *schema.ResourceData, meta interface{}) erro if source != "" { parallelism := d.Get("parallelism").(int) attempts := d.Get("attempts").(int) - if err := resourceArmStorageBlobBlockUploadFromSource(cont, name, source, blobClient, parallelism, attempts); err != nil { + if err := resourceArmStorageBlobBlockUploadFromSource(cont, name, source, contentType, blobClient, parallelism, attempts); err != nil { return fmt.Errorf("Error creating storage blob on Azure: %s", err) } } @@ -183,7 +191,7 @@ func resourceArmStorageBlobCreate(d *schema.ResourceData, meta interface{}) erro if source != "" { parallelism := d.Get("parallelism").(int) attempts := d.Get("attempts").(int) - if err := resourceArmStorageBlobPageUploadFromSource(cont, name, source, blobClient, parallelism, attempts); err != nil { + if err := resourceArmStorageBlobPageUploadFromSource(cont, name, source, contentType, blobClient, parallelism, attempts); err != nil { return fmt.Errorf("Error creating storage blob on Azure: %s", err) } } else { @@ -193,6 +201,7 @@ func resourceArmStorageBlobCreate(d *schema.ResourceData, meta interface{}) erro container := blobClient.GetContainerReference(cont) blob := container.GetBlobReference(name) blob.Properties.ContentLength = size + blob.Properties.ContentType = contentType err := blob.PutPageBlob(options) if err != nil { return fmt.Errorf("Error creating storage blob on Azure: %s", err) @@ -210,7 +219,7 @@ type resourceArmStorageBlobPage struct { section *io.SectionReader } -func resourceArmStorageBlobPageUploadFromSource(container, name, source string, client *storage.BlobStorageClient, parallelism, attempts int) error { +func resourceArmStorageBlobPageUploadFromSource(container, name, source, contentType string, client *storage.BlobStorageClient, parallelism, attempts int) error { workerCount := parallelism * runtime.NumCPU() file, err := os.Open(source) @@ -228,6 +237,7 @@ func resourceArmStorageBlobPageUploadFromSource(container, name, source string, containerRef := client.GetContainerReference(container) blob := containerRef.GetBlobReference(name) blob.Properties.ContentLength = blobSize + blob.Properties.ContentType = contentType err = blob.PutPageBlob(options) if err != nil { return fmt.Errorf("Error creating storage blob on Azure: %s", err) @@ -387,7 +397,7 @@ type resourceArmStorageBlobBlock struct { id string } -func resourceArmStorageBlobBlockUploadFromSource(container, name, source string, client *storage.BlobStorageClient, parallelism, attempts int) error { +func resourceArmStorageBlobBlockUploadFromSource(container, name, source, contentType string, client *storage.BlobStorageClient, parallelism, attempts int) error { workerCount := parallelism * runtime.NumCPU() file, err := os.Open(source) @@ -432,6 +442,7 @@ func resourceArmStorageBlobBlockUploadFromSource(container, name, source string, containerReference := client.GetContainerReference(container) blobReference := containerReference.GetBlobReference(name) + blobReference.Properties.ContentType = contentType options := &storage.PutBlockListOptions{} err = blobReference.PutBlockList(blockList, options) if err != nil { @@ -524,6 +535,40 @@ func resourceArmStorageBlobBlockUploadWorker(ctx resourceArmStorageBlobBlockUplo } } +func resourceArmStorageBlobUpdate(d *schema.ResourceData, meta interface{}) error { + armClient := meta.(*ArmClient) + ctx := armClient.StopContext + + resourceGroupName := d.Get("resource_group_name").(string) + storageAccountName := d.Get("storage_account_name").(string) + + blobClient, accountExists, err := armClient.getBlobStorageClientForStorageAccount(ctx, resourceGroupName, storageAccountName) + if err != nil { + return fmt.Errorf("Error getting storage account %s: %+v", storageAccountName, err) + } + if !accountExists { + return fmt.Errorf("Storage account %s not found in resource group %s", storageAccountName, resourceGroupName) + } + + name := d.Get("name").(string) + storageContainerName := d.Get("storage_container_name").(string) + + container := blobClient.GetContainerReference(storageContainerName) + blob := container.GetBlobReference(name) + + if d.HasChange("content_type") { + blob.Properties.ContentType = d.Get("content_type").(string) + } + + options := &storage.SetBlobPropertiesOptions{} + err = blob.SetProperties(options) + if err != nil { + return fmt.Errorf("Error setting properties of blob %s (container %s, storage account %s): %+v", name, storageContainerName, storageAccountName, err) + } + + return nil +} + func resourceArmStorageBlobRead(d *schema.ResourceData, meta interface{}) error { armClient := meta.(*ArmClient) ctx := armClient.StopContext @@ -556,6 +601,14 @@ func resourceArmStorageBlobRead(d *schema.ResourceData, meta interface{}) error container := blobClient.GetContainerReference(storageContainerName) blob := container.GetBlobReference(name) + + options := &storage.GetBlobPropertiesOptions{} + err = blob.GetProperties(options) + if err != nil { + return fmt.Errorf("Error getting properties of blob %s (container %s, storage account %s): %+v", name, storageContainerName, storageAccountName, err) + } + d.Set("content_type", blob.Properties.ContentType) + url := blob.GetURL() if url == "" { log.Printf("[INFO] URL for %q is empty", name) diff --git a/azurerm/resource_arm_storage_blob_test.go b/azurerm/resource_arm_storage_blob_test.go index 2fea86ff48506..116a70fa7cece 100644 --- a/azurerm/resource_arm_storage_blob_test.go +++ b/azurerm/resource_arm_storage_blob_test.go @@ -314,6 +314,51 @@ func TestAccAzureRMStorageBlob_source_uri(t *testing.T) { }) } +func TestAccAzureRMStorageBlobBlock_blockContentType(t *testing.T) { + resourceName := "azurerm_storage_blob.source" + ri := acctest.RandInt() + rs1 := strings.ToLower(acctest.RandString(11)) + sourceBlob, err := ioutil.TempFile("", "") + if err != nil { + t.Fatalf("Failed to create local source blob file") + } + + _, err = io.CopyN(sourceBlob, rand.Reader, 25*1024*1024) + if err != nil { + t.Fatalf("Failed to write random test to source blob") + } + + err = sourceBlob.Close() + if err != nil { + t.Fatalf("Failed to close source blob") + } + + config := testAccAzureRMStorageBlobPage_blockContentType(ri, rs1, testLocation(), sourceBlob.Name(), "text/plain") + updateConfig := testAccAzureRMStorageBlobPage_blockContentType(ri, rs1, testLocation(), sourceBlob.Name(), "text/vnd.terraform.acctest.tmpfile") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMStorageBlobDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageBlobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "content_type", "text/plain"), + ), + }, + { + Config: updateConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageBlobExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "content_type", "text/vnd.terraform.acctest.tmpfile"), + ), + }, + }, + }) +} + func testCheckAzureRMStorageBlobExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -666,3 +711,45 @@ resource "azurerm_storage_blob" "destination" { } `, rInt, location, rString, sourceBlobName) } + +func testAccAzureRMStorageBlobPage_blockContentType(rInt int, rString, location string, sourceBlobName, contentType string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_storage_account" "source" { + name = "acctestacc%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + tags { + environment = "staging" + } +} + +resource "azurerm_storage_container" "source" { + name = "source" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.source.name}" + container_access_type = "blob" +} + +resource "azurerm_storage_blob" "source" { + name = "source.vhd" + + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.source.name}" + storage_container_name = "${azurerm_storage_container.source.name}" + + type = "page" + source = "%s" + content_type = "%s" + parallelism = 3 + attempts = 3 +} +`, rInt, location, rString, sourceBlobName, contentType) +} diff --git a/azurerm/resource_arm_storage_share_test.go b/azurerm/resource_arm_storage_share_test.go index df13f8622eb78..3b227400950f0 100644 --- a/azurerm/resource_arm_storage_share_test.go +++ b/azurerm/resource_arm_storage_share_test.go @@ -225,7 +225,7 @@ func TestValidateArmStorageShareName(t *testing.T) { func testAccAzureRMStorageShare_basic(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_subnet.go b/azurerm/resource_arm_subnet.go index ae144bd5364f2..16bb645dccd43 100644 --- a/azurerm/resource_arm_subnet.go +++ b/azurerm/resource_arm_subnet.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/resource_arm_traffic_manager_endpoint_test.go b/azurerm/resource_arm_traffic_manager_endpoint_test.go index 2b2ed6a42afc3..838b805a96150 100644 --- a/azurerm/resource_arm_traffic_manager_endpoint_test.go +++ b/azurerm/resource_arm_traffic_manager_endpoint_test.go @@ -754,7 +754,7 @@ resource "azurerm_traffic_manager_endpoint" "test" { func testAccAzureRMTrafficManagerEndpoint_geoMappings(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -793,7 +793,7 @@ resource "azurerm_traffic_manager_endpoint" "test" { func testAccAzureRMTrafficManagerEndpoint_geoMappingsUpdated(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_traffic_manager_profile_test.go b/azurerm/resource_arm_traffic_manager_profile_test.go index e251fe18f5c0b..ea1576aa9989e 100644 --- a/azurerm/resource_arm_traffic_manager_profile_test.go +++ b/azurerm/resource_arm_traffic_manager_profile_test.go @@ -181,6 +181,78 @@ func TestAccAzureRMTrafficManagerProfile_withTags(t *testing.T) { }) } +func TestAccAzureRMTrafficManagerProfile_performanceToGeographic(t *testing.T) { + resourceName := "azurerm_traffic_manager_profile.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMTrafficManagerProfile_performance(ri, testLocation()) + postConfig := testAccAzureRMTrafficManagerProfile_geographic(ri, testLocation()) + + fqdn, err := getTrafficManagerFQDN(fmt.Sprintf("acctesttmp%d", ri)) + if err != nil { + t.Fatalf("Error obtaining Azure Region: %+v", err) + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMTrafficManagerProfileDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMTrafficManagerProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "traffic_routing_method", "Performance"), + resource.TestCheckResourceAttr(resourceName, "fqdn", fqdn), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMTrafficManagerProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "traffic_routing_method", "Geographic"), + resource.TestCheckResourceAttr(resourceName, "fqdn", fqdn), + ), + }, + }, + }) +} + +func TestAccAzureRMTrafficManagerProfile_priorityToWeighted(t *testing.T) { + resourceName := "azurerm_traffic_manager_profile.test" + ri := acctest.RandInt() + preConfig := testAccAzureRMTrafficManagerProfile_priority(ri, testLocation()) + postConfig := testAccAzureRMTrafficManagerProfile_weighted(ri, testLocation()) + + fqdn, err := getTrafficManagerFQDN(fmt.Sprintf("acctesttmp%d", ri)) + if err != nil { + t.Fatalf("Error obtaining Azure Region: %+v", err) + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMTrafficManagerProfileDestroy, + Steps: []resource.TestStep{ + { + Config: preConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMTrafficManagerProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "traffic_routing_method", "Priority"), + resource.TestCheckResourceAttr(resourceName, "fqdn", fqdn), + ), + }, + { + Config: postConfig, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMTrafficManagerProfileExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "traffic_routing_method", "Weighted"), + resource.TestCheckResourceAttr(resourceName, "fqdn", fqdn), + ), + }, + }, + }) +} + func testCheckAzureRMTrafficManagerProfileExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API diff --git a/azurerm/resource_arm_user_assigned_identity.go b/azurerm/resource_arm_user_assigned_identity.go new file mode 100644 index 0000000000000..768086bbb72f0 --- /dev/null +++ b/azurerm/resource_arm_user_assigned_identity.go @@ -0,0 +1,133 @@ +package azurerm + +import ( + "fmt" + "log" + + "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi" + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmUserAssignedIdentity() *schema.Resource { + return &schema.Resource{ + Create: resourceArmUserAssignedIdentityCreateUpdate, + Read: resourceArmUserAssignedIdentityRead, + Update: resourceArmUserAssignedIdentityCreateUpdate, + Delete: resourceArmUserAssignedIdentityDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 24), + }, + + "resource_group_name": resourceGroupNameSchema(), + + "location": locationSchema(), + + "tags": tagsSchema(), + + "principal_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceArmUserAssignedIdentityCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).userAssignedIdentitiesClient + ctx := meta.(*ArmClient).StopContext + + log.Printf("[INFO] preparing arguments for Azure ARM user identity creation.") + + name := d.Get("name").(string) + location := d.Get("location").(string) + resGroup := d.Get("resource_group_name").(string) + tags := d.Get("tags").(map[string]interface{}) + identity := msi.Identity{ + Name: &name, + Location: &location, + Tags: expandTags(tags), + } + + _, err := client.CreateOrUpdate(ctx, resGroup, name, identity) + if err != nil { + return fmt.Errorf("Error Creating/Updating User Assigned Identity %q (Resource Group %q): %+v", name, resGroup, err) + } + + read, err := client.Get(ctx, resGroup, name) + if err != nil { + return err + } + + if read.ID == nil { + return fmt.Errorf("Cannot read User Assigned Identity %q ID (resource group %q) ID", name, resGroup) + } + + d.SetId(*read.ID) + + return resourceArmUserAssignedIdentityRead(d, meta) +} + +func resourceArmUserAssignedIdentityRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).userAssignedIdentitiesClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + resGroup := id.ResourceGroup + name := id.Path["userAssignedIdentities"] + resp, err := client.Get(ctx, resGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("Error making Read request on User Assigned Identity %q (Resource Group %q): %+v", name, resGroup, err) + } + + d.Set("name", resp.Name) + d.Set("resource_group_name", resGroup) + d.Set("location", resp.Location) + + if props := resp.IdentityProperties; props != nil { + if principalId := props.PrincipalID; principalId != nil { + d.Set("principal_id", principalId.String()) + } + } + + flattenAndSetTags(d, resp.Tags) + + return nil +} + +func resourceArmUserAssignedIdentityDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).userAssignedIdentitiesClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + resGroup := id.ResourceGroup + name := id.Path["userAssignedIdentities"] + + _, err = client.Delete(ctx, resGroup, name) + if err != nil { + return fmt.Errorf("Error deleting User Assigned Identity %q (Resource Group %q): %+v", name, resGroup, err) + } + + return nil +} diff --git a/azurerm/resource_arm_user_assigned_identity_test.go b/azurerm/resource_arm_user_assigned_identity_test.go new file mode 100644 index 0000000000000..6dc61cc0525d4 --- /dev/null +++ b/azurerm/resource_arm_user_assigned_identity_test.go @@ -0,0 +1,108 @@ +package azurerm + +import ( + "fmt" + "regexp" + "testing" + + "net/http" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAzureRMUserAssignedIdentity_basic(t *testing.T) { + principalIdRegex := "^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$" + resourceName := "azurerm_user_assigned_identity.test" + ri := acctest.RandInt() + rs := acctest.RandString(14) + config := testAccAzureRMUserAssignedIdentity_basic(ri, testLocation(), rs) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMUserAssignedIdentityDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMUserAssignedIdentityExists(resourceName), + resource.TestMatchResourceAttr(resourceName, "principal_id", regexp.MustCompile(principalIdRegex)), + ), + }, + }, + }) +} + +func testCheckAzureRMUserAssignedIdentityExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + // Ensure we have enough information in state to look up in API + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %s", resourceName) + } + + name := rs.Primary.Attributes["name"] + resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] + if !hasResourceGroup { + return fmt.Errorf("Bad: no resource group found in state for virtual machine: %s", name) + } + + client := testAccProvider.Meta().(*ArmClient).userAssignedIdentitiesClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("Bad: Get on userAssignedIdentitiesClient: %+v", err) + } + + if resp.StatusCode == http.StatusNotFound { + return fmt.Errorf("Bad: User Assigned Identity %q (resource group: %q) does not exist", name, resourceGroup) + } + + return nil + } +} + +func testCheckAzureRMUserAssignedIdentityDestroy(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).userAssignedIdentitiesClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_virtual_machine" { + continue + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := client.Get(ctx, resourceGroup, name) + + if err != nil { + if resp.StatusCode == http.StatusNotFound { + return nil + } + + return err + } + + return fmt.Errorf("User Assigned Identity still exists:\n%#v", resp) + } + + return nil +} + +func testAccAzureRMUserAssignedIdentity_basic(rInt int, location string, rString string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" +} +`, rInt, location, rString) +} diff --git a/azurerm/resource_arm_virtual_machine.go b/azurerm/resource_arm_virtual_machine.go index e5fb9e52dc513..1eb3a49999da1 100644 --- a/azurerm/resource_arm_virtual_machine.go +++ b/azurerm/resource_arm_virtual_machine.go @@ -15,6 +15,8 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) +var virtualMachineResourceName = "azurerm_virtual_machine" + func resourceArmVirtualMachine() *schema.Resource { return &schema.Resource{ Create: resourceArmVirtualMachineCreate, @@ -84,13 +86,21 @@ func resourceArmVirtualMachine() *schema.Resource { Required: true, DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ - "SystemAssigned", - }, true), + string(compute.ResourceIdentityTypeSystemAssigned), + string(compute.ResourceIdentityTypeUserAssigned), + }, false), }, "principal_id": { Type: schema.TypeString, Computed: true, }, + "identity_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, }, }, }, @@ -229,6 +239,12 @@ func resourceArmVirtualMachine() *schema.Resource { Computed: true, ValidateFunc: validateDiskSizeGB, }, + + "write_accelerator_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, }, }, @@ -242,6 +258,7 @@ func resourceArmVirtualMachine() *schema.Resource { "storage_data_disk": { Type: schema.TypeList, Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -294,6 +311,12 @@ func resourceArmVirtualMachine() *schema.Resource { Type: schema.TypeInt, Required: true, }, + + "write_accelerator_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, }, }, @@ -374,6 +397,13 @@ func resourceArmVirtualMachine() *schema.Resource { Optional: true, Default: false, }, + "timezone": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: validateAzureVirtualMachineTimeZone(), + }, "winrm": { Type: schema.TypeList, Optional: true, @@ -408,8 +438,9 @@ func resourceArmVirtualMachine() *schema.Resource { Required: true, }, "content": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Sensitive: true, }, }, }, @@ -598,6 +629,9 @@ func resourceArmVirtualMachineCreate(d *schema.ResourceData, meta interface{}) e vm.Plan = plan } + azureRMLockByName(name, virtualMachineResourceName) + defer azureRMUnlockByName(name, virtualMachineResourceName) + future, err := client.CreateOrUpdate(ctx, resGroup, name, vm) if err != nil { return err @@ -755,6 +789,9 @@ func resourceArmVirtualMachineDelete(d *schema.ResourceData, meta interface{}) e resGroup := id.ResourceGroup name := id.Path["virtualMachines"] + azureRMLockByName(name, virtualMachineResourceName) + defer azureRMUnlockByName(name, virtualMachineResourceName) + future, err := client.Delete(ctx, resGroup, name) if err != nil { return err @@ -815,32 +852,38 @@ func resourceArmVirtualMachineDelete(d *schema.ResourceData, meta interface{}) e } func resourceArmVirtualMachineDeleteVhd(uri string, meta interface{}) error { + armClient := meta.(*ArmClient) + ctx := armClient.StopContext + environment := armClient.environment + vhdURL, err := url.Parse(uri) if err != nil { return fmt.Errorf("Cannot parse Disk VHD URI: %s", err) } + blobDomainSuffix := environment.StorageEndpointSuffix + if !strings.HasSuffix(strings.ToLower(vhdURL.Host), strings.ToLower(blobDomainSuffix)) { + return fmt.Errorf("Error: Disk VHD URI %q doesn't appear to be a Blob Storage URI (%q) - expected a suffix of %q)", uri, vhdURL.Host, blobDomainSuffix) + } + // VHD URI is in the form: https://storageAccountName.blob.core.windows.net/containerName/blobName storageAccountName := strings.Split(vhdURL.Host, ".")[0] path := strings.Split(strings.TrimPrefix(vhdURL.Path, "/"), "/") containerName := path[0] blobName := path[1] - storageAccountResourceGroupName, err := findStorageAccountResourceGroup(meta, storageAccountName) + resourceGroupName, err := findStorageAccountResourceGroup(meta, storageAccountName) if err != nil { return fmt.Errorf("Error finding resource group for storage account %s: %+v", storageAccountName, err) } - armClient := meta.(*ArmClient) - ctx := armClient.StopContext - - blobClient, saExists, err := armClient.getBlobStorageClientForStorageAccount(ctx, storageAccountResourceGroupName, storageAccountName) + blobClient, saExists, err := armClient.getBlobStorageClientForStorageAccount(ctx, resourceGroupName, storageAccountName) if err != nil { return fmt.Errorf("Error creating blob store client for VHD deletion: %+v", err) } if !saExists { - log.Printf("[INFO] Storage Account %q in resource group %q doesn't exist so the VHD blob won't exist", storageAccountName, storageAccountResourceGroupName) + log.Printf("[INFO] Storage Account %q in resource group %q doesn't exist so the VHD blob won't exist", storageAccountName, resourceGroupName) return nil } @@ -921,6 +964,14 @@ func flattenAzureRmVirtualMachineIdentity(identity *compute.VirtualMachineIdenti result["principal_id"] = *identity.PrincipalID } + identity_ids := make([]string, 0) + if identity.IdentityIds != nil { + for _, id := range *identity.IdentityIds { + identity_ids = append(identity_ids, id) + } + } + result["identity_ids"] = identity_ids + return []interface{}{result} } @@ -990,6 +1041,10 @@ func flattenAzureRmVirtualMachineDataDisk(disks *[]compute.DataDisk, disksInfo [ } l["lun"] = *disk.Lun + if v := disk.WriteAcceleratorEnabled; v != nil { + l["write_accelerator_enabled"] = *disk.WriteAcceleratorEnabled + } + flattenAzureRmVirtualMachineReviseDiskInfo(l, disksInfo[i]) result[i] = l @@ -1019,6 +1074,10 @@ func flattenAzureRmVirtualMachineOsProfileWindowsConfiguration(config *compute.W result["enable_automatic_upgrades"] = *config.EnableAutomaticUpdates } + if config.TimeZone != nil { + result["timezone"] = *config.TimeZone + } + if config.WinRM != nil { listeners := make([]map[string]interface{}, 0, len(*config.WinRM.Listeners)) for _, i := range *config.WinRM.Listeners { @@ -1099,6 +1158,10 @@ func flattenAzureRmVirtualMachineOsDisk(disk *compute.OSDisk, diskInfo *compute. } result["os_type"] = string(disk.OsType) + if v := disk.WriteAcceleratorEnabled; v != nil { + result["write_accelerator_enabled"] = *disk.WriteAcceleratorEnabled + } + flattenAzureRmVirtualMachineReviseDiskInfo(result, diskInfo) return []interface{}{result} @@ -1135,10 +1198,22 @@ func expandAzureRmVirtualMachineIdentity(d *schema.ResourceData) *compute.Virtua v := d.Get("identity") identities := v.([]interface{}) identity := identities[0].(map[string]interface{}) - identityType := identity["type"].(string) - return &compute.VirtualMachineIdentity{ - Type: compute.ResourceIdentityType(identityType), + identityType := compute.ResourceIdentityType(identity["type"].(string)) + + identityIds := []string{} + for _, id := range identity["identity_ids"].([]interface{}) { + identityIds = append(identityIds, id.(string)) + } + + vmIdentity := compute.VirtualMachineIdentity{ + Type: identityType, } + + if vmIdentity.Type == compute.ResourceIdentityTypeUserAssigned { + vmIdentity.IdentityIds = &identityIds + } + + return &vmIdentity } func expandAzureRmVirtualMachineOsProfile(d *schema.ResourceData) (*compute.OSProfile, error) { @@ -1291,6 +1366,10 @@ func expandAzureRmVirtualMachineOsProfileWindowsConfig(d *schema.ResourceData) ( config.EnableAutomaticUpdates = &update } + if v := osProfileConfig["timezone"]; v != nil && v.(string) != "" { + config.TimeZone = utils.String(v.(string)) + } + if v := osProfileConfig["winrm"]; v != nil { winRm := v.([]interface{}) if len(winRm) > 0 { @@ -1393,9 +1472,12 @@ func expandAzureRmVirtualMachineDataDisk(d *schema.ResourceData) ([]compute.Data data_disk.Caching = compute.CachingTypes(v) } - if v := config["disk_size_gb"]; v != nil { - diskSize := int32(config["disk_size_gb"].(int)) - data_disk.DiskSizeGB = &diskSize + if v, ok := config["disk_size_gb"].(int); ok { + data_disk.DiskSizeGB = utils.Int32(int32(v)) + } + + if v, ok := config["write_accelerator_enabled"].(bool); ok { + data_disk.WriteAcceleratorEnabled = utils.Bool(v) } data_disks = append(data_disks, data_disk) @@ -1542,8 +1624,11 @@ func expandAzureRmVirtualMachineOsDisk(d *schema.ResourceData) (*compute.OSDisk, } if v := config["disk_size_gb"].(int); v != 0 { - diskSize := int32(v) - osDisk.DiskSizeGB = &diskSize + osDisk.DiskSizeGB = utils.Int32(int32(v)) + } + + if v, ok := config["write_accelerator_enabled"].(bool); ok { + osDisk.WriteAcceleratorEnabled = utils.Bool(v) } return osDisk, nil @@ -1595,6 +1680,9 @@ func resourceArmVirtualMachineStorageOsProfileWindowsConfigHash(v interface{}) i if v, ok := m["enable_automatic_upgrades"]; ok { buf.WriteString(fmt.Sprintf("%t-", v.(bool))) } + if v, ok := m["timezone"]; ok { + buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(v.(string)))) + } } return hashcode.String(buf.String()) diff --git a/azurerm/resource_arm_virtual_machine_data_disk_attachment.go b/azurerm/resource_arm_virtual_machine_data_disk_attachment.go new file mode 100644 index 0000000000000..bd440e4d32578 --- /dev/null +++ b/azurerm/resource_arm_virtual_machine_data_disk_attachment.go @@ -0,0 +1,298 @@ +package azurerm + +import ( + "fmt" + "log" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmVirtualMachineDataDiskAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceArmVirtualMachineDataDiskAttachmentCreateUpdate, + Read: resourceArmVirtualMachineDataDiskAttachmentRead, + Update: resourceArmVirtualMachineDataDiskAttachmentCreateUpdate, + Delete: resourceArmVirtualMachineDataDiskAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "managed_disk_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: azure.ValidateResourceID, + }, + + "virtual_machine_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "lun": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(0), + }, + + "caching": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.CachingTypesNone), + string(compute.CachingTypesReadOnly), + string(compute.CachingTypesReadWrite), + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + + "create_option": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: string(compute.DiskCreateOptionTypesAttach), + ValidateFunc: validation.StringInSlice([]string{ + string(compute.DiskCreateOptionTypesAttach), + string(compute.DiskCreateOptionTypesEmpty), + }, true), + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + }, + + "write_accelerator_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} + +func resourceArmVirtualMachineDataDiskAttachmentCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).vmClient + ctx := meta.(*ArmClient).StopContext + + virtualMachineId := d.Get("virtual_machine_id").(string) + parsedVirtualMachineId, err := parseAzureResourceID(virtualMachineId) + if err != nil { + return fmt.Errorf("Error parsing Virtual Machine ID %q: %+v", virtualMachineId, err) + } + + resourceGroup := parsedVirtualMachineId.ResourceGroup + virtualMachineName := parsedVirtualMachineId.Path["virtualMachines"] + + azureRMLockByName(virtualMachineName, virtualMachineResourceName) + defer azureRMUnlockByName(virtualMachineName, virtualMachineResourceName) + + virtualMachine, err := client.Get(ctx, resourceGroup, virtualMachineName, compute.InstanceView) + if err != nil { + if utils.ResponseWasNotFound(virtualMachine.Response) { + return fmt.Errorf("Virtual Machine %q (Resource Group %q) was not found", virtualMachineName, resourceGroup) + } + + return fmt.Errorf("Error loading Virtual Machine %q (Resource Group %q): %+v", virtualMachineName, resourceGroup, err) + } + + managedDiskId := d.Get("managed_disk_id").(string) + managedDisk, err := retrieveDataDiskAttachmentManagedDisk(meta, managedDiskId) + if err != nil { + return fmt.Errorf("Error retrieving Managed Disk %q: %+v", managedDiskId, err) + } + + if managedDisk.Sku == nil { + return fmt.Errorf("Error: unable to determine Storage Account Type for Managed Disk %q: %+v", managedDiskId, err) + } + + name := *managedDisk.Name + lun := int32(d.Get("lun").(int)) + caching := d.Get("caching").(string) + createOption := compute.DiskCreateOptionTypes(d.Get("create_option").(string)) + writeAcceleratorEnabled := d.Get("write_accelerator_enabled").(bool) + + expandedDisk := compute.DataDisk{ + Name: utils.String(name), + Caching: compute.CachingTypes(caching), + CreateOption: createOption, + Lun: utils.Int32(lun), + ManagedDisk: &compute.ManagedDiskParameters{ + ID: utils.String(managedDiskId), + StorageAccountType: managedDisk.Sku.Name, + }, + WriteAcceleratorEnabled: utils.Bool(writeAcceleratorEnabled), + } + + disks := *virtualMachine.StorageProfile.DataDisks + if d.IsNewResource() { + disks = append(disks, expandedDisk) + } else { + // iterate over the disks and swap it out in-place + existingIndex := -1 + for i, disk := range disks { + if *disk.Name == name { + existingIndex = i + break + } + } + + if existingIndex == -1 { + return fmt.Errorf("Unable to find Disk %q attached to Virtual Machine %q (Resource Group %q)", name, virtualMachineName, resourceGroup) + } + + disks[existingIndex] = expandedDisk + } + + virtualMachine.StorageProfile.DataDisks = &disks + + // if there's too many disks we get a 409 back with: + // `The maximum number of data disks allowed to be attached to a VM of this size is 1.` + // which we're intentionally not wrapping, since the errors good. + future, err := client.CreateOrUpdate(ctx, resourceGroup, virtualMachineName, virtualMachine) + if err != nil { + return fmt.Errorf("Error updating Virtual Machine %q (Resource Group %q) with Disk %q: %+v", virtualMachineName, resourceGroup, name, err) + } + + err = future.WaitForCompletion(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error waiting for Virtual Machine %q (Resource Group %q) to finish updating Disk %q: %+v", virtualMachineName, resourceGroup, name, err) + } + + d.SetId(fmt.Sprintf("%s/dataDisks/%s", virtualMachineId, name)) + + return resourceArmVirtualMachineDataDiskAttachmentRead(d, meta) +} + +func resourceArmVirtualMachineDataDiskAttachmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).vmClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + resourceGroup := id.ResourceGroup + virtualMachineName := id.Path["virtualMachines"] + name := id.Path["dataDisks"] + + virtualMachine, err := client.Get(ctx, resourceGroup, virtualMachineName, "") + if err != nil { + if utils.ResponseWasNotFound(virtualMachine.Response) { + return fmt.Errorf("Virtual Machine %q (Resource Group %q) was not found", virtualMachineName, resourceGroup) + } + + return fmt.Errorf("Error loading Virtual Machine %q (Resource Group %q): %+v", virtualMachineName, resourceGroup, err) + } + + var disk *compute.DataDisk + if profile := virtualMachine.StorageProfile; profile != nil { + if dataDisks := profile.DataDisks; dataDisks != nil { + for _, dataDisk := range *dataDisks { + // since this field isn't (and shouldn't be) case-sensitive; we're deliberately not using `strings.EqualFold` + if *dataDisk.Name == name { + disk = &dataDisk + break + } + } + } + } + + if disk == nil { + log.Printf("[DEBUG] Data Disk %q was not found on Virtual Machine %q (Resource Group %q) - removing from state", name, virtualMachineName, resourceGroup) + d.SetId("") + return nil + } + + d.Set("virtual_machine_id", virtualMachine.ID) + d.Set("caching", string(disk.Caching)) + d.Set("create_option", string(disk.CreateOption)) + d.Set("write_accelerator_enabled", disk.WriteAcceleratorEnabled) + + if managedDisk := disk.ManagedDisk; managedDisk != nil { + d.Set("managed_disk_id", managedDisk.ID) + } + + if lun := disk.Lun; lun != nil { + d.Set("lun", int(*lun)) + } + + return nil +} + +func resourceArmVirtualMachineDataDiskAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).vmClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + resourceGroup := id.ResourceGroup + virtualMachineName := id.Path["virtualMachines"] + name := id.Path["dataDisks"] + + azureRMLockByName(virtualMachineName, virtualMachineResourceName) + defer azureRMUnlockByName(virtualMachineName, virtualMachineResourceName) + + virtualMachine, err := client.Get(ctx, resourceGroup, virtualMachineName, "") + if err != nil { + if utils.ResponseWasNotFound(virtualMachine.Response) { + return fmt.Errorf("Virtual Machine %q (Resource Group %q) was not found", virtualMachineName, resourceGroup) + } + + return fmt.Errorf("Error loading Virtual Machine %q (Resource Group %q): %+v", virtualMachineName, resourceGroup, err) + } + + dataDisks := make([]compute.DataDisk, 0) + for _, dataDisk := range *virtualMachine.StorageProfile.DataDisks { + // since this field isn't (and shouldn't be) case-sensitive; we're deliberately not using `strings.EqualFold` + if *dataDisk.Name != name { + dataDisks = append(dataDisks, dataDisk) + } + } + + virtualMachine.StorageProfile.DataDisks = &dataDisks + + future, err := client.CreateOrUpdate(ctx, resourceGroup, virtualMachineName, virtualMachine) + if err != nil { + return fmt.Errorf("Error removing Disk %q from Virtual Machine %q (Resource Group %q): %+v", name, virtualMachineName, resourceGroup, err) + } + + err = future.WaitForCompletion(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error waiting for Disk %q to be removed from Virtual Machine %q (Resource Group %q): %+v", name, virtualMachineName, resourceGroup, err) + } + + return nil +} + +func retrieveDataDiskAttachmentManagedDisk(meta interface{}, id string) (*compute.Disk, error) { + client := meta.(*ArmClient).diskClient + ctx := meta.(*ArmClient).StopContext + + parsedId, err := parseAzureResourceID(id) + if err != nil { + return nil, fmt.Errorf("Error parsing Managed Disk ID %q: %+v", id, err) + } + resourceGroup := parsedId.ResourceGroup + name := parsedId.Path["disks"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return nil, fmt.Errorf("Error Managed Disk %q (Resource Group %q) was not found!", name, resourceGroup) + } + + return nil, fmt.Errorf("Error making Read request on Azure Managed Disk %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + return &resp, nil +} diff --git a/azurerm/resource_arm_virtual_machine_data_disk_attachment_test.go b/azurerm/resource_arm_virtual_machine_data_disk_attachment_test.go new file mode 100644 index 0000000000000..5cfcb8cd44c34 --- /dev/null +++ b/azurerm/resource_arm_virtual_machine_data_disk_attachment_test.go @@ -0,0 +1,462 @@ +package azurerm + +import ( + "fmt" + "net/http" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func TestAccAzureRMVirtualMachineDataDiskAttachment_basic(t *testing.T) { + resourceName := "azurerm_virtual_machine_data_disk_attachment.test" + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMVirtualMachineDataDiskAttachment_basic(ri, location) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDataDiskAttachmentDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "virtual_machine_id"), + resource.TestCheckResourceAttrSet(resourceName, "managed_disk_id"), + resource.TestCheckResourceAttr(resourceName, "lun", "0"), + resource.TestCheckResourceAttr(resourceName, "caching", "None"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineDataDiskAttachment_multipleDisks(t *testing.T) { + firstResourceName := "azurerm_virtual_machine_data_disk_attachment.first" + secondResourceName := "azurerm_virtual_machine_data_disk_attachment.second" + ri := acctest.RandInt() + location := testLocation() + config := testAccAzureRMVirtualMachineDataDiskAttachment_multipleDisks(ri, location) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDataDiskAttachmentDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(firstResourceName), + resource.TestCheckResourceAttrSet(firstResourceName, "virtual_machine_id"), + resource.TestCheckResourceAttrSet(firstResourceName, "managed_disk_id"), + resource.TestCheckResourceAttr(firstResourceName, "lun", "10"), + resource.TestCheckResourceAttr(firstResourceName, "caching", "None"), + + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(secondResourceName), + resource.TestCheckResourceAttrSet(secondResourceName, "virtual_machine_id"), + resource.TestCheckResourceAttrSet(secondResourceName, "managed_disk_id"), + resource.TestCheckResourceAttr(secondResourceName, "lun", "20"), + resource.TestCheckResourceAttr(secondResourceName, "caching", "ReadOnly"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineDataDiskAttachment_updatingCaching(t *testing.T) { + resourceName := "azurerm_virtual_machine_data_disk_attachment.test" + ri := acctest.RandInt() + location := testLocation() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDataDiskAttachmentDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMVirtualMachineDataDiskAttachment_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "caching", "None"), + ), + }, + { + Config: testAccAzureRMVirtualMachineDataDiskAttachment_readOnly(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "caching", "ReadOnly"), + ), + }, + { + Config: testAccAzureRMVirtualMachineDataDiskAttachment_readWrite(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "caching", "ReadWrite"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineDataDiskAttachment_updatingWriteAccelerator(t *testing.T) { + resourceName := "azurerm_virtual_machine_data_disk_attachment.test" + ri := acctest.RandInt() + location := testAltLocation() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDataDiskAttachmentDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMVirtualMachineDataDiskAttachment_writeAccelerator(ri, location, false), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "write_accelerator_enabled", "false"), + ), + }, + { + Config: testAccAzureRMVirtualMachineDataDiskAttachment_writeAccelerator(ri, location, true), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "write_accelerator_enabled", "true"), + ), + }, + { + Config: testAccAzureRMVirtualMachineDataDiskAttachment_writeAccelerator(ri, location, false), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "write_accelerator_enabled", "false"), + ), + }, + }, + }) +} + +func testCheckAzureRMVirtualMachineDataDiskAttachmentExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + // Ensure we have enough information in state to look up in API + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %s", resourceName) + } + + virtualMachineId := rs.Primary.Attributes["virtual_machine_id"] + + id, err := parseAzureResourceID(virtualMachineId) + if err != nil { + return err + } + + virtualMachineName := id.Path["virtualMachines"] + resourceGroup := id.ResourceGroup + + client := testAccProvider.Meta().(*ArmClient).vmClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + resp, err := client.Get(ctx, resourceGroup, virtualMachineName, "") + if err != nil { + return fmt.Errorf("Bad: Get on vmClient: %+v", err) + } + + if resp.StatusCode == http.StatusNotFound { + return fmt.Errorf("Bad: VirtualMachine %q (resource group: %q) does not exist", virtualMachineName, resourceGroup) + } + + diskId, err := parseAzureResourceID(rs.Primary.ID) + if err != nil { + return err + } + + diskName := diskId.Path["dataDisks"] + + // deliberately not using strings.EqualFold as this is case sensitive + for _, disk := range *resp.StorageProfile.DataDisks { + if *disk.Name == diskName { + return nil + } + } + + return fmt.Errorf("Disk %q was not found on Virtual Machine %q (Resource Group %q)", diskName, virtualMachineName, resourceName) + } +} + +func testCheckAzureRMVirtualMachineDataDiskAttachmentDestroy(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_virtual_machine_data_disk_attachment" { + continue + } + + virtualMachineId := rs.Primary.Attributes["virtual_machine_id"] + + id, err := parseAzureResourceID(virtualMachineId) + if err != nil { + return err + } + + virtualMachineName := id.Path["virtualMachines"] + resourceGroup := id.ResourceGroup + + client := testAccProvider.Meta().(*ArmClient).vmClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + resp, err := client.Get(ctx, resourceGroup, virtualMachineName, "") + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return nil + } + + return fmt.Errorf("Bad: Get on vmClient: %+v", err) + } + + diskId, err := parseAzureResourceID(rs.Primary.ID) + if err != nil { + return err + } + + diskName := diskId.Path["dataDisks"] + + for _, disk := range *resp.StorageProfile.DataDisks { + // deliberately not using strings.Equals as this is case sensitive + if *disk.Name == diskName { + return fmt.Errorf("Disk %q is still attached to Virtual Machine %q (Resource Group %q)", diskName, virtualMachineName, resourceGroup) + } + } + } + + return nil +} + +func testAccAzureRMVirtualMachineDataDiskAttachment_basic(rInt int, location string) string { + template := testAccAzureRMVirtualMachineDataDiskAttachment_template(rInt, location) + return fmt.Sprintf(` +%s + +resource "azurerm_virtual_machine_data_disk_attachment" "test" { + managed_disk_id = "${azurerm_managed_disk.test.id}" + virtual_machine_id = "${azurerm_virtual_machine.test.id}" + lun = "0" + caching = "None" +} +`, template) +} + +func testAccAzureRMVirtualMachineDataDiskAttachment_multipleDisks(rInt int, location string) string { + template := testAccAzureRMVirtualMachineDataDiskAttachment_template(rInt, location) + return fmt.Sprintf(` +%s + +resource "azurerm_virtual_machine_data_disk_attachment" "first" { + managed_disk_id = "${azurerm_managed_disk.test.id}" + virtual_machine_id = "${azurerm_virtual_machine.test.id}" + lun = "10" + caching = "None" +} + +resource "azurerm_managed_disk" "second" { + name = "%d-disk2" + 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 = 10 +} + +resource "azurerm_virtual_machine_data_disk_attachment" "second" { + managed_disk_id = "${azurerm_managed_disk.second.id}" + virtual_machine_id = "${azurerm_virtual_machine.test.id}" + lun = "20" + caching = "ReadOnly" +} +`, template, rInt) +} + +func testAccAzureRMVirtualMachineDataDiskAttachment_readOnly(rInt int, location string) string { + template := testAccAzureRMVirtualMachineDataDiskAttachment_template(rInt, location) + return fmt.Sprintf(` +%s + +resource "azurerm_virtual_machine_data_disk_attachment" "test" { + managed_disk_id = "${azurerm_managed_disk.test.id}" + virtual_machine_id = "${azurerm_virtual_machine.test.id}" + lun = "0" + caching = "ReadOnly" +} +`, template) +} + +func testAccAzureRMVirtualMachineDataDiskAttachment_readWrite(rInt int, location string) string { + template := testAccAzureRMVirtualMachineDataDiskAttachment_template(rInt, location) + return fmt.Sprintf(` +%s + +resource "azurerm_virtual_machine_data_disk_attachment" "test" { + managed_disk_id = "${azurerm_managed_disk.test.id}" + virtual_machine_id = "${azurerm_virtual_machine.test.id}" + lun = "0" + caching = "ReadWrite" +} +`, template) +} + +func testAccAzureRMVirtualMachineDataDiskAttachment_writeAccelerator(rInt int, location string, enabled bool) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%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-%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_M64s" + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + storage_os_disk { + name = "myosdisk1" + caching = "ReadWrite" + create_option = "FromImage" + managed_disk_type = "Premium_LRS" + } + + os_profile { + computer_name = "hn%d" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} + +resource "azurerm_managed_disk" "test" { + name = "%d-disk1" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_type = "Premium_LRS" + create_option = "Empty" + disk_size_gb = 10 +} + +resource "azurerm_virtual_machine_data_disk_attachment" "test" { + managed_disk_id = "${azurerm_managed_disk.test.id}" + virtual_machine_id = "${azurerm_virtual_machine.test.id}" + lun = "0" + caching = "None" + write_accelerator_enabled = "%t" +} + +`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, enabled) +} + +func testAccAzureRMVirtualMachineDataDiskAttachment_template(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%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-%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_F2" + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + storage_os_disk { + name = "myosdisk1" + caching = "ReadWrite" + create_option = "FromImage" + managed_disk_type = "Standard_LRS" + } + + os_profile { + computer_name = "hn%d" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} + +resource "azurerm_managed_disk" "test" { + name = "%d-disk1" + 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 = 10 +} +`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt) +} diff --git a/azurerm/resource_arm_virtual_machine_extension_test.go b/azurerm/resource_arm_virtual_machine_extension_test.go index 0d100e05652ca..9146032a726f6 100644 --- a/azurerm/resource_arm_virtual_machine_extension_test.go +++ b/azurerm/resource_arm_virtual_machine_extension_test.go @@ -142,7 +142,7 @@ func testCheckAzureRMVirtualMachineExtensionDestroy(s *terraform.State) error { func testAccAzureRMVirtualMachineExtension_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -248,7 +248,7 @@ SETTINGS func testAccAzureRMVirtualMachineExtension_basicUpdate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -355,7 +355,7 @@ SETTINGS func testAccAzureRMVirtualMachineExtension_concurrent(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } @@ -473,7 +473,7 @@ SETTINGS func testAccAzureRMVirtualMachineExtension_linuxDiagnostics(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "%s" } diff --git a/azurerm/resource_arm_virtual_machine_managed_disks_test.go b/azurerm/resource_arm_virtual_machine_managed_disks_test.go index 25416804d4690..f2ee63e9adfab 100644 --- a/azurerm/resource_arm_virtual_machine_managed_disks_test.go +++ b/azurerm/resource_arm_virtual_machine_managed_disks_test.go @@ -352,7 +352,7 @@ func TestAccAzureRMVirtualMachine_enableAnWithVM(t *testing.T) { CheckDestroy: testCheckAzureRMVirtualMachineDestroy, Steps: []resource.TestStep{ { - Config: testAccAzureRMVirtualMachine_anWithVM(rInt, testLocation()), + Config: testAccAzureRMVirtualMachine_anWithVM(rInt, testAltLocation()), Check: resource.ComposeTestCheckFunc( testCheckAzureRMVirtualMachineExists(resourceName, &vm), ), @@ -361,6 +361,83 @@ func TestAccAzureRMVirtualMachine_enableAnWithVM(t *testing.T) { }) } +func TestAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_changeOsWriteAcceleratorEnabled(t *testing.T) { + resourceName := "azurerm_virtual_machine.test" + rInt := acctest.RandInt() + var vm compute.VirtualMachine + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withOsWriteAcceleratorEnabled(rInt, testAltLocation(), "true"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists(resourceName, &vm), + resource.TestCheckResourceAttr(resourceName, "storage_os_disk.0.write_accelerator_enabled", "true"), + ), + }, + { + Config: testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withOsWriteAcceleratorEnabled(rInt, testAltLocation(), "false"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists(resourceName, &vm), + resource.TestCheckResourceAttr(resourceName, "storage_os_disk.0.write_accelerator_enabled", "false"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withWriteAcceleratorEnabled(t *testing.T) { + resourceName := "azurerm_virtual_machine.test" + rInt := acctest.RandInt() + var vm compute.VirtualMachine + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withWriteAcceleratorEnabled(rInt, testAltLocation(), "true"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists(resourceName, &vm), + resource.TestCheckResourceAttr(resourceName, "storage_data_disk.0.write_accelerator_enabled", "true"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_changeWriteAcceleratorEnabled(t *testing.T) { + resourceName := "azurerm_virtual_machine.test" + rInt := acctest.RandInt() + var vm compute.VirtualMachine + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withWriteAcceleratorEnabled(rInt, testAltLocation(), "false"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists(resourceName, &vm), + resource.TestCheckResourceAttr(resourceName, "storage_data_disk.0.write_accelerator_enabled", "false"), + ), + }, + { + Config: testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withWriteAcceleratorEnabled(rInt, testAltLocation(), "true"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists(resourceName, &vm), + resource.TestCheckResourceAttr(resourceName, "storage_data_disk.0.write_accelerator_enabled", "true"), + ), + }, + }, + }) +} + func TestAccAzureRMVirtualMachine_winRMCerts(t *testing.T) { var vm compute.VirtualMachine resourceName := "azurerm_virtual_machine.test" @@ -437,6 +514,174 @@ func testCheckAndStopAzureRMVirtualMachine(vm *compute.VirtualMachine) resource. } } +func testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withOsWriteAcceleratorEnabled(rInt int, location, enabled string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%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-%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_M64s" + + delete_os_disk_on_termination = true + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + storage_os_disk { + name = "osd-%d" + create_option = "FromImage" + caching = "None" + disk_size_gb = "50" + managed_disk_type = "Premium_LRS" + write_accelerator_enabled = %s + } + + storage_data_disk { + name = "acctmd-%d" + create_option = "Empty" + disk_size_gb = "1" + managed_disk_type = "Standard_LRS" + lun = 0 + } + + os_profile { + computer_name = "hn%d" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } + + tags { + environment = "Production" + cost-center = "Ops" + } +} +`, rInt, location, rInt, rInt, rInt, rInt, rInt, enabled, rInt, rInt) +} + +func testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_withWriteAcceleratorEnabled(rInt int, location, enabled string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%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-%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_M64s" + + delete_os_disk_on_termination = true + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + storage_os_disk { + name = "osd-%d" + caching = "ReadWrite" + create_option = "FromImage" + disk_size_gb = "50" + managed_disk_type = "Standard_LRS" + } + + storage_data_disk { + name = "acctmd-%d" + create_option = "Empty" + disk_size_gb = "1" + managed_disk_type = "Premium_LRS" + lun = 0 + write_accelerator_enabled = %s + } + + os_profile { + computer_name = "hn%d" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } + + tags { + environment = "Production" + cost-center = "Ops" + } +} +`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, enabled, rInt) +} + func testAccAzureRMVirtualMachine_winRMCerts(rString string, location string) string { return fmt.Sprintf(` variable "prefix" { diff --git a/azurerm/resource_arm_virtual_machine_scale_set.go b/azurerm/resource_arm_virtual_machine_scale_set.go index 00f8a81e44eeb..ff5f9c94b546f 100644 --- a/azurerm/resource_arm_virtual_machine_scale_set.go +++ b/azurerm/resource_arm_virtual_machine_scale_set.go @@ -49,8 +49,16 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { Required: true, DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ - "SystemAssigned", - }, true), + string(compute.ResourceIdentityTypeSystemAssigned), + string(compute.ResourceIdentityTypeUserAssigned), + }, false), + }, + "identity_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "principal_id": { Type: schema.TypeString, @@ -87,6 +95,17 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { Set: resourceArmVirtualMachineScaleSetSkuHash, }, + "license_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: validation.StringInSlice([]string{ + "Windows_Client", + "Windows_Server", + }, true), + }, + "upgrade_policy_mode": { Type: schema.TypeString, Required: true, @@ -95,6 +114,7 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { "overprovision": { Type: schema.TypeBool, Optional: true, + Default: true, }, "single_placement_group": { @@ -104,6 +124,17 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { ForceNew: true, }, + "priority": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: string(compute.Regular), + ValidateFunc: validation.StringInSlice([]string{ + string(compute.Low), + string(compute.Regular), + }, true), + }, + "os_profile": { Type: schema.TypeList, Required: true, @@ -215,8 +246,9 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { Required: true, }, "content": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Sensitive: true, }, }, }, @@ -280,11 +312,32 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { Optional: true, }, + "ip_forwarding": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "network_security_group_id": { Type: schema.TypeString, Optional: true, }, + "dns_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dns_servers": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "ip_configuration": { Type: schema.TypeList, Required: true, @@ -640,6 +693,7 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf updatePolicy := d.Get("upgrade_policy_mode").(string) overprovision := d.Get("overprovision").(bool) singlePlacementGroup := d.Get("single_placement_group").(bool) + priority := d.Get("priority").(string) scaleSetProps := compute.VirtualMachineScaleSetProperties{ UpgradePolicy: &compute.UpgradePolicy{ @@ -650,6 +704,7 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf StorageProfile: &storageProfile, OsProfile: osProfile, ExtensionProfile: extensions, + Priority: compute.VirtualMachinePriorityTypes(priority), }, Overprovision: &overprovision, SinglePlacementGroup: &singlePlacementGroup, @@ -660,7 +715,7 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf scaleSetProps.VirtualMachineProfile.DiagnosticsProfile = &diagnosticProfile } - scaleSetParams := compute.VirtualMachineScaleSet{ + properties := compute.VirtualMachineScaleSet{ Name: &name, Location: &location, Tags: expandTags(tags), @@ -670,7 +725,11 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf } if _, ok := d.GetOk("identity"); ok { - scaleSetParams.Identity = expandAzureRmVirtualMachineScaleSetIdentity(d) + properties.Identity = expandAzureRmVirtualMachineScaleSetIdentity(d) + } + + if v, ok := d.GetOk("license_type"); ok { + properties.VirtualMachineProfile.LicenseType = utils.String(v.(string)) } if _, ok := d.GetOk("plan"); ok { @@ -679,10 +738,10 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf return err } - scaleSetParams.Plan = plan + properties.Plan = plan } - future, err := client.CreateOrUpdate(ctx, resGroup, name, scaleSetParams) + future, err := client.CreateOrUpdate(ctx, resGroup, name, properties) if err != nil { return err } @@ -734,83 +793,111 @@ func resourceArmVirtualMachineScaleSetRead(d *schema.ResourceData, meta interfac d.Set("zones", resp.Zones) if err := d.Set("sku", flattenAzureRmVirtualMachineScaleSetSku(resp.Sku)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Sku error: %#v", err) + return fmt.Errorf("[DEBUG] Error setting `sku`: %#v", err) } - if err := d.Set("identity", flattenAzureRmVirtualMachineScaleSetIdentity(resp.Identity)); err != nil { - return fmt.Errorf("[DEBUG] Error flattening `identity`: %+v", err) + flattenedIdentity := flattenAzureRmVirtualMachineScaleSetIdentity(resp.Identity) + if err := d.Set("identity", flattenedIdentity); err != nil { + return fmt.Errorf("[DEBUG] Error setting `identity`: %+v", err) } - properties := resp.VirtualMachineScaleSetProperties + if properties := resp.VirtualMachineScaleSetProperties; properties != nil { - d.Set("upgrade_policy_mode", properties.UpgradePolicy.Mode) - d.Set("overprovision", properties.Overprovision) - d.Set("single_placement_group", properties.SinglePlacementGroup) + if upgradePolicy := properties.UpgradePolicy; upgradePolicy != nil { + d.Set("upgrade_policy_mode", upgradePolicy.Mode) + } + d.Set("overprovision", properties.Overprovision) + d.Set("single_placement_group", properties.SinglePlacementGroup) - osProfile, err := flattenAzureRMVirtualMachineScaleSetOsProfile(d, properties.VirtualMachineProfile.OsProfile) - if err != nil { - return fmt.Errorf("[DEBUG] Error flattening Virtual Machine Scale Set OS Profile. Error: %#v", err) - } + if profile := properties.VirtualMachineProfile; profile != nil { + d.Set("license_type", profile.LicenseType) + d.Set("priority", profile.Priority) - if err := d.Set("os_profile", osProfile); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set OS Profile error: %#v", err) - } + osProfile := flattenAzureRMVirtualMachineScaleSetOsProfile(d, profile.OsProfile) + if err := d.Set("os_profile", osProfile); err != nil { + return fmt.Errorf("[DEBUG] Error setting `os_profile`: %#v", err) + } - if properties.VirtualMachineProfile.OsProfile.Secrets != nil { - if err := d.Set("os_profile_secrets", flattenAzureRmVirtualMachineScaleSetOsProfileSecrets(properties.VirtualMachineProfile.OsProfile.Secrets)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set OS Profile Secrets error: %#v", err) - } - } + if osProfile := profile.OsProfile; osProfile != nil { + if linuxConfiguration := osProfile.LinuxConfiguration; linuxConfiguration != nil { + flattenedLinuxConfiguration := flattenAzureRmVirtualMachineScaleSetOsProfileLinuxConfig(linuxConfiguration) + if err := d.Set("os_profile_linux_config", flattenedLinuxConfiguration); err != nil { + return fmt.Errorf("[DEBUG] Error setting `os_profile_linux_config`: %#v", err) + } + } - if properties.VirtualMachineProfile.DiagnosticsProfile != nil { - if err := d.Set("boot_diagnostics", flattenAzureRmVirtualMachineScaleSetBootDiagnostics(properties.VirtualMachineProfile.DiagnosticsProfile.BootDiagnostics)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virutal Machine Scale Set Boot Diagnostics: %#v", err) - } - } + if secrets := osProfile.Secrets; secrets != nil { + flattenedSecrets := flattenAzureRmVirtualMachineScaleSetOsProfileSecrets(secrets) + if err := d.Set("os_profile_secrets", flattenedSecrets); err != nil { + return fmt.Errorf("[DEBUG] Error setting `os_profile_secrets`: %#v", err) + } - if properties.VirtualMachineProfile.OsProfile.WindowsConfiguration != nil { - if err := d.Set("os_profile_windows_config", flattenAzureRmVirtualMachineScaleSetOsProfileWindowsConfig(properties.VirtualMachineProfile.OsProfile.WindowsConfiguration)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set OS Profile Windows config error: %#v", err) - } - } + } - if properties.VirtualMachineProfile.OsProfile.LinuxConfiguration != nil { - if err := d.Set("os_profile_linux_config", flattenAzureRmVirtualMachineScaleSetOsProfileLinuxConfig(properties.VirtualMachineProfile.OsProfile.LinuxConfiguration)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set OS Profile Linux config error: %#v", err) - } - } + if windowsConfiguration := osProfile.WindowsConfiguration; windowsConfiguration != nil { + flattenedWindowsConfiguration := flattenAzureRmVirtualMachineScaleSetOsProfileWindowsConfig(windowsConfiguration) + if err := d.Set("os_profile_windows_config", flattenedWindowsConfiguration); err != nil { + return fmt.Errorf("[DEBUG] Error setting `os_profile_windows_config`: %#v", err) + } + } + } - if err := d.Set("network_profile", flattenAzureRmVirtualMachineScaleSetNetworkProfile(properties.VirtualMachineProfile.NetworkProfile)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Network Profile error: %#v", err) - } + if diagnosticsProfile := profile.DiagnosticsProfile; diagnosticsProfile != nil { + if bootDiagnostics := diagnosticsProfile.BootDiagnostics; bootDiagnostics != nil { + flattenedDiagnostics := flattenAzureRmVirtualMachineScaleSetBootDiagnostics(bootDiagnostics) + // TODO: rename this field to `diagnostics_profile` + if err := d.Set("boot_diagnostics", flattenedDiagnostics); err != nil { + return fmt.Errorf("[DEBUG] Error setting `boot_diagnostics`: %#v", err) + } + } + } - if properties.VirtualMachineProfile.StorageProfile.ImageReference != nil { - if err := d.Set("storage_profile_image_reference", flattenAzureRmVirtualMachineScaleSetStorageProfileImageReference(properties.VirtualMachineProfile.StorageProfile.ImageReference)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Storage Profile Image Reference error: %#v", err) - } - } + if networkProfile := profile.NetworkProfile; networkProfile != nil { + flattenedNetworkProfile := flattenAzureRmVirtualMachineScaleSetNetworkProfile(networkProfile) + if err := d.Set("network_profile", flattenedNetworkProfile); err != nil { + return fmt.Errorf("[DEBUG] Error setting `network_profile`: %#v", err) + } + } - if err := d.Set("storage_profile_os_disk", flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(properties.VirtualMachineProfile.StorageProfile.OsDisk)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Storage Profile OS Disk error: %#v", err) - } + if storageProfile := profile.StorageProfile; storageProfile != nil { + if dataDisks := resp.VirtualMachineProfile.StorageProfile.DataDisks; dataDisks != nil { + flattenedDataDisks := flattenAzureRmVirtualMachineScaleSetStorageProfileDataDisk(dataDisks) + if err := d.Set("storage_profile_data_disk", flattenedDataDisks); err != nil { + return fmt.Errorf("[DEBUG] Error setting `storage_profile_data_disk`: %#v", err) + } + } - if resp.VirtualMachineProfile.StorageProfile.DataDisks != nil { - if err := d.Set("storage_profile_data_disk", flattenAzureRmVirtualMachineScaleSetStorageProfileDataDisk(properties.VirtualMachineProfile.StorageProfile.DataDisks)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Storage Profile Data Disk error: %#v", err) - } - } + if imageRef := storageProfile.ImageReference; imageRef != nil { + flattenedImageRef := flattenAzureRmVirtualMachineScaleSetStorageProfileImageReference(imageRef) + if err := d.Set("storage_profile_image_reference", flattenedImageRef); err != nil { + return fmt.Errorf("[DEBUG] Error setting `storage_profile_image_reference`: %#v", err) + } + } - if properties.VirtualMachineProfile.ExtensionProfile != nil { - extension, err := flattenAzureRmVirtualMachineScaleSetExtensionProfile(properties.VirtualMachineProfile.ExtensionProfile) - if err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Extension Profile error: %#v", err) + if osDisk := storageProfile.OsDisk; osDisk != nil { + flattenedOSDisk := flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(osDisk) + if err := d.Set("storage_profile_os_disk", flattenedOSDisk); err != nil { + return fmt.Errorf("[DEBUG] Error setting `storage_profile_os_disk`: %#v", err) + } + } + } + + if extensionProfile := properties.VirtualMachineProfile.ExtensionProfile; extensionProfile != nil { + extension, err := flattenAzureRmVirtualMachineScaleSetExtensionProfile(extensionProfile) + if err != nil { + return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Extension Profile error: %#v", err) + } + if err := d.Set("extension", extension); err != nil { + return fmt.Errorf("[DEBUG] Error setting `extension`: %#v", err) + } + } } - d.Set("extension", extension) } - if resp.Plan != nil { - if err := d.Set("plan", flattenAzureRmVirtualMachineScaleSetPlan(resp.Plan)); err != nil { - return fmt.Errorf("[DEBUG] Error setting Virtual Machine Scale Set Plan. Error: %#v", err) + if plan := resp.Plan; plan != nil { + flattenedPlan := flattenAzureRmVirtualMachineScaleSetPlan(plan) + if err := d.Set("plan", flattenedPlan); err != nil { + return fmt.Errorf("[DEBUG] Error setting `plan`: %#v", err) } } @@ -854,6 +941,14 @@ func flattenAzureRmVirtualMachineScaleSetIdentity(identity *compute.VirtualMachi result["principal_id"] = *identity.PrincipalID } + identity_ids := make([]string, 0) + if identity.IdentityIds != nil { + for _, id := range *identity.IdentityIds { + identity_ids = append(identity_ids, id) + } + } + result["identity_ids"] = identity_ids + return []interface{}{result} } @@ -978,10 +1073,27 @@ func flattenAzureRmVirtualMachineScaleSetNetworkProfile(profile *compute.Virtual s["accelerated_networking"] = *v } + if v := netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.EnableIPForwarding; v != nil { + s["ip_forwarding"] = *v + } + if v := netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.NetworkSecurityGroup; v != nil { s["network_security_group_id"] = *v.ID } + if netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.DNSSettings != nil { + dnsSetting := make(map[string]interface{}) + dnsServers := make([]string, 0, len(*netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.DNSSettings.DNSServers)) + if netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.DNSSettings.DNSServers != nil { + for _, dnsServer := range *netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.DNSSettings.DNSServers { + dnsServers = append(dnsServers, dnsServer) + } + dnsSetting["dns_servers"] = dnsServers + } + + s["dns_settings"] = []interface{}{dnsSetting} + } + if netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations != nil { ipConfigs := make([]map[string]interface{}, 0, len(*netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations)) for _, ipConfig := range *netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations { @@ -1044,7 +1156,7 @@ func flattenAzureRmVirtualMachineScaleSetNetworkProfile(profile *compute.Virtual return result } -func flattenAzureRMVirtualMachineScaleSetOsProfile(d *schema.ResourceData, profile *compute.VirtualMachineScaleSetOSProfile) ([]interface{}, error) { +func flattenAzureRMVirtualMachineScaleSetOsProfile(d *schema.ResourceData, profile *compute.VirtualMachineScaleSetOSProfile) []interface{} { result := make(map[string]interface{}) result["computer_name_prefix"] = *profile.ComputerNamePrefix @@ -1067,7 +1179,7 @@ func flattenAzureRMVirtualMachineScaleSetOsProfile(d *schema.ResourceData, profi result["custom_data"] = value } - return []interface{}{result}, nil + return []interface{}{result} } func flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(profile *compute.VirtualMachineScaleSetOSDisk) []interface{} { @@ -1081,13 +1193,13 @@ func flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(profile *compute.V result["image"] = *profile.Image.URI } + containers := make([]interface{}, 0) if profile.VhdContainers != nil { - containers := make([]interface{}, 0, len(*profile.VhdContainers)) for _, container := range *profile.VhdContainers { containers = append(containers, container) } - result["vhd_containers"] = schema.NewSet(schema.HashString, containers) } + result["vhd_containers"] = schema.NewSet(schema.HashString, containers) if profile.ManagedDisk != nil { result["managed_disk_type"] = string(profile.ManagedDisk.StorageAccountType) @@ -1336,7 +1448,25 @@ func expandAzureRmVirtualMachineScaleSetNetworkProfile(d *schema.ResourceData) * name := config["name"].(string) primary := config["primary"].(bool) acceleratedNetworking := config["accelerated_networking"].(bool) - + ipForwarding := config["ip_forwarding"].(bool) + + dnsSettingsConfigs := config["dns_settings"].([]interface{}) + dnsSettings := compute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{} + for _, dnsSettingsConfig := range dnsSettingsConfigs { + dns_settings := dnsSettingsConfig.(map[string]interface{}) + + if v := dns_settings["dns_servers"]; v != nil { + dns_servers := dns_settings["dns_servers"].([]interface{}) + if len(dns_servers) > 0 { + var dnsServers []string + for _, v := range dns_servers { + str := v.(string) + dnsServers = append(dnsServers, str) + } + dnsSettings.DNSServers = &dnsServers + } + } + } ipConfigurationConfigs := config["ip_configuration"].([]interface{}) ipConfigurations := make([]compute.VirtualMachineScaleSetIPConfiguration, 0, len(ipConfigurationConfigs)) for _, ipConfigConfig := range ipConfigurationConfigs { @@ -1428,6 +1558,8 @@ func expandAzureRmVirtualMachineScaleSetNetworkProfile(d *schema.ResourceData) * Primary: &primary, IPConfigurations: &ipConfigurations, EnableAcceleratedNetworking: &acceleratedNetworking, + EnableIPForwarding: &ipForwarding, + DNSSettings: &dnsSettings, }, } @@ -1520,10 +1652,22 @@ func expandAzureRmVirtualMachineScaleSetIdentity(d *schema.ResourceData) *comput v := d.Get("identity") identities := v.([]interface{}) identity := identities[0].(map[string]interface{}) - identityType := identity["type"].(string) - return &compute.VirtualMachineScaleSetIdentity{ - Type: compute.ResourceIdentityType(identityType), + identityType := compute.ResourceIdentityType(identity["type"].(string)) + + identityIds := []string{} + for _, id := range identity["identity_ids"].([]interface{}) { + identityIds = append(identityIds, id.(string)) + } + + vmssIdentity := compute.VirtualMachineScaleSetIdentity{ + Type: identityType, } + + if vmssIdentity.Type == compute.ResourceIdentityTypeUserAssigned { + vmssIdentity.IdentityIds = &identityIds + } + + return &vmssIdentity } func expandAzureRMVirtualMachineScaleSetsStorageProfileOsDisk(d *schema.ResourceData) (*compute.VirtualMachineScaleSetOSDisk, error) { diff --git a/azurerm/resource_arm_virtual_machine_scale_set_test.go b/azurerm/resource_arm_virtual_machine_scale_set_test.go index d9bb0865d1e98..2ea5bb886c097 100644 --- a/azurerm/resource_arm_virtual_machine_scale_set_test.go +++ b/azurerm/resource_arm_virtual_machine_scale_set_test.go @@ -13,6 +13,7 @@ import ( ) func TestAccAzureRMVirtualMachineScaleSet_basic(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basic(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -23,10 +24,9 @@ func TestAccAzureRMVirtualMachineScaleSet_basic(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - - // single placement group should default to true - testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup("azurerm_virtual_machine_scale_set.test", true), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + // testing default scaleset values + testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup(resourceName, true), ), }, }, @@ -34,7 +34,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basic(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_basicPublicIP(t *testing.T) { - resource_name := "azurerm_virtual_machine_scale_set.test" + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basicPublicIP(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -45,9 +45,9 @@ func TestAccAzureRMVirtualMachineScaleSet_basicPublicIP(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists(resource_name), - testCheckAzureRMVirtualMachineScaleSetIsPrimary(resource_name, true), - testCheckAzureRMVirtualMachineScaleSetPublicIPName(resource_name, "TestPublicIPConfiguration"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetIsPrimary(resourceName, true), + testCheckAzureRMVirtualMachineScaleSetPublicIPName(resourceName, "TestPublicIPConfiguration"), ), }, }, @@ -55,7 +55,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicPublicIP(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_basicAcceleratedNetworking(t *testing.T) { - resource_name := "azurerm_virtual_machine_scale_set.test" + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basicAcceleratedNetworking(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -66,8 +66,55 @@ func TestAccAzureRMVirtualMachineScaleSet_basicAcceleratedNetworking(t *testing. { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists(resource_name), - testCheckAzureRMVirtualMachineScaleSetAcceleratedNetworking(resource_name, true), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetAcceleratedNetworking(resourceName, true), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineScaleSet_basicIPForwarding(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" + ri := acctest.RandInt() + networkProfileName := fmt.Sprintf("TestNetworkProfile-%d", ri) + networkProfile := map[string]interface{}{"name": networkProfileName, "primary": true} + networkProfileHash := fmt.Sprintf("%d", resourceArmVirtualMachineScaleSetNetworkConfigurationHash(networkProfile)) + config := testAccAzureRMVirtualMachineScaleSet_basicIPForwarding(ri, testLocation()) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "network_profile."+networkProfileHash+".ip_forwarding", "true"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineScaleSet_basicDNSSettings(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" + ri := acctest.RandInt() + networkProfileName := fmt.Sprintf("TestNetworkProfile-%d", ri) + networkProfile := map[string]interface{}{"name": networkProfileName, "primary": true} + networkProfileHash := fmt.Sprintf("%d", resourceArmVirtualMachineScaleSetNetworkConfigurationHash(networkProfile)) + config := testAccAzureRMVirtualMachineScaleSet_basicDNSSettings(ri, testLocation()) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "network_profile."+networkProfileHash+".dns_settings.0.dns_servers.0", "8.8.8.8"), + resource.TestCheckResourceAttr(resourceName, "network_profile."+networkProfileHash+".dns_settings.0.dns_servers.1", "8.8.4.4"), ), }, }, @@ -75,7 +122,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicAcceleratedNetworking(t *testing. } func TestAccAzureRMVirtualMachineScaleSet_bootDiagnostic(t *testing.T) { - resource_name := "azurerm_virtual_machine_scale_set.test" + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_bootDiagnostic(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -86,8 +133,8 @@ func TestAccAzureRMVirtualMachineScaleSet_bootDiagnostic(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists(resource_name), - resource.TestCheckResourceAttr(resource_name, "boot_diagnostics.0.enabled", "true"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "boot_diagnostics.0.enabled", "true"), ), }, }, @@ -95,7 +142,7 @@ func TestAccAzureRMVirtualMachineScaleSet_bootDiagnostic(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_networkSecurityGroup(t *testing.T) { - resource_name := "azurerm_virtual_machine_scale_set.test" + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_networkSecurityGroup(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -106,7 +153,7 @@ func TestAccAzureRMVirtualMachineScaleSet_networkSecurityGroup(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists(resource_name), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, }, @@ -114,6 +161,7 @@ func TestAccAzureRMVirtualMachineScaleSet_networkSecurityGroup(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_basicWindows(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basicWindows(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -124,10 +172,10 @@ func TestAccAzureRMVirtualMachineScaleSet_basicWindows(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), // single placement group should default to true - testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup("azurerm_virtual_machine_scale_set.test", true), + testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup(resourceName, true), ), }, }, @@ -135,6 +183,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicWindows(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_singlePlacementGroupFalse(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_singlePlacementGroupFalse(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -145,8 +194,8 @@ func TestAccAzureRMVirtualMachineScaleSet_singlePlacementGroupFalse(t *testing.T { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup("azurerm_virtual_machine_scale_set.test", false), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup(resourceName, false), ), }, }, @@ -210,6 +259,7 @@ func TestAccAzureRMVirtualMachineScaleSet_customDataUpdated(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -220,7 +270,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, }, @@ -228,6 +278,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk(ri, testLocation(), "Standard_D1_v2") resource.Test(t, resource.TestCase{ @@ -238,7 +289,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, }, @@ -246,6 +297,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk(t *testing.T) } func TestAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk_resize(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() preConfig := testAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk(ri, testLocation(), "Standard_D1_v2") postConfig := testAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk(ri, testLocation(), "Standard_D2_v2") @@ -257,13 +309,13 @@ func TestAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk_resize(t *tes { Config: preConfig, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, { Config: postConfig, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, }, @@ -271,6 +323,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk_resize(t *tes } func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDiskNoName(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDiskNoName(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -281,7 +334,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDiskNoName(t *testin { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, }, @@ -289,6 +342,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDiskNoName(t *testin } func TestAccAzureRMVirtualMachineScaleSet_basicLinux_disappears(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_basic(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -299,8 +353,8 @@ func TestAccAzureRMVirtualMachineScaleSet_basicLinux_disappears(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetDisappears("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetDisappears(resourceName), ), ExpectNonEmptyPlan: true, }, @@ -309,6 +363,7 @@ func TestAccAzureRMVirtualMachineScaleSet_basicLinux_disappears(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_planManagedDisk(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_planManagedDisk(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -319,7 +374,7 @@ func TestAccAzureRMVirtualMachineScaleSet_planManagedDisk(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, }, @@ -327,6 +382,7 @@ func TestAccAzureRMVirtualMachineScaleSet_planManagedDisk(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_customImage(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() resourceGroup := fmt.Sprintf("acctestRG-%d", ri) userName := fmt.Sprintf("testadmin%d", ri) @@ -353,7 +409,7 @@ func TestAccAzureRMVirtualMachineScaleSet_customImage(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), testCheckAzureRMImageExists("azurerm_image.test", true), ), }, @@ -362,6 +418,7 @@ func TestAccAzureRMVirtualMachineScaleSet_customImage(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_applicationGateway(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSetApplicationGatewayTemplate(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -372,8 +429,8 @@ func TestAccAzureRMVirtualMachineScaleSet_applicationGateway(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetHasApplicationGateway("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetHasApplicationGateway(resourceName), ), }, }, @@ -381,6 +438,7 @@ func TestAccAzureRMVirtualMachineScaleSet_applicationGateway(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_loadBalancer(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSetLoadBalancerTemplate(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -391,8 +449,8 @@ func TestAccAzureRMVirtualMachineScaleSet_loadBalancer(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetHasLoadbalancer("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetHasLoadbalancer(resourceName), ), }, }, @@ -400,6 +458,7 @@ func TestAccAzureRMVirtualMachineScaleSet_loadBalancer(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_loadBalancerManagedDataDisks(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSetLoadBalancerTemplateManagedDataDisks(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -410,8 +469,8 @@ func TestAccAzureRMVirtualMachineScaleSet_loadBalancerManagedDataDisks(t *testin { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetHasDataDisks("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetHasDataDisks(resourceName), ), }, }, @@ -419,6 +478,7 @@ func TestAccAzureRMVirtualMachineScaleSet_loadBalancerManagedDataDisks(t *testin } func TestAccAzureRMVirtualMachineScaleSet_overprovision(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSetOverProvisionTemplate(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -429,18 +489,38 @@ func TestAccAzureRMVirtualMachineScaleSet_overprovision(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetOverprovision("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetOverprovision(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineScaleSet_priority(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" + ri := acctest.RandInt() + config := testAccAzureRMVirtualMachineScaleSetPriorityTemplate(ri, testLocation()) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "priority", "Low"), ), }, }, }) } -func TestAccAzureRMVirtualMachineScaleSet_MSI(t *testing.T) { +func TestAccAzureRMVirtualMachineScaleSet_SystemAssignedMSI(t *testing.T) { resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() - config := testAccAzureRMVirtualMachineScaleSetMSITemplate(ri, testLocation()) + config := testAccAzureRMVirtualMachineScaleSetSystemAssignedMSI(ri, testLocation()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -448,13 +528,42 @@ func TestAccAzureRMVirtualMachineScaleSet_MSI(t *testing.T) { Steps: []resource.TestStep{ { Config: config, - Check: resource.TestCheckResourceAttrSet(resourceName, "identity.0.principal_id"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestCheckResourceAttr(resourceName, "identity.0.identity_ids.#", "0"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", regexp.MustCompile(".+")), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachineScaleSet_UserAssignedMSI(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" + ri := acctest.RandInt() + rs := acctest.RandString(14) + config := testAccAzureRMVirtualMachineScaleSetUserAssignedMSI(ri, testLocation(), rs) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "UserAssigned"), + resource.TestCheckResourceAttr(resourceName, "identity.0.identity_ids.#", "1"), + resource.TestCheckResourceAttr(resourceName, "identity.0.principal_id", ""), + ), }, }, }) } func TestAccAzureRMVirtualMachineScaleSet_extension(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSetExtensionTemplate(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -465,8 +574,8 @@ func TestAccAzureRMVirtualMachineScaleSet_extension(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetExtension("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetExtension(resourceName), ), }, }, @@ -503,6 +612,7 @@ func TestAccAzureRMVirtualMachineScaleSet_extensionUpdate(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_multipleExtensions(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSetMultipleExtensionsTemplate(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -513,8 +623,8 @@ func TestAccAzureRMVirtualMachineScaleSet_multipleExtensions(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), - testCheckAzureRMVirtualMachineScaleSetExtension("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), + testCheckAzureRMVirtualMachineScaleSetExtension(resourceName), ), }, }, @@ -538,6 +648,7 @@ func TestAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_NonStandardCasing(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSetNonStandardCasing(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -548,7 +659,7 @@ func TestAccAzureRMVirtualMachineScaleSet_NonStandardCasing(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, { @@ -561,6 +672,7 @@ func TestAccAzureRMVirtualMachineScaleSet_NonStandardCasing(t *testing.T) { } func TestAccAzureRMVirtualMachineScaleSet_multipleNetworkProfiles(t *testing.T) { + resourceName := "azurerm_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureRMVirtualMachineScaleSet_multipleNetworkProfiles(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -571,7 +683,7 @@ func TestAccAzureRMVirtualMachineScaleSet_multipleNetworkProfiles(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), + testCheckAzureRMVirtualMachineScaleSetExists(resourceName), ), }, }, @@ -820,28 +932,7 @@ func testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup(name string, exp } if *resp.SinglePlacementGroup != expectedSinglePlacementGroup { - return fmt.Errorf("Bad: Overprovision should have been %t for scale set %v", expectedSinglePlacementGroup, name) - } - - return nil - } -} - -func testCheckAzureRMVirtualMachineScaleSetMSI(name string) resource.TestCheckFunc { - return func(s *terraform.State) error { - resp, err := testGetAzureRMVirtualMachineScaleSet(s, name) - if err != nil { - return err - } - - identityType := resp.Identity.Type - if identityType != "systemAssigned" { - return fmt.Errorf("Bad: Identity Type is not systemAssigned for scale set %v", name) - } - - principalID := *resp.Identity.PrincipalID - if len(principalID) == 0 { - return fmt.Errorf("Bad: Could not get principal_id for scale set %v", name) + return fmt.Errorf("Bad: SinglePlacementGroup should have been %t for scale set %v", expectedSinglePlacementGroup, name) } return nil @@ -901,38 +992,26 @@ func testCheckAzureRMVirtualMachineScaleSetHasDataDisks(name string) resource.Te func testAccAzureRMVirtualMachineScaleSet_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%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_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -951,7 +1030,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -961,15 +1040,15 @@ resource "azurerm_virtual_machine_scale_set" "test" { tier = "Standard" capacity = 2 } - + os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -991,44 +1070,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_basicPublicIP(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%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_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -1047,7 +1114,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -1059,13 +1126,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -1073,7 +1140,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { primary = true public_ip_address_configuration { name = "TestPublicIPConfiguration" - domain_name_label = "test-domain-label-%d" + domain_name_label = "test-domain-label-%[1]d" idle_timeout = 4 } } @@ -1093,44 +1160,117 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_basicAcceleratedNetworking(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%d" +resource "azurerm_storage_account" "test" { + name = "accsa%[1]d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + tags { + environment = "staging" + } +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" +} + +resource "azurerm_virtual_machine_scale_set" "test" { + name = "acctvmss-%[1]d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + upgrade_policy_mode = "Manual" + + sku { + name = "Standard_D4_v2" + tier = "Standard" + capacity = 2 + } + + os_profile { + computer_name_prefix = "testvm-%[1]d" + admin_username = "myadmin" + admin_password = "Passwword1234" + } + + network_profile { + name = "TestNetworkProfile-%[1]d" + primary = true + accelerated_networking = true + ip_configuration { + name = "TestIPConfiguration" + subnet_id = "${azurerm_subnet.test.id}" + } + } + + storage_profile_os_disk { + name = "osDiskProfile" + caching = "ReadWrite" + create_option = "FromImage" + vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] + } + + storage_profile_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } +} +`, rInt, location) +} + +func testAccAzureRMVirtualMachineScaleSet_basicIPForwarding(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +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}" +} - ip_configuration { - name = "testconfiguration1" - subnet_id = "${azurerm_subnet.test.id}" - private_ip_address_allocation = "dynamic" - } +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_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -1149,7 +1289,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -1161,15 +1301,15 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true - accelerated_networking = true + ip_forwarding = true ip_configuration { name = "TestIPConfiguration" subnet_id = "${azurerm_subnet.test.id}" @@ -1190,44 +1330,119 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } -func testAccAzureRMVirtualMachineScaleSet_bootDiagnostic(rInt int, location string) string { +func testAccAzureRMVirtualMachineScaleSet_basicDNSSettings(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%d" +resource "azurerm_storage_account" "test" { + name = "accsa%[1]d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + tags { + environment = "staging" + } +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" +} + +resource "azurerm_virtual_machine_scale_set" "test" { + name = "acctvmss-%[1]d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + upgrade_policy_mode = "Manual" + + sku { + name = "Standard_D4_v2" + tier = "Standard" + capacity = 2 + } + + os_profile { + computer_name_prefix = "testvm-%[1]d" + admin_username = "myadmin" + admin_password = "Passwword1234" + } + + network_profile { + name = "TestNetworkProfile-%[1]d" + primary = true + dns_settings { + dns_servers = ["8.8.8.8", "8.8.4.4"] + } + ip_configuration { + name = "TestIPConfiguration" + subnet_id = "${azurerm_subnet.test.id}" + } + } + + storage_profile_os_disk { + name = "osDiskProfile" + caching = "ReadWrite" + create_option = "FromImage" + vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] + } + + storage_profile_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } +} +`, rInt, location) +} + +func testAccAzureRMVirtualMachineScaleSet_bootDiagnostic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +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}" +} - ip_configuration { - name = "testconfiguration1" - subnet_id = "${azurerm_subnet.test.id}" - private_ip_address_allocation = "dynamic" - } +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_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -1246,7 +1461,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -1258,7 +1473,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -1268,7 +1483,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -1290,44 +1505,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_networkSecurityGroup(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%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_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -1346,13 +1549,13 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_network_security_group" "test" { - name = "acceptanceTestSecurityGroup-%d" + name = "acceptanceTestSecurityGroup-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -1364,13 +1567,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true network_security_group_id = "${azurerm_network_security_group.test.id}" ip_configuration { @@ -1379,7 +1582,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { primary = true public_ip_address_configuration { name = "TestPublicIPConfiguration" - domain_name_label = "test-domain-label-%d" + domain_name_label = "test-domain-label-%[1]d" idle_timeout = 4 } } @@ -1399,44 +1602,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_basicWindows(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%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_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -1455,7 +1646,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -1482,7 +1673,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -1504,14 +1695,14 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_singlePlacementGroupFalse(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%[1]d" - location = "%s" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { @@ -1528,18 +1719,6 @@ resource "azurerm_subnet" "test" { address_prefix = "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_storage_account" "test" { name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" @@ -1607,42 +1786,48 @@ resource "azurerm_virtual_machine_scale_set" "test" { func testAccAzureRMVirtualMachineScaleSet_linux(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } + resource "azurerm_virtual_network" "test" { - name = "acctestvn-%d" + name = "acctestvn-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" address_space = ["10.0.0.0/8"] } + resource "azurerm_subnet" "test" { - name = "acctestsn-%d" + name = "acctestsn-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.1.0/24" } + resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" account_replication_type = "LRS" } + resource "azurerm_storage_container" "test" { - name = "acctestsc-%d" + name = "acctestsc-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" } + resource "azurerm_public_ip" "test" { - name = "acctestpip-%d" + name = "acctestpip-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" public_ip_address_allocation = "static" } + resource "azurerm_lb" "test" { - name = "acctestlb-%d" + name = "acctestlb-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" frontend_ip_configuration { @@ -1650,27 +1835,32 @@ resource "azurerm_lb" "test" { public_ip_address_id = "${azurerm_public_ip.test.id}" } } + resource "azurerm_lb_backend_address_pool" "test" { - name = "acctestbap-%d" + name = "acctestbap-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" loadbalancer_id = "${azurerm_lb.test.id}" } + resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctestvmss-%d" + name = "acctestvmss-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" upgrade_policy_mode = "Automatic" + sku { name = "Standard_A0" tier = "Standard" capacity = "1" } + os_profile { computer_name_prefix = "prefix" admin_username = "ubuntu" admin_password = "password" custom_data = "custom data!" } + os_profile_linux_config { disable_password_authentication = true ssh_keys { @@ -1678,6 +1868,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com" } } + network_profile { name = "TestNetworkProfile" primary = true @@ -1687,6 +1878,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"] } } + storage_profile_os_disk { name = "osDiskProfile" caching = "ReadWrite" @@ -1694,6 +1886,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { os_type = "linux" vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] } + storage_profile_image_reference { publisher = "Canonical" offer = "UbuntuServer" @@ -1701,48 +1894,54 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_linuxUpdated(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } + resource "azurerm_virtual_network" "test" { - name = "acctestvn-%d" + name = "acctestvn-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" address_space = ["10.0.0.0/8"] } + resource "azurerm_subnet" "test" { - name = "acctestsn-%d" + name = "acctestsn-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.1.0/24" } + resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" account_replication_type = "LRS" } + resource "azurerm_storage_container" "test" { - name = "acctestsc-%d" + name = "acctestsc-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" } + resource "azurerm_public_ip" "test" { - name = "acctestpip-%d" + name = "acctestpip-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" public_ip_address_allocation = "static" } + resource "azurerm_lb" "test" { - name = "acctestlb-%d" + name = "acctestlb-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" frontend_ip_configuration { @@ -1750,27 +1949,32 @@ resource "azurerm_lb" "test" { public_ip_address_id = "${azurerm_public_ip.test.id}" } } + resource "azurerm_lb_backend_address_pool" "test" { - name = "acctestbap-%d" + name = "acctestbap-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" loadbalancer_id = "${azurerm_lb.test.id}" } + resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctestvmss-%d" + name = "acctestvmss-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" upgrade_policy_mode = "Automatic" + sku { name = "Standard_A0" tier = "Standard" capacity = "1" } + os_profile { computer_name_prefix = "prefix" admin_username = "ubuntu" admin_password = "password" custom_data = "custom data!" } + os_profile_linux_config { disable_password_authentication = true ssh_keys { @@ -1778,6 +1982,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com" } } + network_profile { name = "TestNetworkProfile" primary = true @@ -1787,6 +1992,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"] } } + storage_profile_os_disk { name = "osDiskProfile" caching = "ReadWrite" @@ -1794,58 +2000,66 @@ resource "azurerm_virtual_machine_scale_set" "test" { os_type = "linux" vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] } + storage_profile_image_reference { publisher = "Canonical" offer = "UbuntuServer" sku = "16.04-LTS" version = "latest" } + tags { ThisIs = "a test" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_linuxCustomDataUpdated(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } + resource "azurerm_virtual_network" "test" { - name = "acctestvn-%d" + name = "acctestvn-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" address_space = ["10.0.0.0/8"] } + resource "azurerm_subnet" "test" { - name = "acctestsn-%d" + name = "acctestsn-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.1.0/24" } + resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" account_replication_type = "LRS" } + resource "azurerm_storage_container" "test" { - name = "acctestsc-%d" + name = "acctestsc-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" } + resource "azurerm_public_ip" "test" { - name = "acctestpip-%d" + name = "acctestpip-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" public_ip_address_allocation = "static" } + resource "azurerm_lb" "test" { - name = "acctestlb-%d" + name = "acctestlb-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" frontend_ip_configuration { @@ -1853,27 +2067,32 @@ resource "azurerm_lb" "test" { public_ip_address_id = "${azurerm_public_ip.test.id}" } } + resource "azurerm_lb_backend_address_pool" "test" { - name = "acctestbap-%d" + name = "acctestbap-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" loadbalancer_id = "${azurerm_lb.test.id}" } + resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctestvmss-%d" + name = "acctestvmss-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" upgrade_policy_mode = "Automatic" + sku { name = "Standard_A0" tier = "Standard" capacity = "1" } + os_profile { computer_name_prefix = "prefix" admin_username = "ubuntu" admin_password = "password" custom_data = "updated custom data!" } + os_profile_linux_config { disable_password_authentication = true ssh_keys { @@ -1881,6 +2100,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com" } } + network_profile { name = "TestNetworkProfile" primary = true @@ -1890,6 +2110,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"] } } + storage_profile_os_disk { name = "osDiskProfile" caching = "ReadWrite" @@ -1897,6 +2118,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { os_type = "linux" vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] } + storage_profile_image_reference { publisher = "Canonical" offer = "UbuntuServer" @@ -1904,32 +2126,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -1941,13 +2163,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -1969,32 +2191,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk_withZones(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2007,13 +2229,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -2034,38 +2256,38 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_basicWindows_managedDisk(rInt int, location string, vmSize string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" sku { - name = "%s" + name = "%[3]s" tier = "Standard" capacity = 2 } @@ -2096,7 +2318,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -2118,32 +2340,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, vmSize, rInt) +`, rInt, location, vmSize) } func testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDiskNoName(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2155,13 +2377,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -2182,32 +2404,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSetApplicationGatewayTemplate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -2222,7 +2444,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2234,7 +2456,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -2267,21 +2489,21 @@ resource "azurerm_virtual_machine_scale_set" "test" { # application gateway resource "azurerm_subnet" "gwtest" { - name = "gw-subnet-%d" + name = "gw-subnet-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.3.0/24" } resource "azurerm_public_ip" "test" { - name = "acctest-pubip-%d" + name = "acctest-pubip-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" public_ip_address_allocation = "dynamic" } resource "azurerm_application_gateway" "test" { - name = "acctestgw-%d" + name = "acctestgw-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -2377,32 +2599,32 @@ resource "azurerm_application_gateway" "test" { environment = "tf01" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSetLoadBalancerTemplate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -2417,7 +2639,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_lb" "test" { - name = "acctestlb-%d" + name = "acctestlb-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -2447,7 +2669,7 @@ resource "azurerm_lb_nat_pool" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2459,7 +2681,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -2491,32 +2713,115 @@ resource "azurerm_virtual_machine_scale_set" "test" { } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSetOverProvisionTemplate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +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_prefix = "10.0.2.0/24" +} + +resource "azurerm_storage_account" "test" { + name = "accsa%[1]d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" +} + +resource "azurerm_virtual_machine_scale_set" "test" { + name = "acctvmss-%[1]d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + upgrade_policy_mode = "Manual" + overprovision = false + + sku { + name = "Standard_D1_v2" + tier = "Standard" + capacity = 1 + } + + os_profile { + computer_name_prefix = "testvm-%[1]d" + admin_username = "myadmin" + admin_password = "Passwword1234" + } + + network_profile { + name = "TestNetworkProfile" + primary = true + + ip_configuration { + name = "TestIPConfiguration" + subnet_id = "${azurerm_subnet.test.id}" + } + } + + storage_profile_os_disk { + name = "os-disk" + caching = "ReadWrite" + create_option = "FromImage" + vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] + } + + storage_profile_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } +} + +`, rInt, location) +} + +func testAccAzureRMVirtualMachineScaleSetPriorityTemplate(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -2531,11 +2836,12 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" overprovision = false + priority = "Low" sku { name = "Standard_D1_v2" @@ -2544,7 +2850,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -2574,32 +2880,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } -func testAccAzureRMVirtualMachineScaleSetMSITemplate(rInt int, location string) string { +func testAccAzureRMVirtualMachineScaleSetSystemAssignedMSI(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -2614,7 +2920,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2627,19 +2933,122 @@ resource "azurerm_virtual_machine_scale_set" "test" { } identity { - type = "systemAssigned" + type = "SystemAssigned" + } + + extension { + name = "MSILinuxExtension" + publisher = "Microsoft.ManagedIdentity" + type = "ManagedIdentityExtensionForLinux" + type_handler_version = "1.0" + settings = "{\"port\": 50342}" + } + + os_profile { + computer_name_prefix = "testvm-%[1]d" + admin_username = "myadmin" + admin_password = "Passwword1234" + } + + network_profile { + name = "TestNetworkProfile" + primary = true + + ip_configuration { + name = "TestIPConfiguration" + subnet_id = "${azurerm_subnet.test.id}" + } + } + + storage_profile_os_disk { + name = "os-disk" + caching = "ReadWrite" + create_option = "FromImage" + vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] + } + + storage_profile_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } +} + +`, rInt, location) +} + +func testAccAzureRMVirtualMachineScaleSetUserAssignedMSI(rInt int, location string, rString string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestrg-%[1]d" + location = "%[2]s" +} + +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_prefix = "10.0.2.0/24" +} + +resource "azurerm_storage_account" "test" { + name = "accsa%[1]d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" +} + +resource "azurerm_user_assigned_identity" "test" { + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + + name = "acctest%[3]s" +} + +resource "azurerm_virtual_machine_scale_set" "test" { + name = "acctvmss-%[1]d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + upgrade_policy_mode = "Manual" + overprovision = false + + sku { + name = "Standard_D1_v2" + tier = "Standard" + capacity = 1 } - + + identity { + type = "UserAssigned" + identity_ids = ["${azurerm_user_assigned_identity.test.id}"] + } + extension { name = "MSILinuxExtension" publisher = "Microsoft.ManagedIdentity" type = "ManagedIdentityExtensionForLinux" type_handler_version = "1.0" settings = "{\"port\": 50342}" - } + } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -2669,32 +3078,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location, rString) } func testAccAzureRMVirtualMachineScaleSetExtensionTemplate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -2709,7 +3118,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2722,7 +3131,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -2780,32 +3189,32 @@ SETTINGS SETTINGS } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSetExtensionTemplateUpdated(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -2820,7 +3229,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2833,7 +3242,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -2892,32 +3301,32 @@ SETTINGS SETTINGS } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSetMultipleExtensionsTemplate(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -2932,7 +3341,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -2945,7 +3354,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -3004,44 +3413,32 @@ SETTINGS } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%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_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -3053,13 +3450,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { @@ -3084,32 +3481,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSetLoadBalancerTemplateManagedDataDisks(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_lb" "test" { - name = "acctestlb-%d" + name = "acctestlb-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -3127,7 +3524,7 @@ resource "azurerm_lb_backend_address_pool" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -3139,7 +3536,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } @@ -3178,44 +3575,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSetNonStandardCasing(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%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_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -3234,7 +3619,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -3246,13 +3631,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { @@ -3275,32 +3660,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_planManagedDisk(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -3312,13 +3697,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -3345,40 +3730,40 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } func testAccAzureRMVirtualMachineScaleSet_customImage(rInt int, location string, userName string, password string, hostName string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } resource "azurerm_public_ip" "test" { - name = "acctpip-%d" + name = "acctpip-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" public_ip_address_allocation = "Dynamic" - domain_name_label = "%s" + domain_name_label = "%[3]s" } resource "azurerm_network_interface" "testsource" { - name = "acctnicsource-%d" + name = "acctnicsource-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -3391,7 +3776,7 @@ resource "azurerm_network_interface" "testsource" { } resource "azurerm_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -3433,8 +3818,8 @@ resource "azurerm_virtual_machine" "testsource" { os_profile { computer_name = "mdimagetestsource" - admin_username = "%s" - admin_password = "%s" + admin_username = "%[4]s" + admin_password = "%[5]s" } os_profile_linux_config { @@ -3448,7 +3833,7 @@ resource "azurerm_virtual_machine" "testsource" { } resource "azurerm_image" "test" { - name = "accteste-%d" + name = "accteste-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -3466,20 +3851,14 @@ resource "azurerm_image" "test" { } } - - data "azurerm_image" "test" { - name = "${azurerm_image.test.name}" - resource_group_name = "${azurerm_resource_group.test.name}" -} - resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" storage_profile_image_reference { - id = "${data.azurerm_image.test.id}" + id = "${azurerm_image.test.id}" } sku { @@ -3489,13 +3868,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "TestNetworkProfile-%d" + name = "TestNetworkProfile-%[1]d" primary = true ip_configuration { name = "TestIPConfiguration" @@ -3509,44 +3888,32 @@ resource "azurerm_virtual_machine_scale_set" "test" { managed_disk_type = "Standard_LRS" } } -`, rInt, location, rInt, rInt, rInt, hostName, rInt, rInt, userName, password, rInt, rInt, rInt, rInt) +`, rInt, location, hostName, userName, password) } func testAccAzureRMVirtualMachineScaleSet_multipleNetworkProfiles(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" + name = "acctestRG-%[1]d" + location = "%[2]s" } resource "azurerm_virtual_network" "test" { - name = "acctvn-%d" + 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-%d" + name = "acctsub-%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.2.0/24" } -resource "azurerm_network_interface" "test" { - name = "acctni-%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_storage_account" "test" { - name = "accsa%d" + name = "accsa%[1]d" resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" account_tier = "Standard" @@ -3565,7 +3932,7 @@ resource "azurerm_storage_container" "test" { } resource "azurerm_virtual_machine_scale_set" "test" { - name = "acctvmss-%d" + name = "acctvmss-%[1]d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" upgrade_policy_mode = "Manual" @@ -3577,13 +3944,13 @@ resource "azurerm_virtual_machine_scale_set" "test" { } os_profile { - computer_name_prefix = "testvm-%d" + computer_name_prefix = "testvm-%[1]d" admin_username = "myadmin" admin_password = "Passwword1234" } network_profile { - name = "primary-%d" + name = "primary-%[1]d" primary = true ip_configuration { name = "primary" @@ -3592,7 +3959,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { } network_profile { - name = "secondary-%d" + name = "secondary-%[1]d" primary = false ip_configuration { name = "secondary" @@ -3614,5 +3981,5 @@ resource "azurerm_virtual_machine_scale_set" "test" { version = "latest" } } -`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) +`, rInt, location) } diff --git a/azurerm/resource_arm_virtual_machine_test.go b/azurerm/resource_arm_virtual_machine_test.go index c38b656ef4823..f9f4ddae570f2 100644 --- a/azurerm/resource_arm_virtual_machine_test.go +++ b/azurerm/resource_arm_virtual_machine_test.go @@ -3,12 +3,83 @@ package azurerm import ( "fmt" "net/http" + "regexp" + "testing" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) +func TestAccAzureRMVirtualMachine_winTimeZone(t *testing.T) { + resourceName := "azurerm_virtual_machine.test" + var vm compute.VirtualMachine + ri := acctest.RandInt() + config := testAccAzureRMVirtualMachine_winTimeZone(ri, testLocation()) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists("azurerm_virtual_machine.test", &vm), + resource.TestCheckResourceAttr(resourceName, "os_profile_windows_config.59207889.timezone", "Pacific Standard Time"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachine_SystemAssignedIdentity(t *testing.T) { + var vm compute.VirtualMachine + resourceName := "azurerm_virtual_machine.test" + ri := acctest.RandInt() + config := testAccAzureRMVirtualMachineSystemAssignedIdentity(ri, testLocation()) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists(resourceName, &vm), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestCheckResourceAttr(resourceName, "identity.0.identity_ids.#", "0"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", regexp.MustCompile(".+")), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualMachine_UserAssignedIdentity(t *testing.T) { + var vm compute.VirtualMachine + resourceName := "azurerm_virtual_machine.test" + ri := acctest.RandInt() + rs := acctest.RandString(14) + config := testAccAzureRMVirtualMachineUserAssignedIdentity(ri, testLocation(), rs) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualMachineExists(resourceName, &vm), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "UserAssigned"), + resource.TestCheckResourceAttr(resourceName, "identity.0.identity_ids.#", "1"), + resource.TestCheckResourceAttr(resourceName, "identity.0.principal_id", ""), + ), + }, + }, + }) +} + func testCheckAzureRMVirtualMachineExists(name string, vm *compute.VirtualMachine) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API @@ -68,3 +139,285 @@ func testCheckAzureRMVirtualMachineDestroy(s *terraform.State) error { return nil } + +func testAccAzureRMVirtualMachine_winTimeZone(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%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_storage_account" "test" { + name = "accsa%d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" +} + +resource "azurerm_virtual_machine" "test" { + name = "acctvm-%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" + + storage_image_reference { + publisher = "MicrosoftWindowsServer" + offer = "WindowsServer" + sku = "2012-Datacenter" + 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 = "winhost01" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_windows_config { + timezone = "Pacific Standard Time" + } +} +`, rInt, location, rInt, rInt, rInt, rInt, rInt) +} + +func testAccAzureRMVirtualMachineSystemAssignedIdentity(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%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_storage_account" "test" { + name = "accsa%d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + tags { + environment = "staging" + } +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" +} + +resource "azurerm_virtual_machine" "test" { + name = "acctvm-%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" + + 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" + disk_size_gb = "45" + } + + os_profile { + computer_name = "hn%d" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } + + tags { + environment = "Production" + cost-center = "Ops" + } + + identity { + type = "SystemAssigned" + } +} +`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt) +} + +func testAccAzureRMVirtualMachineUserAssignedIdentity(rInt int, location string, rString string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%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-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%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_storage_account" "test" { + name = "accsa%d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + tags { + environment = "staging" + } +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + container_access_type = "private" +} + +resource "azurerm_user_assigned_identity" "test" { + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + + name = "acctest%s" +} + +resource "azurerm_virtual_machine" "test" { + name = "acctvm-%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" + + 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" + disk_size_gb = "45" + } + + os_profile { + computer_name = "hn%d" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } + + tags { + environment = "Production" + cost-center = "Ops" + } + + identity { + type = "UserAssigned" + identity_ids = ["${azurerm_user_assigned_identity.test.id}"] + } +} +`, rInt, location, rInt, rInt, rInt, rInt, rString, rInt, rInt) +} diff --git a/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go b/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go index 4cac5fafa08cd..efcf1bf1e4b0d 100644 --- a/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go +++ b/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go @@ -2524,7 +2524,7 @@ resource "azurerm_virtual_machine" "test" { func testAccAzureRMVirtualMachine_linuxMachineWithSSH(rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg%s" + name = "acctestRG%s" location = "%s" } @@ -2611,7 +2611,7 @@ resource "azurerm_virtual_machine" "test" { func testAccAzureRMVirtualMachine_linuxMachineWithSSHRemoved(rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestrg%s" + name = "acctestRG%s" location = "%s" } diff --git a/azurerm/resource_arm_virtual_network.go b/azurerm/resource_arm_virtual_network.go index 60b255507714a..79197029a9d92 100644 --- a/azurerm/resource_arm_virtual_network.go +++ b/azurerm/resource_arm_virtual_network.go @@ -7,7 +7,7 @@ import ( "log" "net/http" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" diff --git a/azurerm/resource_arm_virtual_network_gateway.go b/azurerm/resource_arm_virtual_network_gateway.go index 5d5261eef4977..4cfd319787c06 100644 --- a/azurerm/resource_arm_virtual_network_gateway.go +++ b/azurerm/resource_arm_virtual_network_gateway.go @@ -6,10 +6,11 @@ import ( "log" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -23,6 +24,8 @@ func resourceArmVirtualNetworkGateway() *schema.Resource { State: schema.ImportStatePassthrough, }, + CustomizeDiff: resourceArmVirtualNetworkGatewayCustomizeDiff, + Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, @@ -138,9 +141,25 @@ func resourceArmVirtualNetworkGateway() *schema.Resource { Type: schema.TypeString, }, }, + "vpn_client_protocols": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(network.IkeV2), + string(network.SSTP), + }, true), + }, + }, "root_certificate": { Type: schema.TypeSet, - Required: true, + Optional: true, + + ConflictsWith: []string{ + "vpn_client_configuration.0.radius_server_address", + "vpn_client_configuration.0.radius_server_secret", + }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -158,6 +177,10 @@ func resourceArmVirtualNetworkGateway() *schema.Resource { "revoked_certificate": { Type: schema.TypeSet, Optional: true, + ConflictsWith: []string{ + "vpn_client_configuration.0.radius_server_address", + "vpn_client_configuration.0.radius_server_secret", + }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -172,6 +195,23 @@ func resourceArmVirtualNetworkGateway() *schema.Resource { }, Set: hashVirtualNetworkGatewayRevokedCert, }, + "radius_server_address": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{ + "vpn_client_configuration.0.root_certificate", + "vpn_client_configuration.0.revoked_certificate", + }, + ValidateFunc: validate.IPv4Address, + }, + "radius_server_secret": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{ + "vpn_client_configuration.0.root_certificate", + "vpn_client_configuration.0.revoked_certificate", + }, + }, }, }, }, @@ -493,12 +533,24 @@ func expandArmVirtualNetworkGatewayVpnClientConfig(d *schema.ResourceData) *netw revokedCerts = append(revokedCerts, r) } + var vpnClientProtocols []network.VpnClientProtocol + for _, vpnClientProtocol := range conf["vpn_client_protocols"].(*schema.Set).List() { + p := network.VpnClientProtocol(vpnClientProtocol.(string)) + vpnClientProtocols = append(vpnClientProtocols, p) + } + + confRadiusServerAddress := conf["radius_server_address"].(string) + confRadiusServerSecret := conf["radius_server_secret"].(string) + return &network.VpnClientConfiguration{ VpnClientAddressPool: &network.AddressSpace{ AddressPrefixes: &addresses, }, VpnClientRootCertificates: &rootCerts, VpnClientRevokedCertificates: &revokedCerts, + VpnClientProtocols: &vpnClientProtocols, + RadiusServerAddress: &confRadiusServerAddress, + RadiusServerSecret: &confRadiusServerSecret, } } @@ -576,6 +628,22 @@ func flattenArmVirtualNetworkGatewayVpnClientConfig(cfg *network.VpnClientConfig } flat["revoked_certificate"] = schema.NewSet(hashVirtualNetworkGatewayRevokedCert, revokedCerts) + vpnClientProtocols := &schema.Set{F: schema.HashString} + if vpnProtocols := cfg.VpnClientProtocols; vpnProtocols != nil { + for _, protocol := range *vpnProtocols { + vpnClientProtocols.Add(string(protocol)) + } + } + flat["vpn_client_protocols"] = vpnClientProtocols + + if v := cfg.RadiusServerAddress; v != nil { + flat["radius_server_address"] = *v + } + + if v := cfg.RadiusServerSecret; v != nil { + flat["radius_server_secret"] = *v + } + return []interface{}{flat} } @@ -660,3 +728,21 @@ func validateArmVirtualNetworkGatewayExpressRouteSku() schema.SchemaValidateFunc string(network.VirtualNetworkGatewaySkuTierUltraPerformance), }, true) } + +func resourceArmVirtualNetworkGatewayCustomizeDiff(diff *schema.ResourceDiff, v interface{}) error { + + if vpnClient, ok := diff.GetOk("vpn_client_configuration"); ok { + if vpnClientConfig, ok := vpnClient.([]interface{})[0].(map[string]interface{}); ok { + hasRadiusAddress := vpnClientConfig["radius_server_address"] != "" + hasRadiusSecret := vpnClientConfig["radius_server_secret"] != "" + + if hasRadiusAddress && !hasRadiusSecret { + return fmt.Errorf("if radius_server_address is set radius_server_secret must also be set") + } + if !hasRadiusAddress && hasRadiusSecret { + return fmt.Errorf("if radius_server_secret is set radius_server_address must also be set") + } + } + } + return nil +} diff --git a/azurerm/resource_arm_virtual_network_gateway_connection.go b/azurerm/resource_arm_virtual_network_gateway_connection.go index ac2feb8ae902b..d63c36473c122 100644 --- a/azurerm/resource_arm_virtual_network_gateway_connection.go +++ b/azurerm/resource_arm_virtual_network_gateway_connection.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -135,10 +135,12 @@ func resourceArmVirtualNetworkGatewayConnection() *schema.Resource { Required: true, DiffSuppressFunc: ignoreCaseDiffSuppressFunc, ValidateFunc: validation.StringInSlice([]string{ - string(network.MD5), - string(network.SHA1), - string(network.SHA256), - string(network.SHA384), + string(network.IkeIntegrityGCMAES128), + string(network.IkeIntegrityGCMAES256), + string(network.IkeIntegrityMD5), + string(network.IkeIntegritySHA1), + string(network.IkeIntegritySHA256), + string(network.IkeIntegritySHA384), }, true), }, "ipsec_encryption": { diff --git a/azurerm/resource_arm_virtual_network_gateway_test.go b/azurerm/resource_arm_virtual_network_gateway_test.go index 3ef5c3a7524ab..5e34d3433a2a9 100644 --- a/azurerm/resource_arm_virtual_network_gateway_test.go +++ b/azurerm/resource_arm_virtual_network_gateway_test.go @@ -12,6 +12,7 @@ import ( func TestAccAzureRMVirtualNetworkGateway_basic(t *testing.T) { ri := acctest.RandInt() + resourceName := "azurerm_virtual_network_gateway.test" config := testAccAzureRMVirtualNetworkGateway_basic(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -22,7 +23,8 @@ func TestAccAzureRMVirtualNetworkGateway_basic(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualNetworkGatewayExists("azurerm_virtual_network_gateway.test"), + testCheckAzureRMVirtualNetworkGatewayExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Basic"), ), }, }, @@ -31,6 +33,7 @@ func TestAccAzureRMVirtualNetworkGateway_basic(t *testing.T) { func TestAccAzureRMVirtualNetworkGateway_lowerCaseSubnetName(t *testing.T) { ri := acctest.RandInt() + resourceName := "azurerm_virtual_network_gateway.test" config := testAccAzureRMVirtualNetworkGateway_lowerCaseSubnetName(ri, testLocation()) resource.Test(t, resource.TestCase{ @@ -41,7 +44,8 @@ func TestAccAzureRMVirtualNetworkGateway_lowerCaseSubnetName(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMVirtualNetworkGatewayExists("azurerm_virtual_network_gateway.test"), + testCheckAzureRMVirtualNetworkGatewayExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Basic"), ), }, }, @@ -86,6 +90,91 @@ func TestAccAzureRMVirtualNetworkGateway_activeActive(t *testing.T) { }) } +func TestAccAzureRMVirtualNetworkGateway_standard(t *testing.T) { + resourceName := "azurerm_virtual_network_gateway.test" + ri := acctest.RandInt() + config := testAccAzureRMVirtualNetworkGateway_sku(ri, testLocation(), "Standard") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualNetworkGatewayExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "Standard"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualNetworkGateway_vpnGw2(t *testing.T) { + resourceName := "azurerm_virtual_network_gateway.test" + ri := acctest.RandInt() + config := testAccAzureRMVirtualNetworkGateway_sku(ri, testLocation(), "VpnGw2") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualNetworkGatewayExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "VpnGw2"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualNetworkGateway_vpnGw3(t *testing.T) { + resourceName := "azurerm_virtual_network_gateway.test" + ri := acctest.RandInt() + config := testAccAzureRMVirtualNetworkGateway_sku(ri, testLocation(), "VpnGw3") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualNetworkGatewayExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "sku", "VpnGw3"), + ), + }, + }, + }) +} + +func TestAccAzureRMVirtualNetworkGateway_vpnClientConfig(t *testing.T) { + ri := acctest.RandInt() + resourceName := "azurerm_virtual_network_gateway.test" + config := testAccAzureRMVirtualNetworkGateway_vpnClientConfig(ri, testLocation()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMVirtualNetworkGatewayExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "vpn_client_configuration.0.radius_server_address", "1.2.3.4"), + resource.TestCheckResourceAttr(resourceName, "vpn_client_configuration.0.vpn_client_protocols.#", "2"), + ), + }, + }, + }) +} + func testCheckAzureRMVirtualNetworkGatewayExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { name, resourceGroup, err := getArmResourceNameAndGroup(s, name) @@ -274,6 +363,7 @@ resource "azurerm_virtual_network_gateway" "test" { } func testAccAzureRMVirtualNetworkGateway_activeActive(rInt int, location string) string { + return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -294,6 +384,7 @@ resource "azurerm_subnet" "test" { address_prefix = "10.0.1.0/24" } + resource "azurerm_public_ip" "first" { name = "acctestpip1-%d" location = "${azurerm_resource_group.test.location}" @@ -303,12 +394,14 @@ resource "azurerm_public_ip" "first" { resource "azurerm_public_ip" "second" { name = "acctestpip2-%d" + location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" public_ip_address_allocation = "Dynamic" } resource "azurerm_virtual_network_gateway" "test" { + depends_on = ["azurerm_public_ip.first", "azurerm_public_ip.second"] name = "acctestvng-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -316,16 +409,19 @@ resource "azurerm_virtual_network_gateway" "test" { type = "Vpn" vpn_type = "RouteBased" sku = "VpnGw1" + active_active = true enable_bgp = true ip_configuration { name = "gw-ip1" public_ip_address_id = "${azurerm_public_ip.first.id}" + private_ip_address_allocation = "Dynamic" subnet_id = "${azurerm_subnet.test.id}" } + ip_configuration { name = "gw-ip2" public_ip_address_id = "${azurerm_public_ip.second.id}" @@ -338,4 +434,106 @@ resource "azurerm_virtual_network_gateway" "test" { } } `, rInt, location, rInt, rInt, rInt, rInt) + +} + +func testAccAzureRMVirtualNetworkGateway_vpnClientConfig(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestvn-%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" "test" { + name = "GatewaySubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.1.0/24" +} + +resource "azurerm_public_ip" "test" { + name = "acctestpip-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "Dynamic" +} + +resource "azurerm_virtual_network_gateway" "test" { + depends_on = ["azurerm_public_ip.test"] + name = "acctestvng-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + type = "Vpn" + vpn_type = "RouteBased" + sku = "VpnGw1" + + ip_configuration { + public_ip_address_id = "${azurerm_public_ip.test.id}" + private_ip_address_allocation = "Dynamic" + subnet_id = "${azurerm_subnet.test.id}" + } + + vpn_client_configuration { + address_space = ["10.2.0.0/24"] + vpn_client_protocols = ["SSTP", "IkeV2"] + + radius_server_address = "1.2.3.4" + radius_server_secret = "1234" + } +} +`, rInt, location, rInt, rInt, rInt) +} + +func testAccAzureRMVirtualNetworkGateway_sku(rInt int, location string, sku string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestvn-%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" "test" { + name = "GatewaySubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.1.0/24" +} + +resource "azurerm_public_ip" "test" { + name = "acctestpip-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "Dynamic" +} + +resource "azurerm_virtual_network_gateway" "test" { + name = "acctestvng-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + type = "Vpn" + vpn_type = "RouteBased" + sku = "%s" + + ip_configuration { + public_ip_address_id = "${azurerm_public_ip.test.id}" + private_ip_address_allocation = "Dynamic" + subnet_id = "${azurerm_subnet.test.id}" + } +} +`, rInt, location, rInt, rInt, rInt, sku) } diff --git a/azurerm/resource_arm_virtual_network_peering.go b/azurerm/resource_arm_virtual_network_peering.go index a24fb54418359..423ecac325f71 100644 --- a/azurerm/resource_arm_virtual_network_peering.go +++ b/azurerm/resource_arm_virtual_network_peering.go @@ -5,12 +5,12 @@ import ( "log" "sync" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) -// peerMutex is used to prevet multiple Peering resources being creaed, updated +// peerMutex is used to prevent multiple Peering resources being created, updated // or deleted at the same time var peerMutex = &sync.Mutex{} diff --git a/azurerm/resource_arm_virtual_network_test.go b/azurerm/resource_arm_virtual_network_test.go index a0085cd3b2d19..c971b785cc8ab 100644 --- a/azurerm/resource_arm_virtual_network_test.go +++ b/azurerm/resource_arm_virtual_network_test.go @@ -349,7 +349,7 @@ variable "network_cidr" { } resource "azurerm_resource_group" "test" { - name = "acctestrg%s" + name = "acctestRG%s" location = "%s" } diff --git a/azurerm/resourceid.go b/azurerm/resourceid.go index 5523b43f23bfc..1cc213c26df4f 100644 --- a/azurerm/resourceid.go +++ b/azurerm/resourceid.go @@ -2,11 +2,13 @@ package azurerm import ( "fmt" - "net/url" - "sort" - "strings" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" ) +//PLEASE NOTE: This code has been moved to terraform-provider-azurerm/azurerm/helpers/azure +//this file is simply a shim to prevent mass code changes + // ResourceID represents a parsed long-form Azure Resource Manager ID // with the Subscription ID, Resource Group and the Provider as top- // level fields, and other key-value pairs available via a map in the @@ -23,116 +25,17 @@ type ResourceID struct { // which is obviously not good, but the best thing available given the // SDK. func parseAzureResourceID(id string) (*ResourceID, error) { - idURL, err := url.ParseRequestURI(id) + parsed, err := azure.ParseAzureResourceID(id) if err != nil { - return nil, fmt.Errorf("Cannot parse Azure Id: %s", err) - } - - path := idURL.Path - - path = strings.TrimSpace(path) - if strings.HasPrefix(path, "/") { - path = path[1:] - } - - if strings.HasSuffix(path, "/") { - path = path[:len(path)-1] - } - - components := strings.Split(path, "/") - - // We should have an even number of key-value pairs. - if len(components)%2 != 0 { - return nil, fmt.Errorf("The number of path segments is not divisible by 2 in %q", path) - } - - var subscriptionID string - - // Put the constituent key-value pairs into a map - componentMap := make(map[string]string, len(components)/2) - for current := 0; current < len(components); current += 2 { - key := components[current] - value := components[current+1] - - // Check key/value for empty strings. - if key == "" || value == "" { - return nil, fmt.Errorf("Key/Value cannot be empty strings. Key: '%s', Value: '%s'", key, value) - } - - // Catch the subscriptionID before it can be overwritten by another "subscriptions" - // value in the ID which is the case for the Service Bus subscription resource - if key == "subscriptions" && subscriptionID == "" { - subscriptionID = value - } else { - componentMap[key] = value - } - } - - // Build up a ResourceID from the map - idObj := &ResourceID{} - idObj.Path = componentMap - - if subscriptionID != "" { - idObj.SubscriptionID = subscriptionID - } else { - return nil, fmt.Errorf("No subscription ID found in: %q", path) - } - - if resourceGroup, ok := componentMap["resourceGroups"]; ok { - idObj.ResourceGroup = resourceGroup - delete(componentMap, "resourceGroups") - } else { - // Some Azure APIs are weird and provide things in lower case... - // However it's not clear whether the casing of other elements in the URI - // matter, so we explicitly look for that case here. - if resourceGroup, ok := componentMap["resourcegroups"]; ok { - idObj.ResourceGroup = resourceGroup - delete(componentMap, "resourcegroups") - } else { - return nil, fmt.Errorf("No resource group name found in: %q", path) - } - } - - // It is OK not to have a provider in the case of a resource group - if provider, ok := componentMap["providers"]; ok { - idObj.Provider = provider - delete(componentMap, "providers") - } - - return idObj, nil -} - -func composeAzureResourceID(idObj *ResourceID) (id string, err error) { - if idObj.SubscriptionID == "" || idObj.ResourceGroup == "" { - return "", fmt.Errorf("SubscriptionID and ResourceGroup cannot be empty") - } - - id = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s", idObj.SubscriptionID, idObj.ResourceGroup) - - if idObj.Provider != "" { - if len(idObj.Path) < 1 { - return "", fmt.Errorf("ResourceID.Path should have at least one item when ResourceID.Provider is specified") - } - - id += fmt.Sprintf("/providers/%s", idObj.Provider) - - // sort the path keys so our output is deterministic - var pathKeys []string - for k := range idObj.Path { - pathKeys = append(pathKeys, k) - } - sort.Strings(pathKeys) - - for _, k := range pathKeys { - v := idObj.Path[k] - if k == "" || v == "" { - return "", fmt.Errorf("ResourceID.Path cannot contain empty strings") - } - id += fmt.Sprintf("/%s/%s", k, v) - } + return nil, err } - return + return &ResourceID{ + SubscriptionID: parsed.SubscriptionID, + ResourceGroup: parsed.ResourceGroup, + Provider: parsed.Provider, + Path: parsed.Path, + }, nil } func parseNetworkSecurityGroupName(networkSecurityGroupId string) (string, error) { diff --git a/azurerm/testdata/sql_import.bacpac b/azurerm/testdata/sql_import.bacpac new file mode 100644 index 0000000000000..98825ab441bb5 Binary files /dev/null and b/azurerm/testdata/sql_import.bacpac differ diff --git a/azurerm/validators.go b/azurerm/validators.go index 94df9dfa35193..f4ed1e78394c0 100644 --- a/azurerm/validators.go +++ b/azurerm/validators.go @@ -2,11 +2,13 @@ package azurerm import ( "fmt" + "math" "regexp" "time" "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" "github.com/satori/uuid" ) @@ -74,3 +76,160 @@ func validateIso8601Duration() schema.SchemaValidateFunc { return } } + +func validateAzureVirtualMachineTimeZone() schema.SchemaValidateFunc { + // Candidates are listed here: http://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/ + candidates := []string{ + "", + "Afghanistan Standard Time", + "Alaskan Standard Time", + "Arab Standard Time", + "Arabian Standard Time", + "Arabic Standard Time", + "Argentina Standard Time", + "Atlantic Standard Time", + "AUS Central Standard Time", + "AUS Eastern Standard Time", + "Azerbaijan Standard Time", + "Azores Standard Time", + "Bahia Standard Time", + "Bangladesh Standard Time", + "Belarus Standard Time", + "Canada Central Standard Time", + "Cape Verde Standard Time", + "Caucasus Standard Time", + "Cen. Australia Standard Time", + "Central America Standard Time", + "Central Asia Standard Time", + "Central Brazilian Standard Time", + "Central Europe Standard Time", + "Central European Standard Time", + "Central Pacific Standard Time", + "Central Standard Time (Mexico)", + "Central Standard Time", + "China Standard Time", + "Dateline Standard Time", + "E. Africa Standard Time", + "E. Australia Standard Time", + "E. Europe Standard Time", + "E. South America Standard Time", + "Eastern Standard Time (Mexico)", + "Eastern Standard Time", + "Egypt Standard Time", + "Ekaterinburg Standard Time", + "Fiji Standard Time", + "FLE Standard Time", + "Georgian Standard Time", + "GMT Standard Time", + "Greenland Standard Time", + "Greenwich Standard Time", + "GTB Standard Time", + "Hawaiian Standard Time", + "India Standard Time", + "Iran Standard Time", + "Israel Standard Time", + "Jordan Standard Time", + "Kaliningrad Standard Time", + "Korea Standard Time", + "Libya Standard Time", + "Line Islands Standard Time", + "Magadan Standard Time", + "Mauritius Standard Time", + "Middle East Standard Time", + "Montevideo Standard Time", + "Morocco Standard Time", + "Mountain Standard Time (Mexico)", + "Mountain Standard Time", + "Myanmar Standard Time", + "N. Central Asia Standard Time", + "Namibia Standard Time", + "Nepal Standard Time", + "New Zealand Standard Time", + "Newfoundland Standard Time", + "North Asia East Standard Time", + "North Asia Standard Time", + "Pacific SA Standard Time", + "Pacific Standard Time (Mexico)", + "Pacific Standard Time", + "Pakistan Standard Time", + "Paraguay Standard Time", + "Romance Standard Time", + "Russia Time Zone 10", + "Russia Time Zone 11", + "Russia Time Zone 3", + "Russian Standard Time", + "SA Eastern Standard Time", + "SA Pacific Standard Time", + "SA Western Standard Time", + "Samoa Standard Time", + "SE Asia Standard Time", + "Singapore Standard Time", + "South Africa Standard Time", + "Sri Lanka Standard Time", + "Syria Standard Time", + "Taipei Standard Time", + "Tasmania Standard Time", + "Tokyo Standard Time", + "Tonga Standard Time", + "Turkey Standard Time", + "Ulaanbaatar Standard Time", + "US Eastern Standard Time", + "US Mountain Standard Time", + "UTC", + "UTC+12", + "UTC-02", + "UTC-11", + "Venezuela Standard Time", + "Vladivostok Standard Time", + "W. Australia Standard Time", + "W. Central Africa Standard Time", + "W. Europe Standard Time", + "West Asia Standard Time", + "West Pacific Standard Time", + "Yakutsk Standard Time", + } + return validation.StringInSlice(candidates, true) +} + +// intBetweenDivisibleBy returns a SchemaValidateFunc which tests if the provided value +// is of type int and is between min and max (inclusive) and is divisible by a given number +func validateIntBetweenDivisibleBy(min, max, divisor int) schema.SchemaValidateFunc { + return func(i interface{}, k string) (s []string, es []error) { + v, ok := i.(int) + if !ok { + es = append(es, fmt.Errorf("expected type of %s to be int", k)) + return + } + + if v < min || v > max { + es = append(es, fmt.Errorf("expected %s to be in the range (%d - %d), got %d", k, min, max, v)) + return + } + + if math.Mod(float64(v), float64(divisor)) != 0 { + es = append(es, fmt.Errorf("expected %s to be divisible by %d", k, divisor)) + return + } + + return + } +} + +func validateCollation() schema.SchemaValidateFunc { + return func(i interface{}, k string) (s []string, es []error) { + v, ok := i.(string) + if !ok { + es = append(es, fmt.Errorf("expected type of %s to be string", k)) + return + } + + matched, _ := regexp.MatchString(`^[A-Za-z0-9_. ]+$`, v) + + if !matched { + es = append(es, fmt.Errorf("%s contains invalid characters, only underscores are supported, got %s", k, v)) + return + } + + return + } +} diff --git a/azurerm/validators_test.go b/azurerm/validators_test.go index 31adecdf6e6d4..281855458f7d9 100644 --- a/azurerm/validators_test.go +++ b/azurerm/validators_test.go @@ -1,6 +1,7 @@ package azurerm import ( + "strconv" "testing" ) @@ -128,3 +129,125 @@ func TestValidateIso8601Duration(t *testing.T) { } } } + +func TestValidateIntBetweenDivisibleBy(t *testing.T) { + cases := []struct { + Min int + Max int + Div int + Value interface{} + Errors int + }{ + { + Min: 1025, + Max: 2048, + Div: 1024, + Value: 1024, + Errors: 1, + }, + { + Min: 1025, + Max: 2048, + Div: 3, + Value: 1024, + Errors: 1, + }, + { + Min: 1024, + Max: 2048, + Div: 1024, + Value: 3072, + Errors: 1, + }, + { + Min: 1024, + Max: 2048, + Div: 1024, + Value: 2049, + Errors: 1, + }, + { + Min: 1024, + Max: 2048, + Div: 1024, + Value: 1024, + Errors: 0, + }, + } + + for _, tc := range cases { + _, errors := validateIntBetweenDivisibleBy(tc.Min, tc.Max, tc.Div)(tc.Value, strconv.Itoa(tc.Value.(int))) + if len(errors) != tc.Errors { + t.Fatalf("Expected intBetweenDivisibleBy to trigger '%d' errors for '%s' - got '%d'", tc.Errors, tc.Value, len(errors)) + } + } +} + +func TestValidateCollation(t *testing.T) { + cases := []struct { + Value string + Errors int + }{ + { + Value: "en-US", + Errors: 1, + }, + { + Value: "en_US", + Errors: 0, + }, + { + Value: "en US", + Errors: 0, + }, + { + Value: "English_United States.1252", + Errors: 0, + }, + } + + for _, tc := range cases { + _, errors := validateCollation()(tc.Value, "collation") + if len(errors) != tc.Errors { + t.Fatalf("Expected validateCollation to trigger '%d' errors for '%s' - got '%d'", tc.Errors, tc.Value, len(errors)) + } + } +} + +func TestValidateAzureVirtualMachineTimeZone(t *testing.T) { + cases := []struct { + Value string + Errors int + }{ + { + Value: "", + Errors: 0, + }, + { + Value: "UTC", + Errors: 0, + }, + { + Value: "China Standard Time", + Errors: 0, + }, + { + // Valid UTC time zone + Value: "utc-11", + Errors: 0, + }, + { + // Invalid UTC time zone + Value: "UTC-30", + Errors: 1, + }, + } + + for _, tc := range cases { + _, errors := validateAzureVirtualMachineTimeZone()(tc.Value, "unittest") + + if len(errors) != tc.Errors { + t.Fatalf("Expected validateAzureVMTimeZone to trigger '%d' errors for '%s' - got '%d'", tc.Errors, tc.Value, len(errors)) + } + } +} diff --git a/examples/2-vms-loadbalancer-lbrules/README.md b/examples/2-vms-loadbalancer-lbrules/README.md index 5730f2ad951e6..0776c73a88502 100644 --- a/examples/2-vms-loadbalancer-lbrules/README.md +++ b/examples/2-vms-loadbalancer-lbrules/README.md @@ -1,6 +1,6 @@ # Create 2 Virtual Machines under a Load balancer and configures Load Balancing rules for the VMs -This Terraform template was based on [this](https://github.com/Azure/azure-quickstart-templates/tree/master/201-2-vms-loadbalancer-lbrules) Azure Quickstart Template. Changes to the ARM template may have occured since the creation of this example may not be reflected here. +This Terraform template was based on [this](https://github.com/Azure/azure-quickstart-templates/tree/master/201-2-vms-loadbalancer-lbrules) Azure Quickstart Template. Changes to the ARM template may have occurred since the creation of this example may not be reflected here. This template allows you to create 2 Virtual Machines under a Load balancer and configure a load balancing rule on Port 80. This template also deploys a Storage Account, Virtual Network, Public IP address, Availability Set, and Network Interfaces. diff --git a/examples/2-vms-loadbalancer-lbrules/main.tf b/examples/2-vms-loadbalancer-lbrules/main.tf index 1fc737fc11bce..759dacc74d34f 100644 --- a/examples/2-vms-loadbalancer-lbrules/main.tf +++ b/examples/2-vms-loadbalancer-lbrules/main.tf @@ -143,4 +143,6 @@ resource "azurerm_virtual_machine" "vm" { admin_username = "${var.admin_username}" admin_password = "${var.admin_password}" } + + os_profile_windows_config {} } diff --git a/examples/2-vms-loadbalancer-lbrules/outputs.tf b/examples/2-vms-loadbalancer-lbrules/outputs.tf index 19757fa523aac..0a9e743dd5ece 100644 --- a/examples/2-vms-loadbalancer-lbrules/outputs.tf +++ b/examples/2-vms-loadbalancer-lbrules/outputs.tf @@ -6,6 +6,6 @@ output "vm_fqdn" { value = "${azurerm_public_ip.lbpip.fqdn}" } -output "ssh_command" { - value = "ssh ${var.admin_username}@${azurerm_public_ip.lbpip.fqdn}" +output "VMs RDP acces" { + value = "${formatlist("RDP_URL=%v:%v", azurerm_public_ip.lbpip.fqdn, azurerm_lb_nat_rule.tcp.*.frontend_port)}" } diff --git a/examples/2-vms-loadbalancer-lbrules/variables.tf b/examples/2-vms-loadbalancer-lbrules/variables.tf index 55b07181c6d87..c294945f916dc 100644 --- a/examples/2-vms-loadbalancer-lbrules/variables.tf +++ b/examples/2-vms-loadbalancer-lbrules/variables.tf @@ -51,7 +51,7 @@ variable "storage_replication_type" { variable "vm_size" { description = "Specifies the size of the virtual machine." - default = "Standard_D1" + default = "Standard_D1_v2" } variable "image_publisher" { diff --git a/examples/aci-linux-multi/main.tf b/examples/aci-linux-multi/main.tf index 6d525b1a4e22a..e7a9a8f3e8ad0 100644 --- a/examples/aci-linux-multi/main.tf +++ b/examples/aci-linux-multi/main.tf @@ -1,38 +1,38 @@ resource "azurerm_resource_group" "aci-rg" { - name = "${var.resource_group_name}" - location = "${var.resource_group_location}" + name = "${var.resource_group_name}" + location = "${var.resource_group_location}" } #an attempt to keep the aci container group name (and dns label) somewhat unique resource "random_integer" "random_int" { - min = 100 - max = 999 + min = 100 + max = 999 } resource "azurerm_container_group" "aci-example" { - name = "my-aci-cg-${random_integer.random_int.result}" - location = "${azurerm_resource_group.aci-rg.location}" - resource_group_name = "${azurerm_resource_group.aci-rg.name}" - ip_address_type = "public" - dns_name_label = "my-aci-cg-${random_integer.random_int.result}" - os_type = "linux" + name = "my-aci-cg-${random_integer.random_int.result}" + location = "${azurerm_resource_group.aci-rg.location}" + resource_group_name = "${azurerm_resource_group.aci-rg.name}" + ip_address_type = "public" + dns_name_label = "my-aci-cg-${random_integer.random_int.result}" + os_type = "linux" - container { - name = "hw" - image = "microsoft/aci-helloworld:latest" - cpu = "0.5" - memory = "1.5" - port = "80" - } + container { + name = "hw" + image = "microsoft/aci-helloworld:latest" + cpu = "0.5" + memory = "1.5" + port = "80" + } - container { - name = "sidecar" - image = "microsoft/aci-tutorial-sidecar" - cpu = "0.5" - memory = "1.5" - } + container { + name = "sidecar" + image = "microsoft/aci-tutorial-sidecar" + cpu = "0.5" + memory = "1.5" + } - tags { - environment = "testing" - } + tags { + environment = "testing" + } } diff --git a/examples/aci-linux-multi/outputs.tf b/examples/aci-linux-multi/outputs.tf index 45ff1b4614ed7..dbc2301b875a4 100644 --- a/examples/aci-linux-multi/outputs.tf +++ b/examples/aci-linux-multi/outputs.tf @@ -1,9 +1,8 @@ - output "ip_address" { - value = "${azurerm_container_group.aci-example.ip_address}" + value = "${azurerm_container_group.aci-example.ip_address}" } #the dns fqdn of the container group if dns_name_label is set output "fqdn" { - value = "${azurerm_container_group.aci-example.fqdn}" -} \ No newline at end of file + value = "${azurerm_container_group.aci-example.fqdn}" +} diff --git a/examples/aci-linux-volume-mount/main.tf b/examples/aci-linux-volume-mount/main.tf index 738a0c85ae0c9..f83926796e519 100644 --- a/examples/aci-linux-volume-mount/main.tf +++ b/examples/aci-linux-volume-mount/main.tf @@ -1,60 +1,59 @@ -resource "azurerm_resource_group" "aci-rg" { - name = "${var.resource_group_name}" - location = "${var.resource_group_location}" -} - -#storage account name needs to be globally unique so lets generate a random id -resource "random_integer" "random_int" { - min = 100 - max = 999 -} - -resource "azurerm_storage_account" "aci-sa" { - name = "acistorageacct${random_integer.random_int.result}" - resource_group_name = "${azurerm_resource_group.aci-rg.name}" - location = "${azurerm_resource_group.aci-rg.location}" - account_tier = "Standard" - account_replication_type = "LRS" -} - -resource "azurerm_storage_share" "aci-share" { - name = "aci-test-share" - - resource_group_name = "${azurerm_resource_group.aci-rg.name}" - storage_account_name = "${azurerm_storage_account.aci-sa.name}" - - quota = 50 -} - -resource "azurerm_container_group" "aci-example" { - - name = "mycontainergroup-${random_integer.random_int.result}" - location = "${azurerm_resource_group.aci-rg.location}" - resource_group_name = "${azurerm_resource_group.aci-rg.name}" - ip_address_type = "public" - dns_name_label = "mycontainergroup-${random_integer.random_int.result}" - os_type = "linux" - - container { - name = "webserver" - image = "seanmckenna/aci-hellofiles" - cpu = "1" - memory = "1.5" - port = "80" - protocol = "tcp" - - volume { - name = "logs" - mount_path = "/aci/logs" - read_only = false - share_name = "${azurerm_storage_share.aci-share.name}" - - storage_account_name = "${azurerm_storage_account.aci-sa.name}" - storage_account_key = "${azurerm_storage_account.aci-sa.primary_access_key}" - } - } - - tags { - environment = "testing" - } -} +resource "azurerm_resource_group" "aci-rg" { + name = "${var.resource_group_name}" + location = "${var.resource_group_location}" +} + +#storage account name needs to be globally unique so lets generate a random id +resource "random_integer" "random_int" { + min = 100 + max = 999 +} + +resource "azurerm_storage_account" "aci-sa" { + name = "acistorageacct${random_integer.random_int.result}" + resource_group_name = "${azurerm_resource_group.aci-rg.name}" + location = "${azurerm_resource_group.aci-rg.location}" + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_share" "aci-share" { + name = "aci-test-share" + + resource_group_name = "${azurerm_resource_group.aci-rg.name}" + storage_account_name = "${azurerm_storage_account.aci-sa.name}" + + quota = 50 +} + +resource "azurerm_container_group" "aci-example" { + name = "mycontainergroup-${random_integer.random_int.result}" + location = "${azurerm_resource_group.aci-rg.location}" + resource_group_name = "${azurerm_resource_group.aci-rg.name}" + ip_address_type = "public" + dns_name_label = "mycontainergroup-${random_integer.random_int.result}" + os_type = "linux" + + container { + name = "webserver" + image = "seanmckenna/aci-hellofiles" + cpu = "1" + memory = "1.5" + port = "80" + protocol = "tcp" + + volume { + name = "logs" + mount_path = "/aci/logs" + read_only = false + share_name = "${azurerm_storage_share.aci-share.name}" + + storage_account_name = "${azurerm_storage_account.aci-sa.name}" + storage_account_key = "${azurerm_storage_account.aci-sa.primary_access_key}" + } + } + + tags { + environment = "testing" + } +} diff --git a/examples/aci-linux-volume-mount/outputs.tf b/examples/aci-linux-volume-mount/outputs.tf index 45ff1b4614ed7..dbc2301b875a4 100644 --- a/examples/aci-linux-volume-mount/outputs.tf +++ b/examples/aci-linux-volume-mount/outputs.tf @@ -1,9 +1,8 @@ - output "ip_address" { - value = "${azurerm_container_group.aci-example.ip_address}" + value = "${azurerm_container_group.aci-example.ip_address}" } #the dns fqdn of the container group if dns_name_label is set output "fqdn" { - value = "${azurerm_container_group.aci-example.fqdn}" -} \ No newline at end of file + value = "${azurerm_container_group.aci-example.fqdn}" +} diff --git a/examples/app-service/app.tf b/examples/app-service/app.tf index d2cf74a134840..8316a2bf49d0c 100644 --- a/examples/app-service/app.tf +++ b/examples/app-service/app.tf @@ -8,8 +8,13 @@ resource "azurerm_resource_group" "default" { location = "${var.location}" } +resource "random_integer" "ri" { + min = 10000 + max = 99999 +} + resource "azurerm_app_service_plan" "default" { - name = "${var.app_service_name}-plan" + name = "tfex-appservice-${random_integer.ri.result}-plan" location = "${azurerm_resource_group.default.location}" resource_group_name = "${azurerm_resource_group.default.name}" @@ -20,7 +25,7 @@ resource "azurerm_app_service_plan" "default" { } resource "azurerm_app_service" "default" { - name = "${var.app_service_name}" + name = "tfex-appservice-${random_integer.ri.result}" location = "${azurerm_resource_group.default.location}" resource_group_name = "${azurerm_resource_group.default.name}" app_service_plan_id = "${azurerm_app_service_plan.default.id}" diff --git a/examples/app-service/variables.tf b/examples/app-service/variables.tf index 6d9f8e8d18d8b..de3130794e0f1 100644 --- a/examples/app-service/variables.tf +++ b/examples/app-service/variables.tf @@ -1,21 +1,23 @@ variable "resource_group_name" { - type = "string" + type = "string" + description = "Name of the azure resource group." + default = "tfex-appserviceplan" } variable "location" { - type = "string" -} - -variable "app_service_name" { - type = "string" + type = "string" + description = "Location of the azure resource group." + default = "westus" } variable "app_service_plan_sku_tier" { - type = "string" - default = "Basic" # Basic | Standard | ... + type = "string" + description = "SKU tier of the App Service Plan" + default = "Basic" # Basic | Standard | ... } variable "app_service_plan_sku_size" { - type = "string" - default = "B1" # B1 | S1 | ... + type = "string" + description = "SKU size of the App Service Plan" + default = "B1" # B1 | S1 | ... } diff --git a/examples/automation-account/main.tf b/examples/automation-account/main.tf new file mode 100644 index 0000000000000..f1a2ee4ae7d13 --- /dev/null +++ b/examples/automation-account/main.tf @@ -0,0 +1,32 @@ + +resource "azurerm_resource_group" "rg" { + name = "${var.resource_group_name}" + location = "${var.resource_group_location}" +} + +resource "azurerm_automation_account" "account" { + name = "tfex-automation-account" + location = "${azurerm_resource_group.rg.location}" + resource_group_name = "${azurerm_resource_group.rg.name}" + + sku { + name = "Basic" + } +} + +resource "azurerm_automation_schedule" "one-time" { + name = "tfex-automation_schedule-one_time" + resource_group_name = "${azurerm_resource_group.rg.name}" + automation_account_name = "${azurerm_automation_account.account.name}" + frequency = "OneTime" + //defaults start_time to now + 7 min +} + +resource "azurerm_automation_schedule" "hour" { + name = "tfex-automation_schedule-hour" + resource_group_name = "${azurerm_resource_group.rg.name}" + automation_account_name = "${azurerm_automation_account.account.name}" + frequency = "Hour" + interval = 2 + //timezone defaults to UTC +} diff --git a/examples/automation-account/outputs.tf b/examples/automation-account/outputs.tf new file mode 100644 index 0000000000000..bb37dcf72ecab --- /dev/null +++ b/examples/automation-account/outputs.tf @@ -0,0 +1,8 @@ + +output "automation_schedule-start_time" { + value = "${azurerm_automation_schedule.one-time.start_time}" +} + +output "automation_schedule-week-interval" { + value = "${azurerm_automation_schedule.hour.interval}" +} \ No newline at end of file diff --git a/examples/automation-account/variables.tf b/examples/automation-account/variables.tf new file mode 100644 index 0000000000000..492bd5b309ad2 --- /dev/null +++ b/examples/automation-account/variables.tf @@ -0,0 +1,11 @@ +variable "resource_group_name" { + type = "string" + description = "Name of the azure resource group." + default = "tfex-automation_account" +} + +variable "resource_group_location" { + type = "string" + description = "Location of the azure resource group." + default = "west europe" +} diff --git a/examples/cdn-with-storage-account/main.tf b/examples/cdn-with-storage-account/main.tf index 591f4a672874f..dba4f646d4213 100644 --- a/examples/cdn-with-storage-account/main.tf +++ b/examples/cdn-with-storage-account/main.tf @@ -11,9 +11,9 @@ resource "azurerm_resource_group" "rg" { } resource "azurerm_storage_account" "stor" { - name = "${var.resource_group}stor" - location = "${var.location}" - resource_group_name = "${azurerm_resource_group.rg.name}" + name = "${var.resource_group}stor" + location = "${var.location}" + resource_group_name = "${azurerm_resource_group.rg.name}" account_tier = "${var.storage_account_tier}" account_replication_type = "${var.storage_replication_type}" } @@ -26,10 +26,10 @@ resource "azurerm_cdn_profile" "cdn" { } resource "azurerm_cdn_endpoint" "cdnendpt" { - name = "${var.resource_group}CdnEndpoint1" - profile_name = "${azurerm_cdn_profile.cdn.name}" - location = "${var.location}" - resource_group_name = "${azurerm_resource_group.rg.name}" + name = "${var.resource_group}CdnEndpoint1" + profile_name = "${azurerm_cdn_profile.cdn.name}" + location = "${var.location}" + resource_group_name = "${azurerm_resource_group.rg.name}" origin { name = "${var.resource_group}Origin1" @@ -37,4 +37,4 @@ resource "azurerm_cdn_endpoint" "cdnendpt" { http_port = 80 https_port = 443 } -} \ No newline at end of file +} diff --git a/examples/cdn-with-storage-account/variables.tf b/examples/cdn-with-storage-account/variables.tf index 5b1c9f541cacf..900b70eb16d47 100644 --- a/examples/cdn-with-storage-account/variables.tf +++ b/examples/cdn-with-storage-account/variables.tf @@ -20,4 +20,4 @@ variable "storage_replication_type" { variable "host_name" { description = "A string that determines the hostname/IP address of the origin server. This string could be a domain name, IPv4 address or IPv6 address." default = "www.hostnameoforiginserver.com" -} \ No newline at end of file +} diff --git a/examples/cosmos-db/main.tf b/examples/cosmos-db/main.tf index dadd2dbff4307..7b205e23a2a0c 100644 --- a/examples/cosmos-db/main.tf +++ b/examples/cosmos-db/main.tf @@ -1,40 +1,39 @@ - resource "azurerm_resource_group" "rg" { - name = "${var.resource_group_name}" - location = "${var.resource_group_location}" + name = "${var.resource_group_name}" + location = "${var.resource_group_location}" } resource "random_integer" "ri" { - min = 10000 - max = 99999 + min = 10000 + max = 99999 } resource "azurerm_cosmosdb_account" "db" { - name = "tfex-cosmos-db-${random_integer.ri.result}" - location = "${azurerm_resource_group.rg.location}" - resource_group_name = "${azurerm_resource_group.rg.name}" - offer_type = "Standard" - kind = "GlobalDocumentDB" - - enable_automatic_failover = true - - //set ip_range_filter to allow azure services (0.0.0.0) and azure portal. - ip_range_filter = "0.0.0.0,104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26" - - consistency_policy { - consistency_level = "BoundedStaleness" - max_interval_in_seconds = 10 - max_staleness_prefix = 200 - } - - geo_location { - prefix = "tfex-cosmos-db-${random_integer.ri.result}-customid" - location = "${azurerm_resource_group.rg.location}" - failover_priority = 2 - } - - geo_location { - location = "${var.failover_location}" - failover_priority = 0 - } + name = "tfex-cosmos-db-${random_integer.ri.result}" + location = "${azurerm_resource_group.rg.location}" + resource_group_name = "${azurerm_resource_group.rg.name}" + offer_type = "Standard" + kind = "GlobalDocumentDB" + + enable_automatic_failover = true + + //set ip_range_filter to allow azure services (0.0.0.0) and azure portal. + ip_range_filter = "0.0.0.0,104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26" + + consistency_policy { + consistency_level = "BoundedStaleness" + max_interval_in_seconds = 10 + max_staleness_prefix = 200 + } + + geo_location { + prefix = "tfex-cosmos-db-${random_integer.ri.result}-customid" + location = "${azurerm_resource_group.rg.location}" + failover_priority = 2 + } + + geo_location { + location = "${var.failover_location}" + failover_priority = 0 + } } diff --git a/examples/cosmos-db/outputs.tf b/examples/cosmos-db/outputs.tf index 7f4aa9f35c247..c976dda996d93 100644 --- a/examples/cosmos-db/outputs.tf +++ b/examples/cosmos-db/outputs.tf @@ -1,4 +1,3 @@ - output "cosmos-db-id" { value = "${azurerm_cosmosdb_account.db.id}" } @@ -10,6 +9,7 @@ output "cosmos-db-endpoint" { output "cosmos-db-endpoints_read" { value = "${azurerm_cosmosdb_account.db.read_endpoints}" } + output "cosmos-db-endpoints_write" { value = "${azurerm_cosmosdb_account.db.write_endpoints}" } @@ -20,4 +20,4 @@ output "cosmos-db-primary_master_key" { output "cosmos-db-secondary_master_key" { value = "${azurerm_cosmosdb_account.db.secondary_master_key}" -} \ No newline at end of file +} diff --git a/examples/cosmos-db/variables.tf b/examples/cosmos-db/variables.tf index 9aa566eaa88f4..2de35a04e29a6 100644 --- a/examples/cosmos-db/variables.tf +++ b/examples/cosmos-db/variables.tf @@ -14,4 +14,4 @@ variable "failover_location" { type = "string" description = "Location of the failover instance." default = "eastus" -} \ No newline at end of file +} diff --git a/examples/encrypt-running-linux-vm/main.tf b/examples/encrypt-running-linux-vm/main.tf index a4bda0cf7e385..5285452094f53 100644 --- a/examples/encrypt-running-linux-vm/main.tf +++ b/examples/encrypt-running-linux-vm/main.tf @@ -37,9 +37,9 @@ resource "azurerm_network_interface" "nic" { } resource "azurerm_storage_account" "stor" { - name = "${var.hostname}stor" - resource_group_name = "${azurerm_resource_group.rg.name}" - location = "${azurerm_resource_group.rg.location}" + name = "${var.hostname}stor" + resource_group_name = "${azurerm_resource_group.rg.name}" + location = "${azurerm_resource_group.rg.location}" account_tier = "${var.storage_account_tier}" account_replication_type = "${var.storage_replication_type}" } diff --git a/examples/freebsd-jumpbox/main.tf b/examples/freebsd-jumpbox/main.tf index eb2cf039f88df..471d3bfab2bbe 100644 --- a/examples/freebsd-jumpbox/main.tf +++ b/examples/freebsd-jumpbox/main.tf @@ -27,10 +27,10 @@ resource "azurerm_subnet" "mgmt-subnet" { } resource "azurerm_subnet" "web-subnet" { - name = "${azurerm_resource_group.rg.name}-web-subnet" - virtual_network_name = "${azurerm_virtual_network.vnet.name}" - resource_group_name = "${azurerm_resource_group.rg.name}" - address_prefix = "${var.web-subnet_prefix}" + name = "${azurerm_resource_group.rg.name}-web-subnet" + virtual_network_name = "${azurerm_virtual_network.vnet.name}" + resource_group_name = "${azurerm_resource_group.rg.name}" + address_prefix = "${var.web-subnet_prefix}" network_security_group_id = "${azurerm_network_security_group.web-nsg.id}" } @@ -63,7 +63,7 @@ resource "azurerm_network_security_group" "web-nsg" { resource_group_name = "${azurerm_resource_group.rg.name}" location = "${azurerm_resource_group.rg.location}" - security_rule { + security_rule { name = "allow-www" description = "Allow HTTP Traffic" priority = 100 @@ -83,9 +83,9 @@ resource "azurerm_network_security_group" "web-nsg" { # ************************** NETWORK INTERFACES **************************** # resource "azurerm_network_interface" "nic" { - name = "${azurerm_resource_group.rg.name}-nic" - location = "${var.location}" - resource_group_name = "${azurerm_resource_group.rg.name}" + name = "${azurerm_resource_group.rg.name}-nic" + location = "${var.location}" + resource_group_name = "${azurerm_resource_group.rg.name}" network_security_group_id = "${azurerm_network_security_group.mgmt-nsg.id}" ip_configuration { @@ -169,8 +169,9 @@ resource "azurerm_virtual_machine" "vm" { os_profile_linux_config { disable_password_authentication = true + ssh_keys { - path = "/home/${var.admin_username}/.ssh/authorized_keys" + path = "/home/${var.admin_username}/.ssh/authorized_keys" key_data = "${var.ssh_key_data}" } } @@ -179,8 +180,8 @@ resource "azurerm_virtual_machine" "vm" { enabled = true storage_uri = "${azurerm_storage_account.stor.primary_blob_endpoint}" } - + tags { environment = "Management" } -} \ No newline at end of file +} diff --git a/examples/freebsd-jumpbox/outputs.tf b/examples/freebsd-jumpbox/outputs.tf index 32c6294ceeab9..13768e554d6cc 100644 --- a/examples/freebsd-jumpbox/outputs.tf +++ b/examples/freebsd-jumpbox/outputs.tf @@ -8,4 +8,4 @@ output "vm_fqdn" { output "ssh_command" { value = "ssh ${var.admin_username}@${azurerm_public_ip.pip.fqdn}" -} \ No newline at end of file +} diff --git a/examples/kubernetes-cluster/main.tf b/examples/kubernetes-cluster/main.tf index 898312caa5fbd..2566d1f3d5e3b 100644 --- a/examples/kubernetes-cluster/main.tf +++ b/examples/kubernetes-cluster/main.tf @@ -1,39 +1,39 @@ resource "azurerm_resource_group" "akc-rg" { - name = "${var.resource_group_name}" - location = "${var.resource_group_location}" + name = "${var.resource_group_name}" + location = "${var.resource_group_location}" } #an attempt to keep the aci container group name (and dns label) somewhat unique resource "random_integer" "random_int" { - min = 100 - max = 999 + min = 100 + max = 999 } resource "azurerm_kubernetes_cluster" "aks_container" { - name = "akc-${random_integer.random_int.result}" - location = "${var.resource_group_location}" - dns_prefix = "akc-${random_integer.random_int.result}" + name = "akc-${random_integer.random_int.result}" + location = "${var.resource_group_location}" + dns_prefix = "akc-${random_integer.random_int.result}" - resource_group_name = "${azurerm_resource_group.akc-rg.name}" - kubernetes_version = "1.8.7" + resource_group_name = "${azurerm_resource_group.akc-rg.name}" + kubernetes_version = "1.8.7" + linux_profile { + admin_username = "${var.linux_admin_username}" - linux_profile { - admin_username = "${var.linux_admin_username}" - ssh_key { - key_data = "${var.linux_admin_ssh_publickey}" - } + ssh_key { + key_data = "${var.linux_admin_ssh_publickey}" } + } - agent_pool_profile { - name = "agentpool" - count = "2" - vm_size = "Standard_DS2_v2" - os_type = "Linux" - } + agent_pool_profile { + name = "agentpool" + count = "2" + vm_size = "Standard_DS2_v2" + os_type = "Linux" + } - service_principal { - client_id = "${var.client_id}" - client_secret = "${var.client_secret}" - } -} \ No newline at end of file + service_principal { + client_id = "${var.client_id}" + client_secret = "${var.client_secret}" + } +} diff --git a/examples/kubernetes-cluster/variables.tf b/examples/kubernetes-cluster/variables.tf index eb2648c13c3c3..e51e90a3a44d6 100644 --- a/examples/kubernetes-cluster/variables.tf +++ b/examples/kubernetes-cluster/variables.tf @@ -34,4 +34,4 @@ variable "linux_admin_username" { variable "linux_admin_ssh_publickey" { type = "string" description = "Configure all the linux virtual machines in the cluster with the SSH RSA public key string. The key should include three parts, for example 'ssh-rsa AAAAB...snip...UcyupgH azureuser@linuxvm'" -} \ No newline at end of file +} diff --git a/examples/log-analytics-container-monitoring/main.tf b/examples/log-analytics-container-monitoring/main.tf index 52bb40b6f1e3f..32208c4709979 100644 --- a/examples/log-analytics-container-monitoring/main.tf +++ b/examples/log-analytics-container-monitoring/main.tf @@ -33,14 +33,14 @@ resource "azurerm_log_analytics_solution" "test" { } resource "azurerm_log_analytics_solution" "test2" { - solution_name = "Security" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}" - workspace_name = "${azurerm_log_analytics_workspace.test.name}" - - plan { - publisher = "Microsoft" - product = "OMSGallery/Security" - } + solution_name = "Security" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}" + workspace_name = "${azurerm_log_analytics_workspace.test.name}" + + plan { + publisher = "Microsoft" + product = "OMSGallery/Security" + } } diff --git a/examples/log-analytics-container-monitoring/outputs.tf b/examples/log-analytics-container-monitoring/outputs.tf index d6adecaf6ec4f..62d0010f8a129 100644 --- a/examples/log-analytics-container-monitoring/outputs.tf +++ b/examples/log-analytics-container-monitoring/outputs.tf @@ -1,10 +1,9 @@ - // These outputs can be used to deploy the monitoring Daemonset into your k8s cluster // https://docs.microsoft.com/en-us/azure/aks/tutorial-kubernetes-monitor output "workspace_id" { - value = "${azurerm_log_analytics_workspace.test.workspace_id}" + value = "${azurerm_log_analytics_workspace.test.workspace_id}" } output "workspace_key" { - value = "${azurerm_log_analytics_workspace.test.primary_shared_key}" + value = "${azurerm_log_analytics_workspace.test.primary_shared_key}" } diff --git a/examples/openshift-origin/main.tf b/examples/openshift-origin/main.tf index fad9b0a5e91ca..497d37897d35f 100644 --- a/examples/openshift-origin/main.tf +++ b/examples/openshift-origin/main.tf @@ -551,7 +551,7 @@ resource "azurerm_virtual_machine" "master" { "set -x", "chmod +x masterPrep.sh", "chmod +x deployOpenShift.sh", - "sudo bash masterPrep.sh \"${azurerm_storage_account.persistent_volume_storage_account.name}\" \"${var.resource_group_location}\" \"${var.admin_username}\" && sudo bash deployOpenShift.sh \"${var.admin_username}\" \"${var.openshift_password}\" \"${var.key_vault_secret}\" \"${var.openshift_cluster_prefix}-master\" \"${azurerm_public_ip.openshift_master_pip.fqdn}\" \"${azurerm_public_ip.openshift_master_pip.ip_address}\" \"${var.openshift_cluster_prefix}-infra\" \"${var.openshift_cluster_prefix}-node\" \"${var.node_instance_count}\" \"${var.infra_instance_count}\" \"${var.master_instance_count}\" \"${var.default_sub_domain_type}\" \"${azurerm_storage_account.registry_storage_account.name}\" \"${azurerm_storage_account.registry_storage_account.primary_access_key}\" \"${var.tenant_id}\" \"${var.subscription_id}\" \"${var.aad_client_id}\" \"${var.aad_client_secret}\" \"${azurerm_resource_group.rg.name}\" \"${azurerm_resource_group.rg.location}\" \"${var.key_vault_name}\"" + "sudo bash masterPrep.sh \"${azurerm_storage_account.persistent_volume_storage_account.name}\" \"${var.resource_group_location}\" \"${var.admin_username}\" && sudo bash deployOpenShift.sh \"${var.admin_username}\" \"${var.openshift_password}\" \"${var.key_vault_secret}\" \"${var.openshift_cluster_prefix}-master\" \"${azurerm_public_ip.openshift_master_pip.fqdn}\" \"${azurerm_public_ip.openshift_master_pip.ip_address}\" \"${var.openshift_cluster_prefix}-infra\" \"${var.openshift_cluster_prefix}-node\" \"${var.node_instance_count}\" \"${var.infra_instance_count}\" \"${var.master_instance_count}\" \"${var.default_sub_domain_type}\" \"${azurerm_storage_account.registry_storage_account.name}\" \"${azurerm_storage_account.registry_storage_account.primary_access_key}\" \"${var.tenant_id}\" \"${var.subscription_id}\" \"${var.aad_client_id}\" \"${var.aad_client_secret}\" \"${azurerm_resource_group.rg.name}\" \"${azurerm_resource_group.rg.location}\" \"${var.key_vault_name}\"", ] } diff --git a/examples/policy-definition/main.tf b/examples/policy-definition/main.tf index b3acea24f58d7..3cc6ffc64c29a 100644 --- a/examples/policy-definition/main.tf +++ b/examples/policy-definition/main.tf @@ -1,9 +1,10 @@ resource "azurerm_policy_definition" "policy" { - name = "${var.policy_definition_name}" - policy_type = "${var.policy_type}" - mode = "${var.mode}" - display_name = "${var.display_name}" - policy_rule =< func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "ListByDNSZone", err.Error()) + } + result.fn = client.listByDNSZoneNextResults req, err := client.ListByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) if err != nil { @@ -381,7 +414,7 @@ func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resour // ListByType lists the record sets of a specified type in a DNS zone. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // zoneName - the name of the DNS zone (without a terminating dot). // recordType - the type of record sets to enumerate. // top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. @@ -389,6 +422,14 @@ func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resour // enumerations. If this parameter is specified, Enumeration will return only records that end with // . func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "ListByType", err.Error()) + } + result.fn = client.listByTypeNextResults req, err := client.ListByTypePreparer(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) if err != nil { @@ -488,7 +529,7 @@ func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceG // Update updates a record set within a DNS zone. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // zoneName - the name of the DNS zone (without a terminating dot). // relativeRecordSetName - the name of the record set, relative to the name of the zone. // recordType - the type of DNS record in this record set. @@ -496,6 +537,14 @@ func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceG // ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify // the last-seen etag value to prevent accidentally overwritting concurrent changes. func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch) if err != nil { err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", nil, "Failure preparing request") diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns/zones.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns/zones.go index d085c1784a10c..5e17378320f6f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns/zones.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns/zones.go @@ -21,6 +21,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) @@ -41,7 +42,7 @@ func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClien // CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records within the zone. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // zoneName - the name of the DNS zone (without a terminating dot). // parameters - parameters supplied to the CreateOrUpdate operation. // ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the @@ -49,6 +50,14 @@ func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClien // ifNoneMatch - set to '*' to allow a new DNS zone to be created, but to prevent updating an existing zone. // Other values will be ignored. func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "CreateOrUpdate", err.Error()) + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch) if err != nil { err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request") @@ -124,11 +133,19 @@ func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Z // Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be // undone. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // zoneName - the name of the DNS zone (without a terminating dot). // ifMatch - the etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen // etag value to prevent accidentally deleting any concurrent changes. func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (result ZonesDeleteFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, ifMatch) if err != nil { err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request") @@ -172,15 +189,17 @@ func (client ZonesClient) DeletePreparer(ctx context.Context, resourceGroupName // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ZonesClient) DeleteSender(req *http.Request) (future ZonesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -199,9 +218,17 @@ func (client ZonesClient) DeleteResponder(resp *http.Response) (result ZoneDelet // Get gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // zoneName - the name of the DNS zone (without a terminating dot). func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string) (result Zone, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, zoneName) if err != nil { err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", nil, "Failure preparing request") @@ -361,9 +388,17 @@ func (client ZonesClient) ListComplete(ctx context.Context, top *int32) (result // ListByResourceGroup lists the DNS zones within a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/client.go new file mode 100644 index 0000000000000..a89f2dd318a12 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/client.go @@ -0,0 +1,51 @@ +// Package dns implements the Azure ARM Dns service API version 2017-10-01. +// +// The DNS Management Client. +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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 Dns + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Dns. +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. +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/dns/mgmt/2017-10-01/dns/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/models.go new file mode 100644 index 0000000000000..9d292001a329d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/models.go @@ -0,0 +1,752 @@ +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// RecordType enumerates the values for record type. +type RecordType string + +const ( + // A ... + A RecordType = "A" + // AAAA ... + AAAA RecordType = "AAAA" + // CAA ... + CAA RecordType = "CAA" + // CNAME ... + CNAME RecordType = "CNAME" + // MX ... + MX RecordType = "MX" + // NS ... + NS RecordType = "NS" + // PTR ... + PTR RecordType = "PTR" + // SOA ... + SOA RecordType = "SOA" + // SRV ... + SRV RecordType = "SRV" + // TXT ... + TXT RecordType = "TXT" +) + +// PossibleRecordTypeValues returns an array of possible values for the RecordType const type. +func PossibleRecordTypeValues() []RecordType { + return []RecordType{A, AAAA, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT} +} + +// AaaaRecord an AAAA record. +type AaaaRecord struct { + // Ipv6Address - The IPv6 address of this AAAA record. + Ipv6Address *string `json:"ipv6Address,omitempty"` +} + +// ARecord an A record. +type ARecord struct { + // Ipv4Address - The IPv4 address of this A record. + Ipv4Address *string `json:"ipv4Address,omitempty"` +} + +// CaaRecord a CAA record. +type CaaRecord struct { + // Flags - The flags for this CAA record as an integer between 0 and 255. + Flags *int32 `json:"flags,omitempty"` + // Tag - The tag for this CAA record. + Tag *string `json:"tag,omitempty"` + // Value - The value for this CAA record. + Value *string `json:"value,omitempty"` +} + +// CloudError an error message +type CloudError struct { + // Error - The error message body + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody the body of an error message +type CloudErrorBody struct { + // Code - The error code + Code *string `json:"code,omitempty"` + // Message - A description of what caused the error + Message *string `json:"message,omitempty"` + // Target - The target resource of the error message + Target *string `json:"target,omitempty"` + // Details - Extra error information + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CnameRecord a CNAME record. +type CnameRecord struct { + // Cname - The canonical name for this CNAME record. + Cname *string `json:"cname,omitempty"` +} + +// MxRecord an MX record. +type MxRecord struct { + // Preference - The preference value for this MX record. + Preference *int32 `json:"preference,omitempty"` + // Exchange - The domain name of the mail host for this MX record. + Exchange *string `json:"exchange,omitempty"` +} + +// NsRecord an NS record. +type NsRecord struct { + // Nsdname - The name server name for this NS record. + Nsdname *string `json:"nsdname,omitempty"` +} + +// PtrRecord a PTR record. +type PtrRecord struct { + // Ptrdname - The PTR target domain name for this PTR record. + Ptrdname *string `json:"ptrdname,omitempty"` +} + +// RecordSet describes a DNS record set (a collection of DNS records with the same name and type). +type RecordSet struct { + autorest.Response `json:"-"` + // ID - The ID of the record set. + ID *string `json:"id,omitempty"` + // Name - The name of the record set. + Name *string `json:"name,omitempty"` + // Type - The type of the record set. + Type *string `json:"type,omitempty"` + // Etag - The etag of the record set. + Etag *string `json:"etag,omitempty"` + // RecordSetProperties - The properties of the record set. + *RecordSetProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecordSet. +func (rs RecordSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.ID != nil { + objectMap["id"] = rs.ID + } + if rs.Name != nil { + objectMap["name"] = rs.Name + } + if rs.Type != nil { + objectMap["type"] = rs.Type + } + if rs.Etag != nil { + objectMap["etag"] = rs.Etag + } + if rs.RecordSetProperties != nil { + objectMap["properties"] = rs.RecordSetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RecordSet struct. +func (rs *RecordSet) UnmarshalJSON(body []byte) error { + 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 + } + rs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rs.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rs.Etag = &etag + } + case "properties": + if v != nil { + var recordSetProperties RecordSetProperties + err = json.Unmarshal(*v, &recordSetProperties) + if err != nil { + return err + } + rs.RecordSetProperties = &recordSetProperties + } + } + } + + return nil +} + +// RecordSetListResult the response to a record set List operation. +type RecordSetListResult struct { + autorest.Response `json:"-"` + // Value - Information about the record sets in the response. + Value *[]RecordSet `json:"value,omitempty"` + // NextLink - The continuation token for the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RecordSetListResultIterator provides access to a complete listing of RecordSet values. +type RecordSetListResultIterator struct { + i int + page RecordSetListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RecordSetListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RecordSetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RecordSetListResultIterator) Response() RecordSetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RecordSetListResultIterator) Value() RecordSet { + if !iter.page.NotDone() { + return RecordSet{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rslr RecordSetListResult) IsEmpty() bool { + return rslr.Value == nil || len(*rslr.Value) == 0 +} + +// recordSetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rslr RecordSetListResult) recordSetListResultPreparer() (*http.Request, error) { + if rslr.NextLink == nil || len(to.String(rslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rslr.NextLink))) +} + +// RecordSetListResultPage contains a page of RecordSet values. +type RecordSetListResultPage struct { + fn func(RecordSetListResult) (RecordSetListResult, error) + rslr RecordSetListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RecordSetListResultPage) Next() error { + next, err := page.fn(page.rslr) + if err != nil { + return err + } + page.rslr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RecordSetListResultPage) NotDone() bool { + return !page.rslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RecordSetListResultPage) Response() RecordSetListResult { + return page.rslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RecordSetListResultPage) Values() []RecordSet { + if page.rslr.IsEmpty() { + return nil + } + return *page.rslr.Value +} + +// RecordSetProperties represents the properties of the records in the record set. +type RecordSetProperties struct { + // Metadata - The metadata attached to the record set. + Metadata map[string]*string `json:"metadata"` + // TTL - The TTL (time-to-live) of the records in the record set. + TTL *int64 `json:"TTL,omitempty"` + // Fqdn - Fully qualified domain name of the record set. + Fqdn *string `json:"fqdn,omitempty"` + // ARecords - The list of A records in the record set. + ARecords *[]ARecord `json:"ARecords,omitempty"` + // AaaaRecords - The list of AAAA records in the record set. + AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"` + // MxRecords - The list of MX records in the record set. + MxRecords *[]MxRecord `json:"MXRecords,omitempty"` + // NsRecords - The list of NS records in the record set. + NsRecords *[]NsRecord `json:"NSRecords,omitempty"` + // PtrRecords - The list of PTR records in the record set. + PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"` + // SrvRecords - The list of SRV records in the record set. + SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"` + // TxtRecords - The list of TXT records in the record set. + TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"` + // CnameRecord - The CNAME record in the record set. + CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"` + // SoaRecord - The SOA record in the record set. + SoaRecord *SoaRecord `json:"SOARecord,omitempty"` + // CaaRecords - The list of CAA records in the record set. + CaaRecords *[]CaaRecord `json:"caaRecords,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecordSetProperties. +func (rsp RecordSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rsp.Metadata != nil { + objectMap["metadata"] = rsp.Metadata + } + if rsp.TTL != nil { + objectMap["TTL"] = rsp.TTL + } + if rsp.Fqdn != nil { + objectMap["fqdn"] = rsp.Fqdn + } + if rsp.ARecords != nil { + objectMap["ARecords"] = rsp.ARecords + } + if rsp.AaaaRecords != nil { + objectMap["AAAARecords"] = rsp.AaaaRecords + } + if rsp.MxRecords != nil { + objectMap["MXRecords"] = rsp.MxRecords + } + if rsp.NsRecords != nil { + objectMap["NSRecords"] = rsp.NsRecords + } + if rsp.PtrRecords != nil { + objectMap["PTRRecords"] = rsp.PtrRecords + } + if rsp.SrvRecords != nil { + objectMap["SRVRecords"] = rsp.SrvRecords + } + if rsp.TxtRecords != nil { + objectMap["TXTRecords"] = rsp.TxtRecords + } + if rsp.CnameRecord != nil { + objectMap["CNAMERecord"] = rsp.CnameRecord + } + if rsp.SoaRecord != nil { + objectMap["SOARecord"] = rsp.SoaRecord + } + if rsp.CaaRecords != nil { + objectMap["caaRecords"] = rsp.CaaRecords + } + return json.Marshal(objectMap) +} + +// RecordSetUpdateParameters parameters supplied to update a record set. +type RecordSetUpdateParameters struct { + // RecordSet - Specifies information about the record set being updated. + RecordSet *RecordSet `json:"RecordSet,omitempty"` +} + +// Resource common properties of an Azure Resource Manager resource +type Resource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - 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.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// SoaRecord an SOA record. +type SoaRecord struct { + // Host - The domain name of the authoritative name server for this SOA record. + Host *string `json:"host,omitempty"` + // Email - The email contact for this SOA record. + Email *string `json:"email,omitempty"` + // SerialNumber - The serial number for this SOA record. + SerialNumber *int64 `json:"serialNumber,omitempty"` + // RefreshTime - The refresh value for this SOA record. + RefreshTime *int64 `json:"refreshTime,omitempty"` + // RetryTime - The retry time for this SOA record. + RetryTime *int64 `json:"retryTime,omitempty"` + // ExpireTime - The expire time for this SOA record. + ExpireTime *int64 `json:"expireTime,omitempty"` + // MinimumTTL - The minimum value for this SOA record. By convention this is used to determine the negative caching duration. + MinimumTTL *int64 `json:"minimumTTL,omitempty"` +} + +// SrvRecord an SRV record. +type SrvRecord struct { + // Priority - The priority value for this SRV record. + Priority *int32 `json:"priority,omitempty"` + // Weight - The weight value for this SRV record. + Weight *int32 `json:"weight,omitempty"` + // Port - The port value for this SRV record. + Port *int32 `json:"port,omitempty"` + // Target - The target domain name for this SRV record. + Target *string `json:"target,omitempty"` +} + +// SubResource a reference to a another resource +type SubResource struct { + // ID - Resource Id. + ID *string `json:"id,omitempty"` +} + +// TxtRecord a TXT record. +type TxtRecord struct { + // Value - The text value of this TXT record. + Value *[]string `json:"value,omitempty"` +} + +// Zone describes a DNS zone. +type Zone struct { + autorest.Response `json:"-"` + // Etag - The etag of the zone. + Etag *string `json:"etag,omitempty"` + // ZoneProperties - The properties of the zone. + *ZoneProperties `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - 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 Zone. +func (z Zone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if z.Etag != nil { + objectMap["etag"] = z.Etag + } + if z.ZoneProperties != nil { + objectMap["properties"] = z.ZoneProperties + } + if z.ID != nil { + objectMap["id"] = z.ID + } + if z.Name != nil { + objectMap["name"] = z.Name + } + if z.Type != nil { + objectMap["type"] = z.Type + } + if z.Location != nil { + objectMap["location"] = z.Location + } + if z.Tags != nil { + objectMap["tags"] = z.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Zone struct. +func (z *Zone) UnmarshalJSON(body []byte) error { + 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 + } + z.Etag = &etag + } + case "properties": + if v != nil { + var zoneProperties ZoneProperties + err = json.Unmarshal(*v, &zoneProperties) + if err != nil { + return err + } + z.ZoneProperties = &zoneProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + z.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + z.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + z.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + z.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + z.Tags = tags + } + } + } + + return nil +} + +// ZoneListResult the response to a Zone List or ListAll operation. +type ZoneListResult struct { + autorest.Response `json:"-"` + // Value - Information about the DNS zones. + Value *[]Zone `json:"value,omitempty"` + // NextLink - The continuation token for the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ZoneListResultIterator provides access to a complete listing of Zone values. +type ZoneListResultIterator struct { + i int + page ZoneListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ZoneListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ZoneListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ZoneListResultIterator) Response() ZoneListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ZoneListResultIterator) Value() Zone { + if !iter.page.NotDone() { + return Zone{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (zlr ZoneListResult) IsEmpty() bool { + return zlr.Value == nil || len(*zlr.Value) == 0 +} + +// zoneListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (zlr ZoneListResult) zoneListResultPreparer() (*http.Request, error) { + if zlr.NextLink == nil || len(to.String(zlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(zlr.NextLink))) +} + +// ZoneListResultPage contains a page of Zone values. +type ZoneListResultPage struct { + fn func(ZoneListResult) (ZoneListResult, error) + zlr ZoneListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ZoneListResultPage) Next() error { + next, err := page.fn(page.zlr) + if err != nil { + return err + } + page.zlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ZoneListResultPage) NotDone() bool { + return !page.zlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ZoneListResultPage) Response() ZoneListResult { + return page.zlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ZoneListResultPage) Values() []Zone { + if page.zlr.IsEmpty() { + return nil + } + return *page.zlr.Value +} + +// ZoneProperties represents the properties of the zone. +type ZoneProperties struct { + // MaxNumberOfRecordSets - The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` + // NumberOfRecordSets - The current number of record sets in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` + // NameServers - The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + NameServers *[]string `json:"nameServers,omitempty"` +} + +// ZonesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ZonesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ZonesDeleteFuture) Result(client ZonesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dns.ZonesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ZoneUpdate describes a request to update a DNS zone. +type ZoneUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ZoneUpdate. +func (zu ZoneUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if zu.Tags != nil { + objectMap["tags"] = zu.Tags + } + return json.Marshal(objectMap) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/recordsets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/recordsets.go new file mode 100644 index 0000000000000..1210b701d3595 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/recordsets.go @@ -0,0 +1,729 @@ +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// RecordSetsClient is the the DNS Management Client. +type RecordSetsClient struct { + BaseClient +} + +// NewRecordSetsClient creates an instance of the RecordSetsClient client. +func NewRecordSetsClient(subscriptionID string) RecordSetsClient { + return NewRecordSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecordSetsClientWithBaseURI creates an instance of the RecordSetsClient client. +func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) RecordSetsClient { + return RecordSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a record set within a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. Record sets of type SOA can be updated but not +// created (they are created when the DNS zone is created). +// parameters - parameters supplied to the CreateOrUpdate operation. +// ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify +// the last-seen etag value to prevent accidentally overwritting any concurrent changes. +// ifNoneMatch - set to '*' to allow a new record set to be created, but to prevent updating an existing record +// set. Other values will be ignored. +func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RecordSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", 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)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a record set from a DNS zone. This operation cannot be undone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are +// deleted when the DNS zone is deleted). +// ifMatch - the etag of the record set. Omit this value to always delete the current record set. Specify the +// last-seen etag value to prevent accidentally deleting any concurrent changes. +func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RecordSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-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/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), + 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)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a record set. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. +func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecordSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-01" + 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/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", 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 RecordSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllByDNSZone lists all record sets in a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +// recordSetNameSuffix - the suffix label of the record set name that has to be used to filter the record set +// enumerations. If this parameter is specified, Enumeration will return only records that end with +// . +func (client RecordSetsClient) ListAllByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (result RecordSetListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "ListAllByDNSZone", err.Error()) + } + + result.fn = client.listAllByDNSZoneNextResults + req, err := client.ListAllByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordSetNameSuffix) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllByDNSZoneSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListAllByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", resp, "Failure responding to request") + } + + return +} + +// ListAllByDNSZonePreparer prepares the ListAllByDNSZone request. +func (client RecordSetsClient) ListAllByDNSZonePreparer(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(recordSetNameSuffix) > 0 { + queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordSetNameSuffix) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/all", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllByDNSZoneSender sends the ListAllByDNSZone request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListAllByDNSZoneSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllByDNSZoneResponder handles the response to the ListAllByDNSZone request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListAllByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllByDNSZoneNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) listAllByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllByDNSZoneSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecordSetsClient) ListAllByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (result RecordSetListResultIterator, err error) { + result.page, err = client.ListAllByDNSZone(ctx, resourceGroupName, zoneName, top, recordSetNameSuffix) + return +} + +// ListByDNSZone lists all record sets in a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +// recordsetnamesuffix - the suffix label of the record set name that has to be used to filter the record set +// enumerations. If this parameter is specified, Enumeration will return only records that end with +// . +func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "ListByDNSZone", err.Error()) + } + + result.fn = client.listByDNSZoneNextResults + req, err := client.ListByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDNSZoneSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to request") + } + + return +} + +// ListByDNSZonePreparer prepares the ListByDNSZone request. +func (client RecordSetsClient) ListByDNSZonePreparer(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(recordsetnamesuffix) > 0 { + queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordsetnamesuffix) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDNSZoneSender sends the ListByDNSZone request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListByDNSZoneSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDNSZoneResponder handles the response to the ListByDNSZone request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDNSZoneNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) listByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDNSZoneSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { + result.page, err = client.ListByDNSZone(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) + return +} + +// ListByType lists the record sets of a specified type in a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// recordType - the type of record sets to enumerate. +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +// recordsetnamesuffix - the suffix label of the record set name that has to be used to filter the record set +// enumerations. If this parameter is specified, Enumeration will return only records that end with +// . +func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "ListByType", err.Error()) + } + + result.fn = client.listByTypeNextResults + req, err := client.ListByTypePreparer(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing request") + return + } + + resp, err := client.ListByTypeSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to request") + } + + return +} + +// ListByTypePreparer prepares the ListByType request. +func (client RecordSetsClient) ListByTypePreparer(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(recordsetnamesuffix) > 0 { + queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordsetnamesuffix) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByTypeSender sends the ListByType request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByTypeResponder handles the response to the ListByType request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListByTypeResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByTypeNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) listByTypeNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByTypeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { + result.page, err = client.ListByType(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) + return +} + +// Update updates a record set within a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. +// parameters - parameters supplied to the Update operation. +// ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify +// the last-seen etag value to prevent accidentally overwritting concurrent changes. +func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.RecordSetsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RecordSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-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/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", 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 RecordSetsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) UpdateResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/dns/mgmt/2017-10-01/dns/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/version.go new file mode 100644 index 0000000000000..34ac2e2261ec6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/version.go @@ -0,0 +1,30 @@ +package dns + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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.Number + " dns/2017-10-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/dns/mgmt/2017-10-01/dns/zones.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/zones.go new file mode 100644 index 0000000000000..45ff5fc8078fa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns/zones.go @@ -0,0 +1,575 @@ +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ZonesClient is the the DNS Management Client. +type ZonesClient struct { + BaseClient +} + +// NewZonesClient creates an instance of the ZonesClient client. +func NewZonesClient(subscriptionID string) ZonesClient { + return NewZonesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewZonesClientWithBaseURI creates an instance of the ZonesClient client. +func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClient { + return ZonesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records within the zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// parameters - parameters supplied to the CreateOrUpdate operation. +// ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the +// last-seen etag value to prevent accidentally overwritting any concurrent changes. +// ifNoneMatch - set to '*' to allow a new DNS zone to be created, but to prevent updating an existing zone. +// Other values will be ignored. +func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ZonesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-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.Network/dnsZones/{zoneName}", 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)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be +// undone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// ifMatch - the etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen +// etag value to prevent accidentally deleting any concurrent changes. +func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (result ZonesDeleteFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ZonesClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-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/dnsZones/{zoneName}", pathParameters), + 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)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) DeleteSender(req *http.Request) (future ZonesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ZonesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string) (result Zone, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, zoneName) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ZonesClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-01" + 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/dnsZones/{zoneName}", 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 ZonesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ZonesClient) GetResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the DNS zones in all resource groups in a subscription. +// Parameters: +// top - the maximum number of DNS zones to return. If not specified, returns up to 100 zones. +func (client ZonesClient) List(ctx context.Context, top *int32) (result ZoneListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.zlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending request") + return + } + + result.zlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ZonesClient) ListPreparer(ctx context.Context, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-10-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.Network/dnszones", 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 ZonesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ZonesClient) ListResponder(resp *http.Response) (result ZoneListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ZonesClient) listNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.zoneListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "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, "dns.ZonesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ZonesClient) ListComplete(ctx context.Context, top *int32) (result ZoneListResultIterator, err error) { + result.page, err = client.List(ctx, top) + return +} + +// ListByResourceGroup lists the DNS zones within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.zlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.zlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ZonesClient) 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 = "2017-10-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.Network/dnsZones", 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 ZonesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ZonesClient) ListByResourceGroupResponder(resp *http.Response) (result ZoneListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ZonesClient) listByResourceGroupNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.zoneListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "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, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ZonesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) + return +} + +// Update updates a DNS zone. Does not modify DNS records within the zone. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// zoneName - the name of the DNS zone (without a terminating dot). +// parameters - parameters supplied to the Update operation. +// ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the +// last-seen etag value to prevent accidentally overwritting any concurrent changes. +func (client ZonesClient) Update(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, ifMatch string) (result Zone, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ZonesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2017-10-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/dnsZones/{zoneName}", 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 ZonesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ZonesClient) UpdateResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/eventgrid/mgmt/2017-09-15-preview/eventgrid/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/version.go deleted file mode 100644 index 62d31fdb78765..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/version.go +++ /dev/null @@ -1,31 +0,0 @@ -package eventgrid - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " eventgrid/2017-09-15-preview" -} - -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// 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/eventgrid/mgmt/2017-09-15-preview/eventgrid/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/client.go similarity index 78% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/client.go index 7151f5f4a2bae..677813b81fbaf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/client.go @@ -1,4 +1,4 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2017-09-15-preview. +// Package eventgrid implements the Azure ARM Eventgrid service API version 2018-01-01. // // Azure EventGrid Management Client package eventgrid @@ -29,7 +29,6 @@ const ( DefaultBaseURI = "https://management.azure.com" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // BaseClient is the base client for Eventgrid. type BaseClient struct { autorest.Client @@ -37,13 +36,11 @@ type BaseClient struct { SubscriptionID string } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // New creates an instance of the BaseClient client. func New(subscriptionID string) BaseClient { return NewWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewWithBaseURI creates an instance of the BaseClient client. func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventsubscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/eventsubscriptions.go similarity index 75% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventsubscriptions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/eventsubscriptions.go index 51ea2ae7ec672..1f77e05d38d63 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventsubscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/eventsubscriptions.go @@ -24,63 +24,59 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionsClient is the azure EventGrid Management Client type EventSubscriptionsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient client. func NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// Create asynchronously creates a new event subscription to the specified scope. Existing event subscriptions cannot -// be updated with this API and should instead use the Update event subscription API. -// -// scope is the scope of the resource to which the event subscription needs to be created. The scope can be a -// subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an -// EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, +// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on +// the specified scope. +// Parameters: +// scope - the identifier of the resource to which the event subscription needs to be created or updated. The +// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider +// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' // for a resource, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. eventSubscriptionName is name of the event subscription to be created. Event -// subscription names must be between 3 and 64 characters in length and use alphanumeric letters only. -// eventSubscriptionInfo is event subscription properties containing the destination and filter information -func (client EventSubscriptionsClient) Create(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateFuture, err error) { - req, err := client.CreatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 +// characters in length and should use alphanumeric letters only. +// eventSubscriptionInfo - event subscription properties containing the destination and filter information +func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Create", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") return } - result, err = client.CreateSender(req) + result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Create", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// CreatePreparer prepares the Create request. -func (client EventSubscriptionsClient) CreatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { pathParameters := map[string]interface{}{ "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), "scope": scope, } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -95,26 +91,26 @@ func (client EventSubscriptionsClient) CreatePreparer(ctx context.Context, scope return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// CreateSender sends the Create request. The method will close the +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client EventSubscriptionsClient) CreateSender(req *http.Request) (future EventSubscriptionsCreateFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) +func (client EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// CreateResponder handles the response to the Create request. The method always +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client EventSubscriptionsClient) CreateResponder(resp *http.Response) (result EventSubscription, err error) { +func (client EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -125,17 +121,17 @@ func (client EventSubscriptionsClient) CreateResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Delete delete an existing event subscription -// -// scope is the scope of the event subscription. The scope can be a subscription, or a resource group, or a top +// Parameters: +// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top // level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' // for a resource, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. eventSubscriptionName is name of the event subscription +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) if err != nil { @@ -152,7 +148,6 @@ func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // DeletePreparer prepares the Delete request. func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -160,7 +155,7 @@ func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope "scope": scope, } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -173,23 +168,23 @@ func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -202,17 +197,17 @@ func (client EventSubscriptionsClient) DeleteResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Get get properties of an event subscription -// -// scope is the scope of the event subscription. The scope can be a subscription, or a resource group, or a top +// Parameters: +// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top // level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' // for a resource, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. eventSubscriptionName is name of the event subscription +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { req, err := client.GetPreparer(ctx, scope, eventSubscriptionName) if err != nil { @@ -235,7 +230,6 @@ func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, ev return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetPreparer prepares the Get request. func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -243,7 +237,7 @@ func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope st "scope": scope, } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -256,7 +250,6 @@ func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope st return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -264,7 +257,6 @@ func (client EventSubscriptionsClient) GetSender(req *http.Request) (*http.Respo autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { @@ -278,17 +270,17 @@ func (client EventSubscriptionsClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetFullURL get the full endpoint URL for an event subscription -// -// scope is the scope of the event subscription. The scope can be a subscription, or a resource group, or a top +// Parameters: +// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top // level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' // for a resource, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. eventSubscriptionName is name of the event subscription +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) if err != nil { @@ -311,7 +303,6 @@ func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetFullURLPreparer prepares the GetFullURL request. func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -319,7 +310,7 @@ func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, s "scope": scope, } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -332,7 +323,6 @@ func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, s return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetFullURLSender sends the GetFullURL request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { @@ -340,7 +330,6 @@ func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*htt autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetFullURLResponder handles the response to the GetFullURL request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { @@ -354,12 +343,12 @@ func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResource list all event subscriptions that have been created for a specific topic -// -// resourceGroupName is the name of the resource group within the user's subscription. providerNamespace is -// namespace of the provider of the topic resourceTypeName is name of the resource type resourceName is name of the -// resource +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// providerNamespace - namespace of the provider of the topic +// resourceTypeName - name of the resource type +// resourceName - name of the resource func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventSubscriptionsListResult, err error) { req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) if err != nil { @@ -382,7 +371,6 @@ func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResourcePreparer prepares the ListByResource request. func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -393,7 +381,7 @@ func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -406,7 +394,6 @@ func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResourceSender sends the ListByResource request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { @@ -414,7 +401,6 @@ func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) ( azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResourceResponder handles the response to the ListByResource request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -428,10 +414,9 @@ func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Respon return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource group -// -// resourceGroupName is the name of the resource group within the user's subscription. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result EventSubscriptionsListResult, err error) { req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -454,7 +439,6 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Con return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -462,7 +446,7 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -475,7 +459,6 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx con return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -483,7 +466,6 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -497,12 +479,11 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp * return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific // topic type. -// -// resourceGroupName is the name of the resource group within the user's subscription. topicTypeName is name of the -// topic type +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicTypeName - name of the topic type func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result EventSubscriptionsListResult, err error) { req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName) if err != nil { @@ -525,7 +506,6 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -534,7 +514,7 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePrep "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +527,6 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePrep return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { @@ -555,7 +534,6 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSend azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -569,7 +547,6 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context) (result EventSubscriptionsListResult, err error) { req, err := client.ListGlobalBySubscriptionPreparer(ctx) @@ -593,14 +570,13 @@ func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Cont return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -613,7 +589,6 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx cont return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { @@ -621,7 +596,6 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -635,11 +609,10 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *h return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic // type. -// -// topicTypeName is name of the topic type +// Parameters: +// topicTypeName - name of the topic type func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result EventSubscriptionsListResult, err error) { req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName) if err != nil { @@ -662,7 +635,6 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -670,7 +642,7 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePrepa "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -683,7 +655,6 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePrepa return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { @@ -691,7 +662,6 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSende azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -705,12 +675,11 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeRespo return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription // and resource group -// -// resourceGroupName is the name of the resource group within the user's subscription. location is name of the -// location +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// location - name of the location func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result EventSubscriptionsListResult, err error) { req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location) if err != nil { @@ -733,7 +702,6 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.C return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -742,7 +710,7 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -755,7 +723,6 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx c return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -763,7 +730,6 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -777,12 +743,12 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure // subscription and resource group and topic type -// -// resourceGroupName is the name of the resource group within the user's subscription. location is name of the -// location topicTypeName is name of the topic type +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// location - name of the location +// topicTypeName - name of the topic type func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName) if err != nil { @@ -805,7 +771,6 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(c return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -815,7 +780,7 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePr "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -828,7 +793,6 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePr return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { @@ -836,7 +800,6 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSe azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -850,10 +813,9 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeRe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription -// -// location is name of the location +// Parameters: +// location - name of the location func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string) (result EventSubscriptionsListResult, err error) { req, err := client.ListRegionalBySubscriptionPreparer(ctx, location) if err != nil { @@ -876,7 +838,6 @@ func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Co return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx context.Context, location string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -884,7 +845,7 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -897,7 +858,6 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx co return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { @@ -905,7 +865,6 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *htt azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -919,11 +878,11 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure // subscription and topic type. -// -// location is name of the location topicTypeName is name of the topic type +// Parameters: +// location - name of the location +// topicTypeName - name of the topic type func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName) if err != nil { @@ -946,7 +905,6 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ct return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -955,7 +913,7 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePre "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -968,7 +926,6 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePre return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { @@ -976,7 +933,6 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSen azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { @@ -990,18 +946,18 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeRes return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Update asynchronously updates an existing event subscription. -// -// scope is the scope of existing event subscription. The scope can be a subscription, or a resource group, or a +// Parameters: +// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a // top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' // for a resource, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. eventSubscriptionName is name of the event subscription to be created -// eventSubscriptionUpdateParameters is updated event subscription information +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription to be created +// eventSubscriptionUpdateParameters - updated event subscription information func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) if err != nil { @@ -1018,7 +974,6 @@ func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UpdatePreparer prepares the Update request. func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -1026,7 +981,7 @@ func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope "scope": scope, } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1041,23 +996,23 @@ func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/models.go similarity index 66% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/models.go index aeec2b1758aa9..4d4e60b85c0c2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/models.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EndpointType enumerates the values for endpoint type. type EndpointType string @@ -37,13 +36,11 @@ const ( EndpointTypeWebHook EndpointType = "WebHook" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. func PossibleEndpointTypeValues() []EndpointType { return []EndpointType{EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeWebHook} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. type EventSubscriptionProvisioningState string @@ -62,32 +59,11 @@ const ( Updating EventSubscriptionProvisioningState = "Updating" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { return []EventSubscriptionProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // System ... - System OperationOrigin = "System" - // User ... - User OperationOrigin = "User" - // UserAndSystem ... - UserAndSystem OperationOrigin = "UserAndSystem" -) - -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{System, User, UserAndSystem} -} - -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ResourceRegionType enumerates the values for resource region type. type ResourceRegionType string @@ -98,13 +74,11 @@ const ( RegionalResource ResourceRegionType = "RegionalResource" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. func PossibleResourceRegionTypeValues() []ResourceRegionType { return []ResourceRegionType{GlobalResource, RegionalResource} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicProvisioningState enumerates the values for topic provisioning state. type TopicProvisioningState string @@ -123,13 +97,11 @@ const ( TopicProvisioningStateUpdating TopicProvisioningState = "Updating" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. func PossibleTopicProvisioningStateValues() []TopicProvisioningState { return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicTypeProvisioningState enumerates the values for topic type provisioning state. type TopicTypeProvisioningState string @@ -148,13 +120,11 @@ const ( TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventHubEventSubscriptionDestination information about the event hub destination for an event subscription type EventHubEventSubscriptionDestination struct { // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination @@ -163,7 +133,6 @@ type EventHubEventSubscriptionDestination struct { EndpointType EndpointType `json:"endpointType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { ehesd.EndpointType = EndpointTypeEventHub @@ -177,31 +146,26 @@ func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { return &ehesd, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { return &ehesd, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. func (ehesd *EventHubEventSubscriptionDestination) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -235,14 +199,12 @@ func (ehesd *EventHubEventSubscriptionDestination) UnmarshalJSON(body []byte) er return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. type EventHubEventSubscriptionDestinationProperties struct { // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. ResourceID *string `json:"resourceId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscription event Subscription type EventSubscription struct { autorest.Response `json:"-"` @@ -256,7 +218,6 @@ type EventSubscription struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for EventSubscription. func (es EventSubscription) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -275,7 +236,6 @@ func (es EventSubscription) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for EventSubscription struct. func (es *EventSubscription) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -327,7 +287,6 @@ func (es *EventSubscription) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // BasicEventSubscriptionDestination information about the destination for an event subscription type BasicEventSubscriptionDestination interface { AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) @@ -335,7 +294,6 @@ type BasicEventSubscriptionDestination interface { AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionDestination information about the destination for an event subscription type EventSubscriptionDestination struct { // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub' @@ -383,7 +341,6 @@ func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventS return esdArray, nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for EventSubscriptionDestination. func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { esd.EndpointType = EndpointTypeEventSubscriptionDestination @@ -394,31 +351,26 @@ func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { return &esd, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { return &esd, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionFilter filter for the Event Subscription type EventSubscriptionFilter struct { // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. @@ -436,7 +388,6 @@ type EventSubscriptionFilter struct { IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionFullURL full endpoint url of an event subscription type EventSubscriptionFullURL struct { autorest.Response `json:"-"` @@ -444,7 +395,6 @@ type EventSubscriptionFullURL struct { EndpointURL *string `json:"endpointUrl,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionProperties properties of the Event Subscription type EventSubscriptionProperties struct { // Topic - Name of the topic of the event subscription. @@ -459,7 +409,6 @@ type EventSubscriptionProperties struct { Labels *[]string `json:"labels,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. func (esp *EventSubscriptionProperties) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -519,69 +468,44 @@ func (esp *EventSubscriptionProperties) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. -// EventSubscriptionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type EventSubscriptionsCreateFuture struct { +// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EventSubscriptionsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future EventSubscriptionsCreateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { +func (future *EventSubscriptionsCreateOrUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - return es, azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - es, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.CreateOrUpdateResponder(es.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", resp, "Failure sending request") - return - } - es, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type EventSubscriptionsDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future EventSubscriptionsDeleteFuture) Result(client EventSubscriptionsClient) (ar autorest.Response, err error) { +func (future *EventSubscriptionsDeleteFuture) Result(client EventSubscriptionsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -589,39 +513,13 @@ func (future EventSubscriptionsDeleteFuture) Result(client EventSubscriptionsCli return } if !done { - return ar, azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionsListResult result of the List EventSubscriptions operation type EventSubscriptionsListResult struct { autorest.Response `json:"-"` @@ -629,18 +527,15 @@ type EventSubscriptionsListResult struct { Value *[]EventSubscription `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type EventSubscriptionsUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future EventSubscriptionsUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { +func (future *EventSubscriptionsUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -648,39 +543,19 @@ func (future EventSubscriptionsUpdateFuture) Result(client EventSubscriptionsCli return } if !done { - return es, azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - es, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.UpdateResponder(es.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", resp, "Failure sending request") - return - } - es, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventSubscriptionUpdateParameters properties of the Event Subscription update type EventSubscriptionUpdateParameters struct { // Destination - Information about the destination where events have to be delivered for the event subscription. @@ -691,7 +566,6 @@ type EventSubscriptionUpdateParameters struct { Labels *[]string `json:"labels,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. func (esup *EventSubscriptionUpdateParameters) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -733,7 +607,6 @@ func (esup *EventSubscriptionUpdateParameters) UnmarshalJSON(body []byte) error return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventType event Type for a subject under a topic type EventType struct { // EventTypeProperties - Properties of the event type. @@ -746,7 +619,6 @@ type EventType struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for EventType. func (et EventType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -765,7 +637,6 @@ func (et EventType) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for EventType struct. func (et *EventType) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -817,7 +688,6 @@ func (et *EventType) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventTypeProperties properties of the event type type EventTypeProperties struct { // DisplayName - Display name of the event type. @@ -828,7 +698,6 @@ type EventTypeProperties struct { SchemaURL *string `json:"schemaUrl,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // EventTypesListResult result of the List Event Types operation type EventTypesListResult struct { autorest.Response `json:"-"` @@ -836,20 +705,18 @@ type EventTypesListResult struct { Value *[]EventType `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Operation represents an operation returned by the GetOperations request type Operation struct { // Name - Name of the operation Name *string `json:"name,omitempty"` // Display - Display name of the operation Display *OperationInfo `json:"display,omitempty"` - // Origin - Origin of the operation. Possible values include: 'User', 'System', 'UserAndSystem' - Origin OperationOrigin `json:"origin,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` // Properties - Properties of the operation Properties interface{} `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // OperationInfo information about an operation type OperationInfo struct { // Provider - Name of the provider @@ -862,7 +729,6 @@ type OperationInfo struct { Description *string `json:"description,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // OperationsListResult result of the List Operations operation type OperationsListResult struct { autorest.Response `json:"-"` @@ -870,7 +736,6 @@ type OperationsListResult struct { Value *[]Operation `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Resource definition of a Resource type Resource struct { // ID - Fully qualified identifier of the resource @@ -881,7 +746,6 @@ type Resource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Topic eventGrid Topic type Topic struct { autorest.Response `json:"-"` @@ -899,7 +763,6 @@ type Topic struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for Topic. func (t Topic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -924,7 +787,6 @@ func (t Topic) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for Topic struct. func (t *Topic) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -994,7 +856,6 @@ func (t *Topic) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicProperties properties of the Topic type TopicProperties struct { // ProvisioningState - Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' @@ -1003,24 +864,20 @@ type TopicProperties struct { Endpoint *string `json:"endpoint,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicRegenerateKeyRequest topic regenerate share access key key request type TopicRegenerateKeyRequest struct { // KeyName - Key name to regenerate key1 or key2 KeyName *string `json:"keyName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type TopicsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future TopicsCreateOrUpdateFuture) Result(client TopicsClient) (t Topic, err error) { +func (future *TopicsCreateOrUpdateFuture) Result(client TopicsClient) (t Topic, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1028,49 +885,27 @@ func (future TopicsCreateOrUpdateFuture) Result(client TopicsClient) (t Topic, e return } if !done { - return t, azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - t, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.CreateOrUpdateResponder(t.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - t, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type TopicsDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future TopicsDeleteFuture) Result(client TopicsClient) (ar autorest.Response, err error) { +func (future *TopicsDeleteFuture) Result(client TopicsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1078,39 +913,13 @@ func (future TopicsDeleteFuture) Result(client TopicsClient) (ar autorest.Respon return } if !done { - return ar, azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicSharedAccessKeys shared access keys of the Topic type TopicSharedAccessKeys struct { autorest.Response `json:"-"` @@ -1120,7 +929,6 @@ type TopicSharedAccessKeys struct { Key2 *string `json:"key2,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicsListResult result of the List Topics operation type TopicsListResult struct { autorest.Response `json:"-"` @@ -1128,17 +936,14 @@ type TopicsListResult struct { Value *[]Topic `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type TopicsUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future TopicsUpdateFuture) Result(client TopicsClient) (t Topic, err error) { +func (future *TopicsUpdateFuture) Result(client TopicsClient) (t Topic, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1146,39 +951,19 @@ func (future TopicsUpdateFuture) Result(client TopicsClient) (t Topic, err error return } if !done { - return t, azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - t, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.UpdateResponder(t.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", resp, "Failure sending request") - return - } - t, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicTypeInfo properties of a topic type info. type TopicTypeInfo struct { autorest.Response `json:"-"` @@ -1192,7 +977,6 @@ type TopicTypeInfo struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for TopicTypeInfo. func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1211,7 +995,6 @@ func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. func (tti *TopicTypeInfo) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1263,7 +1046,6 @@ func (tti *TopicTypeInfo) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicTypeProperties properties of a topic type. type TopicTypeProperties struct { // Provider - Namespace of the provider of the topic type. @@ -1280,7 +1062,6 @@ type TopicTypeProperties struct { SupportedLocations *[]string `json:"supportedLocations,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicTypesListResult result of the List Topic Types operation type TopicTypesListResult struct { autorest.Response `json:"-"` @@ -1288,14 +1069,12 @@ type TopicTypesListResult struct { Value *[]TopicTypeInfo `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicUpdateParameters properties of the Topic update type TopicUpdateParameters struct { // Tags - Tags of the resource Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for TopicUpdateParameters. func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1305,7 +1084,6 @@ func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TrackedResource definition of a Tracked Resource type TrackedResource struct { // Location - Location of the resource @@ -1320,7 +1098,6 @@ type TrackedResource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for TrackedResource. func (tr TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1342,7 +1119,6 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // WebHookEventSubscriptionDestination information about the webhook destination for an event subscription type WebHookEventSubscriptionDestination struct { // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination @@ -1351,7 +1127,6 @@ type WebHookEventSubscriptionDestination struct { EndpointType EndpointType `json:"endpointType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { whesd.EndpointType = EndpointTypeWebHook @@ -1365,31 +1140,26 @@ func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { return &whesd, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { return &whesd, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. func (whesd *WebHookEventSubscriptionDestination) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1423,9 +1193,8 @@ func (whesd *WebHookEventSubscriptionDestination) UnmarshalJSON(body []byte) err return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for an event -// subscription +// subscription. type WebHookEventSubscriptionDestinationProperties struct { // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. EndpointURL *string `json:"endpointUrl,omitempty"` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/operations.go similarity index 78% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/operations.go index 14ae5d15eb90f..0be33e3d5588f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/operations.go @@ -24,25 +24,21 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // OperationsClient is the azure EventGrid Management Client type OperationsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewOperationsClient creates an instance of the OperationsClient client. func NewOperationsClient(subscriptionID string) OperationsClient { return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // List list the available operations supported by the Microsoft.EventGrid resource provider func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { req, err := client.ListPreparer(ctx) @@ -66,10 +62,9 @@ func (client OperationsClient) List(ctx context.Context) (result OperationsListR return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -82,7 +77,6 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // 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) { @@ -90,7 +84,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/topics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topics.go similarity index 75% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/topics.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topics.go index a954373b12598..676b4730c8976 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/topics.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topics.go @@ -25,29 +25,26 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicsClient is the azure EventGrid Management Client type TopicsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewTopicsClient creates an instance of the TopicsClient client. func NewTopicsClient(subscriptionID string) TopicsClient { return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewTopicsClientWithBaseURI creates an instance of the TopicsClient client. func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// -// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the -// topic topicInfo is topic information +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic +// topicInfo - topic information func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) if err != nil { @@ -64,7 +61,6 @@ func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -73,7 +69,7 @@ func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceG "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,23 +84,23 @@ func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, err error) { @@ -118,11 +114,10 @@ func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Delete delete existing topic -// -// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the -// topic +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) if err != nil { @@ -139,7 +134,6 @@ func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // DeletePreparer prepares the Delete request. func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -148,7 +142,7 @@ func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -161,23 +155,23 @@ func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client TopicsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -190,11 +184,10 @@ func (client TopicsClient) DeleteResponder(resp *http.Response) (result autorest return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Get get properties of a topic -// -// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the -// topic +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, topicName) if err != nil { @@ -217,7 +210,6 @@ func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, to return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetPreparer prepares the Get request. func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -226,7 +218,7 @@ func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName st "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,7 +231,6 @@ func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName st return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -247,7 +238,6 @@ func (client TopicsClient) GetSender(req *http.Request) (*http.Response, error) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { @@ -261,10 +251,9 @@ func (client TopicsClient) GetResponder(resp *http.Response) (result Topic, err return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResourceGroup list all the topics under a resource group -// -// resourceGroupName is the name of the resource group within the user's subscription. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result TopicsListResult, err error) { req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -287,7 +276,6 @@ func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGrou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -295,7 +283,7 @@ func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -308,7 +296,6 @@ func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -316,7 +303,6 @@ func (client TopicsClient) ListByResourceGroupSender(req *http.Request) (*http.R azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, err error) { @@ -330,7 +316,6 @@ func (client TopicsClient) ListByResourceGroupResponder(resp *http.Response) (re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListBySubscription list all the topics under an Azure subscription func (client TopicsClient) ListBySubscription(ctx context.Context) (result TopicsListResult, err error) { req, err := client.ListBySubscriptionPreparer(ctx) @@ -354,14 +339,13 @@ func (client TopicsClient) ListBySubscription(ctx context.Context) (result Topic return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListBySubscriptionPreparer prepares the ListBySubscription request. func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -374,7 +358,6 @@ func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context) (*htt return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { @@ -382,7 +365,6 @@ func (client TopicsClient) ListBySubscriptionSender(req *http.Request) (*http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. func (client TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, err error) { @@ -396,12 +378,12 @@ func (client TopicsClient) ListBySubscriptionResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypes list event types for a topic -// -// resourceGroupName is the name of the resource group within the user's subscription. providerNamespace is -// namespace of the provider of the topic resourceTypeName is name of the topic type resourceName is name of the -// topic +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// providerNamespace - namespace of the provider of the topic +// resourceTypeName - name of the topic type +// resourceName - name of the topic func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) if err != nil { @@ -424,7 +406,6 @@ func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypesPreparer prepares the ListEventTypes request. func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -435,7 +416,7 @@ func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -448,7 +429,6 @@ func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypesSender sends the ListEventTypes request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { @@ -456,7 +436,6 @@ func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypesResponder handles the response to the ListEventTypes request. The method always // closes the http.Response Body. func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { @@ -470,11 +449,10 @@ func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListSharedAccessKeys list the two keys used to publish to a topic -// -// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the -// topic +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) if err != nil { @@ -497,7 +475,6 @@ func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -506,7 +483,7 @@ func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, res "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -519,7 +496,6 @@ func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { @@ -527,7 +503,6 @@ func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always // closes the http.Response Body. func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { @@ -541,11 +516,11 @@ func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // RegenerateKey regenerate a shared access key for a topic -// -// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the -// topic regenerateKeyRequest is request body to regenerate key +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic +// regenerateKeyRequest - request body to regenerate key func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: regenerateKeyRequest, @@ -574,7 +549,6 @@ func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // RegenerateKeyPreparer prepares the RegenerateKey request. func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -583,7 +557,7 @@ func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGr "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -598,7 +572,6 @@ func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGr return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // RegenerateKeySender sends the RegenerateKey request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { @@ -606,7 +579,6 @@ func (client TopicsClient) RegenerateKeySender(req *http.Request) (*http.Respons azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // RegenerateKeyResponder handles the response to the RegenerateKey request. The method always // closes the http.Response Body. func (client TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { @@ -620,11 +592,11 @@ func (client TopicsClient) RegenerateKeyResponder(resp *http.Response) (result T return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Update asynchronously updates a topic with the specified parameters. -// -// resourceGroupName is the name of the resource group within the user's subscription. topicName is name of the -// topic topicUpdateParameters is topic update information +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic +// topicUpdateParameters - topic update information func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) if err != nil { @@ -641,7 +613,6 @@ func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UpdatePreparer prepares the Update request. func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -650,7 +621,7 @@ func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -665,23 +636,23 @@ func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client TopicsClient) UpdateResponder(resp *http.Response) (result Topic, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/topictypes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topictypes.go similarity index 78% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/topictypes.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topictypes.go index 80f888d169034..46adad4ad74ba 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid/topictypes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topictypes.go @@ -24,28 +24,24 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // TopicTypesClient is the azure EventGrid Management Client type TopicTypesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewTopicTypesClient creates an instance of the TopicTypesClient client. func NewTopicTypesClient(subscriptionID string) TopicTypesClient { return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient client. func NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // Get get information about a topic type -// -// topicTypeName is name of the topic type +// Parameters: +// topicTypeName - name of the topic type func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { req, err := client.GetPreparer(ctx, topicTypeName) if err != nil { @@ -68,14 +64,13 @@ func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetPreparer prepares the Get request. func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,7 +83,6 @@ func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName st return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client TopicTypesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -96,7 +90,6 @@ func (client TopicTypesClient) GetSender(req *http.Request) (*http.Response, err autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { @@ -110,7 +103,6 @@ func (client TopicTypesClient) GetResponder(resp *http.Response) (result TopicTy return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // List list all registered topic types func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { req, err := client.ListPreparer(ctx) @@ -134,10 +126,9 @@ func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListR return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListPreparer prepares the List request. func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -150,7 +141,6 @@ func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client TopicTypesClient) ListSender(req *http.Request) (*http.Response, error) { @@ -158,7 +148,6 @@ func (client TopicTypesClient) ListSender(req *http.Request) (*http.Response, er autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { @@ -172,10 +161,9 @@ func (client TopicTypesClient) ListResponder(resp *http.Response) (result TopicT return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypes list event types for a topic type -// -// topicTypeName is name of the topic type +// Parameters: +// topicTypeName - name of the topic type func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { req, err := client.ListEventTypesPreparer(ctx, topicTypeName) if err != nil { @@ -198,14 +186,13 @@ func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypesPreparer prepares the ListEventTypes request. func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2017-09-15-preview" + const APIVersion = "2018-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -218,7 +205,6 @@ func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topic return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypesSender sends the ListEventTypes request. The method will close the // http.Response Body if it receives an error. func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { @@ -226,7 +212,6 @@ func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Re autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid instead. // ListEventTypesResponder handles the response to the ListEventTypes request. The method always // closes the http.Response Body. func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/version.go new file mode 100644 index 0000000000000..12eed04520753 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/version.go @@ -0,0 +1,30 @@ +package eventgrid + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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.Number + " eventgrid/2018-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/eventhub/mgmt/2017-04-01/eventhub/consumergroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/consumergroups.go index 07a0faf85b7a1..386d0c64bee27 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/consumergroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/consumergroups.go @@ -306,7 +306,11 @@ func (client ConsumerGroupsClient) GetResponder(resp *http.Response) (result Con // resourceGroupName - name of the resource group within the azure subscription. // namespaceName - the Namespace name // eventHubName - the Event Hub name -func (client ConsumerGroupsClient) ListByEventHub(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string) (result ConsumerGroupListResultPage, err error) { +// skip - skip is only used if a previous operation returned a partial result. If a previous response contains +// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a +// starting point to use for subsequent calls. +// top - may be used to limit the number of results to the most recent N usageDetails. +func (client ConsumerGroupsClient) ListByEventHub(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string, skip *int32, top *int32) (result ConsumerGroupListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -315,12 +319,22 @@ func (client ConsumerGroupsClient) ListByEventHub(ctx context.Context, resourceG Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil}, + {Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { return result, validation.NewError("eventhub.ConsumerGroupsClient", "ListByEventHub", err.Error()) } result.fn = client.listByEventHubNextResults - req, err := client.ListByEventHubPreparer(ctx, resourceGroupName, namespaceName, eventHubName) + req, err := client.ListByEventHubPreparer(ctx, resourceGroupName, namespaceName, eventHubName, skip, top) if err != nil { err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub", nil, "Failure preparing request") return @@ -342,7 +356,7 @@ func (client ConsumerGroupsClient) ListByEventHub(ctx context.Context, resourceG } // ListByEventHubPreparer prepares the ListByEventHub request. -func (client ConsumerGroupsClient) ListByEventHubPreparer(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { +func (client ConsumerGroupsClient) ListByEventHubPreparer(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string, skip *int32, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ "eventHubName": autorest.Encode("path", eventHubName), "namespaceName": autorest.Encode("path", namespaceName), @@ -354,6 +368,12 @@ func (client ConsumerGroupsClient) ListByEventHubPreparer(ctx context.Context, r queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -405,7 +425,7 @@ func (client ConsumerGroupsClient) listByEventHubNextResults(lastResults Consume } // ListByEventHubComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConsumerGroupsClient) ListByEventHubComplete(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string) (result ConsumerGroupListResultIterator, err error) { - result.page, err = client.ListByEventHub(ctx, resourceGroupName, namespaceName, eventHubName) +func (client ConsumerGroupsClient) ListByEventHubComplete(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string, skip *int32, top *int32) (result ConsumerGroupListResultIterator, err error) { + result.page, err = client.ListByEventHub(ctx, resourceGroupName, namespaceName, eventHubName, skip, top) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/eventhubs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/eventhubs.go index b98f5e1cf5028..7228f2e33213d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/eventhubs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/eventhubs.go @@ -675,19 +675,33 @@ func (client EventHubsClient) ListAuthorizationRulesComplete(ctx context.Context // Parameters: // resourceGroupName - name of the resource group within the azure subscription. // namespaceName - the Namespace name -func (client EventHubsClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string) (result ListResultPage, err error) { +// skip - skip is only used if a previous operation returned a partial result. If a previous response contains +// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a +// starting point to use for subsequent calls. +// top - may be used to limit the number of results to the most recent N usageDetails. +func (client EventHubsClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result ListResultPage, err error) { if err := validation.Validate([]validation.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: namespaceName, Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil}, + {Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { return result, validation.NewError("eventhub.EventHubsClient", "ListByNamespace", err.Error()) } result.fn = client.listByNamespaceNextResults - req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName) + req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName, skip, top) if err != nil { err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListByNamespace", nil, "Failure preparing request") return @@ -709,7 +723,7 @@ func (client EventHubsClient) ListByNamespace(ctx context.Context, resourceGroup } // ListByNamespacePreparer prepares the ListByNamespace request. -func (client EventHubsClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { +func (client EventHubsClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -720,6 +734,12 @@ func (client EventHubsClient) ListByNamespacePreparer(ctx context.Context, resou queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -771,8 +791,8 @@ func (client EventHubsClient) listByNamespaceNextResults(lastResults ListResult) } // ListByNamespaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventHubsClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result ListResultIterator, err error) { - result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName) +func (client EventHubsClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result ListResultIterator, err error) { + result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName, skip, top) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/models.go index 6d642772a7874..30cfd7c93c37b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/models.go @@ -1595,12 +1595,11 @@ func (mVar *Model) UnmarshalJSON(body []byte) error { // operation. type NamespacesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (en EHNamespace, err error) { +func (future *NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (en EHNamespace, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1608,34 +1607,15 @@ func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (en return } if !done { - return en, azure.NewAsyncOpIncompleteError("eventhub.NamespacesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - en, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("eventhub.NamespacesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if en.Response.Response, err = future.GetResult(sender); err == nil && en.Response.Response.StatusCode != http.StatusNoContent { + en, err = client.CreateOrUpdateResponder(en.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", en.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - en, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1643,12 +1623,11 @@ func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (en // NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type NamespacesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { +func (future *NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1656,35 +1635,10 @@ func (future NamespacesDeleteFuture) Result(client NamespacesClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("eventhub.NamespacesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("eventhub.NamespacesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/namespaces.go index 5d69e5453ef9a..ee88189890741 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/namespaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub/namespaces.go @@ -183,15 +183,17 @@ func (client NamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resou // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (future NamespacesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -349,15 +351,17 @@ func (client NamespacesClient) DeletePreparer(ctx context.Context, resourceGroup // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client NamespacesClient) DeleteSender(req *http.Request) (future NamespacesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/iothubresource.go b/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/iothubresource.go index cd05df353aeb0..591a826267083 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/iothubresource.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/iothubresource.go @@ -272,15 +272,17 @@ func (client IotHubResourceClient) CreateOrUpdatePreparer(ctx context.Context, r // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client IotHubResourceClient) CreateOrUpdateSender(req *http.Request) (future IotHubResourceCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -341,15 +343,17 @@ func (client IotHubResourceClient) DeletePreparer(ctx context.Context, resourceG // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client IotHubResourceClient) DeleteSender(req *http.Request) (future IotHubResourceDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/models.go index 6e982061723ed..08a8d037aa8bb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices/models.go @@ -912,12 +912,11 @@ func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo // operation. type IotHubResourceCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future IotHubResourceCreateOrUpdateFuture) Result(client IotHubResourceClient) (ihd IotHubDescription, err error) { +func (future *IotHubResourceCreateOrUpdateFuture) Result(client IotHubResourceClient) (ihd IotHubDescription, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -925,34 +924,15 @@ func (future IotHubResourceCreateOrUpdateFuture) Result(client IotHubResourceCli return } if !done { - return ihd, azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ihd, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent { + ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - ihd, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -960,12 +940,11 @@ func (future IotHubResourceCreateOrUpdateFuture) Result(client IotHubResourceCli // IotHubResourceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type IotHubResourceDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future IotHubResourceDeleteFuture) Result(client IotHubResourceClient) (so SetObject, err error) { +func (future *IotHubResourceDeleteFuture) Result(client IotHubResourceClient) (so SetObject, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -973,34 +952,15 @@ func (future IotHubResourceDeleteFuture) Result(client IotHubResourceClient) (so return } if !done { - return so, azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - so, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.DeleteResponder(so.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", resp, "Failure sending request") - return - } - so, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault/models.go index 0bdea2f1b8e77..399f505677d4a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault/models.go @@ -44,13 +44,17 @@ func PossibleActionTypeValues() []ActionType { type DeletionRecoveryLevel string const ( - // Purgeable ... + // Purgeable Soft-delete is not enabled for this vault. A DELETE operation results in immediate and + // irreversible data loss. Purgeable DeletionRecoveryLevel = "Purgeable" - // Recoverable ... + // Recoverable Soft-delete is enabled for this vault and purge has been disabled. A deleted entity will + // remain in this state until recovered, or the end of the retention interval. Recoverable DeletionRecoveryLevel = "Recoverable" - // RecoverableProtectedSubscription ... + // RecoverableProtectedSubscription Soft-delete is enabled for this vault, and the subscription is + // protected against immediate deletion. RecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" - // RecoverablePurgeable ... + // RecoverablePurgeable Soft-delete is enabled for this vault; A priveleged user may trigger an immediate, + // irreversible deletion(purge) of a deleted entity. RecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" ) @@ -63,13 +67,13 @@ func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { type JSONWebKeyCurveName string const ( - // P256 ... + // P256 The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 JSONWebKeyCurveName = "P-256" - // P384 ... + // P384 The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. P384 JSONWebKeyCurveName = "P-384" - // P521 ... + // P521 The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. P521 JSONWebKeyCurveName = "P-521" - // SECP256K1 ... + // SECP256K1 The SECG SECP256K1 elliptic curve. SECP256K1 JSONWebKeyCurveName = "SECP256K1" ) @@ -1529,7 +1533,7 @@ func (kb KeyBundle) MarshalJSON() ([]byte, error) { type KeyCreateParameters struct { // Kty - The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' Kty JSONWebKeyType `json:"kty,omitempty"` - // KeySize - The key size in bytes. For example, 1024 or 2048. + // KeySize - The key size in bits. For example: 2048, 3072, or 4096 for RSA. KeySize *int32 `json:"key_size,omitempty"` KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` KeyAttributes *KeyAttributes `json:"attributes,omitempty"` @@ -1746,7 +1750,7 @@ type KeyProperties struct { Exportable *bool `json:"exportable,omitempty"` // KeyType - The key type. KeyType *string `json:"kty,omitempty"` - // KeySize - The key size in bytes. For example; 1024 or 2048. + // KeySize - The key size in bits. For example: 2048, 3072, or 4096 for RSA. KeySize *int32 `json:"key_size,omitempty"` // ReuseKey - Indicates if the same key pair will be used on certificate renewal. ReuseKey *bool `json:"reuse_key,omitempty"` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/models.go index a887b0ee342f1..f28e0abbb3d0c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/models.go @@ -1052,12 +1052,11 @@ type VaultProperties struct { // VaultsPurgeDeletedFuture an abstraction for monitoring and retrieving the results of a long-running operation. type VaultsPurgeDeletedFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VaultsPurgeDeletedFuture) Result(client VaultsClient) (ar autorest.Response, err error) { +func (future *VaultsPurgeDeletedFuture) Result(client VaultsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1065,34 +1064,9 @@ func (future VaultsPurgeDeletedFuture) Result(client VaultsClient) (ar autorest. return } if !done { - return ar, azure.NewAsyncOpIncompleteError("keyvault.VaultsPurgeDeletedFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.PurgeDeletedResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsPurgeDeletedFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("keyvault.VaultsPurgeDeletedFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsPurgeDeletedFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.PurgeDeletedResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsPurgeDeletedFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/vaults.go b/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/vaults.go index 9ee6ddc18e64a..b9bf8b24951eb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/vaults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault/vaults.go @@ -820,15 +820,17 @@ func (client VaultsClient) PurgeDeletedPreparer(ctx context.Context, vaultName s // PurgeDeletedSender sends the PurgeDeleted request. The method will close the // http.Response Body if it receives an error. func (client VaultsClient) PurgeDeletedSender(req *http.Request) (future VaultsPurgeDeletedFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/version.go deleted file mode 100644 index 6b4f11815f009..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/version.go +++ /dev/null @@ -1,31 +0,0 @@ -package insights - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " insights/2017-05-01-preview" -} - -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. -// 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/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/actiongroups.go similarity index 90% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/actiongroups.go index 0d3031bab37be..73ce7da423be6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/actiongroups.go @@ -25,25 +25,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActionGroupsClient is the monitor Management Client type ActionGroupsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewActionGroupsClient creates an instance of the ActionGroupsClient client. func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient client. func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdate create a new action group or update an existing one. // // resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. @@ -80,7 +80,7 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -89,7 +89,7 @@ func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2018-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -104,7 +104,7 @@ func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ActionGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -112,7 +112,7 @@ func (client ActionGroupsClient) CreateOrUpdateSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, err error) { @@ -126,7 +126,7 @@ func (client ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Delete delete an action group. // // resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. @@ -152,7 +152,7 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeletePreparer prepares the Delete request. func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -161,7 +161,7 @@ func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2018-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -174,7 +174,7 @@ func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGro return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ActionGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -182,7 +182,7 @@ func (client ActionGroupsClient) DeleteSender(req *http.Request) (*http.Response azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -195,8 +195,9 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. +// This operation is only supported for Email or SMS receivers. // // resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. // enableRequest is the receiver to re-enable. @@ -228,7 +229,7 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // EnableReceiverPreparer prepares the EnableReceiver request. func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -237,7 +238,7 @@ func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2018-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -252,7 +253,7 @@ func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // EnableReceiverSender sends the EnableReceiver request. The method will close the // http.Response Body if it receives an error. func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { @@ -260,7 +261,7 @@ func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // EnableReceiverResponder handles the response to the EnableReceiver request. The method always // closes the http.Response Body. func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { @@ -273,7 +274,7 @@ func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get get an action group. // // resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. @@ -299,7 +300,7 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -308,7 +309,7 @@ func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2018-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -321,7 +322,7 @@ func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ActionGroupsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -329,7 +330,7 @@ func (client ActionGroupsClient) GetSender(req *http.Request) (*http.Response, e azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { @@ -343,7 +344,7 @@ func (client ActionGroupsClient) GetResponder(resp *http.Response) (result Actio return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroup get a list of all action groups in a resource group. // // resourceGroupName is the name of the resource group. @@ -369,7 +370,7 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client ActionGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -377,7 +378,7 @@ func (client ActionGroupsClient) ListByResourceGroupPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2018-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -390,7 +391,7 @@ func (client ActionGroupsClient) ListByResourceGroupPreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client ActionGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -398,7 +399,7 @@ func (client ActionGroupsClient) ListByResourceGroupSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { @@ -412,7 +413,7 @@ func (client ActionGroupsClient) ListByResourceGroupResponder(resp *http.Respons return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionID get a list of all action groups in a subscription. func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { req, err := client.ListBySubscriptionIDPreparer(ctx) @@ -436,14 +437,14 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2018-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -456,7 +457,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the // http.Response Body if it receives an error. func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { @@ -464,7 +465,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) ( azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always // closes the http.Response Body. func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, err error) { @@ -478,7 +479,7 @@ func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Respon return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // // resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. @@ -505,7 +506,7 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdatePreparer prepares the Update request. func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -514,7 +515,7 @@ func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-01" + const APIVersion = "2018-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -529,7 +530,7 @@ func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGro return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client ActionGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { @@ -537,7 +538,7 @@ func (client ActionGroupsClient) UpdateSender(req *http.Request) (*http.Response azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/activitylogalerts.go similarity index 91% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/activitylogalerts.go index ce4ed0650ab57..39607aa23c69b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/activitylogalerts.go @@ -25,25 +25,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertsClient is the monitor Management Client type ActivityLogAlertsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient client. func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdate create a new activity log alert or update an existing one. // // resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. @@ -81,7 +81,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -105,7 +105,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ActivityLogAlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -113,7 +113,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { @@ -127,7 +127,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Respons return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Delete delete an activity log alert. // // resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. @@ -153,7 +153,7 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeletePreparer prepares the Delete request. func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -175,7 +175,7 @@ func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ActivityLogAlertsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -183,7 +183,7 @@ func (client ActivityLogAlertsClient) DeleteSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -196,7 +196,7 @@ func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get get an activity log alert. // // resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. @@ -222,7 +222,7 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -244,7 +244,7 @@ func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ActivityLogAlertsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -252,7 +252,7 @@ func (client ActivityLogAlertsClient) GetSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { @@ -266,7 +266,7 @@ func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroup get a list of all activity log alerts in a resource group. // // resourceGroupName is the name of the resource group. @@ -292,7 +292,7 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -313,7 +313,7 @@ func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(ctx context.Co return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client ActivityLogAlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -321,7 +321,7 @@ func (client ActivityLogAlertsClient) ListByResourceGroupSender(req *http.Reques azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { @@ -335,7 +335,7 @@ func (client ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionID get a list of all activity log alerts in a subscription. func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { req, err := client.ListBySubscriptionIDPreparer(ctx) @@ -359,7 +359,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -379,7 +379,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.C return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the // http.Response Body if it receives an error. func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { @@ -387,7 +387,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Reque azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always // closes the http.Response Body. func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, err error) { @@ -401,7 +401,7 @@ func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.R return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. // // resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. @@ -428,7 +428,7 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdatePreparer prepares the Update request. func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -452,7 +452,7 @@ func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client ActivityLogAlertsClient) UpdateSender(req *http.Request) (*http.Response, error) { @@ -460,7 +460,7 @@ func (client ActivityLogAlertsClient) UpdateSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/activitylogs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/activitylogs.go new file mode 100644 index 0000000000000..a3dc0a6854448 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/activitylogs.go @@ -0,0 +1,160 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ActivityLogsClient is the monitor Management Client +type ActivityLogsClient struct { + BaseClient +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewActivityLogsClient creates an instance of the ActivityLogsClient client. +func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { + return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient client. +func NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { + return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// List provides the list of records from the activity logs. +// +// filter is reduces the set of data collected.
The **$filter** argument is very restricted and allows only the +// following patterns.
- *List events for a resource group*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq +// 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' +// and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a +// subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le +// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq +// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq +// 'correlationID'.

**NOTE**: No other syntax is allowed. selectParameter is used to fetch events with only +// the given properties.
The **$select** argument is a comma separated list of property names to be returned. +// Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, +// *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, +// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* +func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.edc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") + return + } + + result.edc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") + } + + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListPreparer prepares the List request. +func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ActivityLogsClient) listNextResults(lastResults EventDataCollection) (result EventDataCollection, err error) { + req, err := lastResults.eventDataCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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, "insights.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { + result.page, err = client.List(ctx, filter, selectParameter) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/alertruleincidents.go similarity index 91% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/alertruleincidents.go index 5a14d2e05375d..dd61e7141934e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/alertruleincidents.go @@ -24,25 +24,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AlertRuleIncidentsClient is the monitor Management Client type AlertRuleIncidentsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient client. func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get gets an incident associated to an alert rule // // resourceGroupName is the name of the resource group. ruleName is the name of the rule. incidentName is the name @@ -69,7 +69,7 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -92,7 +92,7 @@ func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resource return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client AlertRuleIncidentsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -100,7 +100,7 @@ func (client AlertRuleIncidentsClient) GetSender(req *http.Request) (*http.Respo azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) { @@ -114,7 +114,7 @@ func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByAlertRule gets a list of incidents associated to an alert rule // // resourceGroupName is the name of the resource group. ruleName is the name of the rule. @@ -140,7 +140,7 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByAlertRulePreparer prepares the ListByAlertRule request. func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -162,7 +162,7 @@ func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByAlertRuleSender sends the ListByAlertRule request. The method will close the // http.Response Body if it receives an error. func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { @@ -170,7 +170,7 @@ func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always // closes the http.Response Body. func (client AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/alertrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/alertrules.go similarity index 91% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/alertrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/alertrules.go index f31713af2eaf4..37b44ad183dcc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/alertrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/alertrules.go @@ -25,25 +25,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AlertRulesClient is the monitor Management Client type AlertRulesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewAlertRulesClient creates an instance of the AlertRulesClient client. func NewAlertRulesClient(subscriptionID string) AlertRulesClient { return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient client. func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdate creates or updates an alert rule. // // resourceGroupName is the name of the resource group. ruleName is the name of the rule. parameters is the @@ -80,7 +80,7 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -104,7 +104,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -112,7 +112,7 @@ func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { @@ -126,7 +126,7 @@ func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Delete deletes an alert rule // // resourceGroupName is the name of the resource group. ruleName is the name of the rule. @@ -152,7 +152,7 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeletePreparer prepares the Delete request. func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -174,7 +174,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client AlertRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -182,7 +182,7 @@ func (client AlertRulesClient) DeleteSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -195,7 +195,7 @@ func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result auto return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get gets an alert rule // // resourceGroupName is the name of the resource group. ruleName is the name of the rule. @@ -221,7 +221,7 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -243,7 +243,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -251,7 +251,7 @@ func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, err azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleResource, err error) { @@ -265,7 +265,7 @@ func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroup list the alert rules within a resource group. // // resourceGroupName is the name of the resource group. @@ -291,7 +291,7 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -312,7 +312,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client AlertRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -320,7 +320,7 @@ func (client AlertRulesClient) ListByResourceGroupSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { @@ -334,7 +334,7 @@ func (client AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Update updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. // // resourceGroupName is the name of the resource group. ruleName is the name of the rule. alertRulesResource is @@ -361,7 +361,7 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdatePreparer prepares the Update request. func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -385,7 +385,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client AlertRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { @@ -393,7 +393,7 @@ func (client AlertRulesClient) UpdateSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/autoscalesettings.go similarity index 92% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/autoscalesettings.go index 679a101c7b8ea..5214fcb457e52 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/autoscalesettings.go @@ -25,25 +25,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleSettingsClient is the monitor Management Client type AutoscaleSettingsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient client. func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdate creates or updates an autoscale setting. // // resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. @@ -79,7 +79,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -103,7 +103,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client AutoscaleSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -111,7 +111,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { @@ -125,7 +125,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Respons return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Delete deletes and autoscale setting // // resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. @@ -151,7 +151,7 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeletePreparer prepares the Delete request. func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -173,7 +173,7 @@ func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client AutoscaleSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -181,7 +181,7 @@ func (client AutoscaleSettingsClient) DeleteSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -194,7 +194,7 @@ func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get gets an autoscale setting // // resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. @@ -220,7 +220,7 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -242,7 +242,7 @@ func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client AutoscaleSettingsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -250,7 +250,7 @@ func (client AutoscaleSettingsClient) GetSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { @@ -264,7 +264,7 @@ func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroup lists the autoscale settings for a resource group // // resourceGroupName is the name of the resource group. @@ -291,7 +291,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -312,7 +312,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(ctx context.Co return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client AutoscaleSettingsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -320,7 +320,7 @@ func (client AutoscaleSettingsClient) ListByResourceGroupSender(req *http.Reques azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, err error) { @@ -355,14 +355,14 @@ func (client AutoscaleSettingsClient) listByResourceGroupNextResults(lastResults return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // // resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. @@ -389,7 +389,7 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdatePreparer prepares the Update request. func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -413,7 +413,7 @@ func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client AutoscaleSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { @@ -421,7 +421,7 @@ func (client AutoscaleSettingsClient) UpdateSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/client.go similarity index 89% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/client.go index bf56ea6ed5e99..c5a0ad53b0202 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/client.go @@ -29,7 +29,7 @@ const ( DefaultBaseURI = "https://management.azure.com" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // BaseClient is the base client for Insights. type BaseClient struct { autorest.Client @@ -37,13 +37,13 @@ type BaseClient struct { SubscriptionID string } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // New creates an instance of the BaseClient client. func New(subscriptionID string) BaseClient { return NewWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewWithBaseURI creates an instance of the BaseClient client. func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go similarity index 89% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go index 0655ffd3f034d..d1d90bf0416a5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go @@ -24,25 +24,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettingsClient is the monitor Management Client type DiagnosticSettingsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient client. func NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdate creates or updates diagnostic settings for the specified resource. // // resourceURI is the identifier of the resource. parameters is parameters supplied to the operation. name is the @@ -69,12 +69,12 @@ func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), - "resourceUri": autorest.Encode("path", resourceURI), + "resourceUri": resourceURI, } const APIVersion = "2017-05-01-preview" @@ -92,7 +92,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -100,7 +100,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) ( autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { @@ -114,7 +114,7 @@ func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Respon return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Delete deletes existing diagnostic settings for the specified resource. // // resourceURI is the identifier of the resource. name is the name of the diagnostic setting. @@ -140,12 +140,12 @@ func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI s return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeletePreparer prepares the Delete request. func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), - "resourceUri": autorest.Encode("path", resourceURI), + "resourceUri": resourceURI, } const APIVersion = "2017-05-01-preview" @@ -161,7 +161,7 @@ func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -169,7 +169,7 @@ func (client DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Re autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client DiagnosticSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -182,7 +182,7 @@ func (client DiagnosticSettingsClient) DeleteResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get gets the active diagnostic settings for the specified resource. // // resourceURI is the identifier of the resource. name is the name of the diagnostic setting. @@ -208,12 +208,12 @@ func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), - "resourceUri": autorest.Encode("path", resourceURI), + "resourceUri": resourceURI, } const APIVersion = "2017-05-01-preview" @@ -229,7 +229,7 @@ func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resource return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client DiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -237,7 +237,7 @@ func (client DiagnosticSettingsClient) GetSender(req *http.Request) (*http.Respo autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { @@ -251,7 +251,7 @@ func (client DiagnosticSettingsClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // List gets the active diagnostic settings list for the specified resource. // // resourceURI is the identifier of the resource. @@ -277,11 +277,11 @@ func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListPreparer prepares the List request. func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceUri": autorest.Encode("path", resourceURI), + "resourceUri": resourceURI, } const APIVersion = "2017-05-01-preview" @@ -297,7 +297,7 @@ func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client DiagnosticSettingsClient) ListSender(req *http.Request) (*http.Response, error) { @@ -305,7 +305,7 @@ func (client DiagnosticSettingsClient) ListSender(req *http.Request) (*http.Resp autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go similarity index 89% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go index a93d8a64bd4bb..c45ce4c2181ec 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go @@ -24,25 +24,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettingsCategoryClient is the monitor Management Client type DiagnosticSettingsCategoryClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient client. func NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get gets the diagnostic settings category for the specified resource. // // resourceURI is the identifier of the resource. name is the name of the diagnostic setting. @@ -68,12 +68,12 @@ func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), - "resourceUri": autorest.Encode("path", resourceURI), + "resourceUri": resourceURI, } const APIVersion = "2017-05-01-preview" @@ -89,7 +89,7 @@ func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client DiagnosticSettingsCategoryClient) GetSender(req *http.Request) (*http.Response, error) { @@ -97,7 +97,7 @@ func (client DiagnosticSettingsCategoryClient) GetSender(req *http.Request) (*ht autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { @@ -111,7 +111,7 @@ func (client DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // List lists the diagnostic settings categories for the specified resource. // // resourceURI is the identifier of the resource. @@ -137,11 +137,11 @@ func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListPreparer prepares the List request. func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceUri": autorest.Encode("path", resourceURI), + "resourceUri": resourceURI, } const APIVersion = "2017-05-01-preview" @@ -157,7 +157,7 @@ func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client DiagnosticSettingsCategoryClient) ListSender(req *http.Request) (*http.Response, error) { @@ -165,7 +165,7 @@ func (client DiagnosticSettingsCategoryClient) ListSender(req *http.Request) (*h autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/eventcategories.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/eventcategories.go new file mode 100644 index 0000000000000..2fb56d4e30891 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/eventcategories.go @@ -0,0 +1,106 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// EventCategoriesClient is the monitor Management Client +type EventCategoriesClient struct { + BaseClient +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. +func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { + return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient client. +func NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { + return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// List get the list of available event categories supported in the Activity Logs Service.
The current list includes +// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. +func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") + } + + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListPreparer prepares the List request. +func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.insights/eventcategories"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EventCategoriesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/logprofiles.go similarity index 90% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/logprofiles.go index fa976b3f1577f..a591b5b334c21 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/logprofiles.go @@ -25,25 +25,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // LogProfilesClient is the monitor Management Client type LogProfilesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewLogProfilesClient creates an instance of the LogProfilesClient client. func NewLogProfilesClient(subscriptionID string) LogProfilesClient { return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient client. func NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdate create or update a log profile in Azure Monitoring REST API. // // logProfileName is the name of the log profile. parameters is parameters supplied to the operation. @@ -83,7 +83,7 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -106,7 +106,7 @@ func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logP return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LogProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -114,7 +114,7 @@ func (client LogProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.R azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, err error) { @@ -128,7 +128,7 @@ func (client LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Delete deletes the log profile. // // logProfileName is the name of the log profile. @@ -154,7 +154,7 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeletePreparer prepares the Delete request. func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -175,7 +175,7 @@ func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileNa return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LogProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -183,7 +183,7 @@ func (client LogProfilesClient) DeleteSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client LogProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -196,7 +196,7 @@ func (client LogProfilesClient) DeleteResponder(resp *http.Response) (result aut return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Get gets the log profile. // // logProfileName is the name of the log profile. @@ -222,7 +222,7 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetPreparer prepares the Get request. func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -243,7 +243,7 @@ func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client LogProfilesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -251,7 +251,7 @@ func (client LogProfilesClient) GetSender(req *http.Request) (*http.Response, er azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { @@ -265,7 +265,7 @@ func (client LogProfilesClient) GetResponder(resp *http.Response) (result LogPro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // List list the log profiles. func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { req, err := client.ListPreparer(ctx) @@ -289,7 +289,7 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListPreparer prepares the List request. func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -309,7 +309,7 @@ func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client LogProfilesClient) ListSender(req *http.Request) (*http.Response, error) { @@ -317,7 +317,7 @@ func (client LogProfilesClient) ListSender(req *http.Request) (*http.Response, e azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, err error) { @@ -331,7 +331,7 @@ func (client LogProfilesClient) ListResponder(resp *http.Response) (result LogPr return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Update updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. // // logProfileName is the name of the log profile. logProfilesResource is parameters supplied to the operation. @@ -357,7 +357,7 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdatePreparer prepares the Update request. func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -380,7 +380,7 @@ func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileNa return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client LogProfilesClient) UpdateSender(req *http.Request) (*http.Response, error) { @@ -388,7 +388,7 @@ func (client LogProfilesClient) UpdateSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/metricbaseline.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/metricbaseline.go new file mode 100644 index 0000000000000..ead5eb4c3375b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/metricbaseline.go @@ -0,0 +1,217 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetricBaselineClient is the monitor Management Client +type MetricBaselineClient struct { + BaseClient +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. +func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { + return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client. +func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { + return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// CalculateBaseline **Lists the baseline values for a resource**. +// +// resourceURI is the identifier of the resource. It has the following structure: +// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For +// example: +// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 +// timeSeriesInformation is information that need to be specified to calculate a baseline on a time series. +func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: timeSeriesInformation, + Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) + } + + req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") + return + } + + resp, err := client.CalculateBaselineSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") + return + } + + result, err = client.CalculateBaselineResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") + } + + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// CalculateBaselinePreparer prepares the CalculateBaseline request. +func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-11-01-preview" + 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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), + autorest.WithJSON(timeSeriesInformation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// CalculateBaselineSender sends the CalculateBaseline request. The method will close the +// http.Response Body if it receives an error. +func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always +// closes the http.Response Body. +func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Get **Gets the baseline values for a specific metric**. +// +// resourceURI is the identifier of the resource. It has the following structure: +// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For +// example: +// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 +// metricName is the name of the metric to retrieve the baseline for. timespan is the timespan of the query. It is +// a string with the following format 'startDateTime_ISO/endDateTime_ISO'. interval is the interval (i.e. +// timegrain) of the query. aggregation is the aggregation type of the metric to retrieve the baseline for. +// sensitivities is the list of sensitivities (comma separated) to retrieve. resultType is allows retrieving only +// metadata of the baseline. On data request all information is retrieved. +func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { + req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") + } + + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// GetPreparer prepares the Get request. +func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "metricName": autorest.Encode("path", metricName), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if len(sensitivities) > 0 { + queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/monitor/mgmt/2018-03-01/insights/metricdefinitions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/metricdefinitions.go new file mode 100644 index 0000000000000..c825a5700f772 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/metricdefinitions.go @@ -0,0 +1,111 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetricDefinitionsClient is the monitor Management Client +type MetricDefinitionsClient struct { + BaseClient +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. +func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { + return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient client. +func NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { + return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// List lists the metric definitions for the resource. +// +// resourceURI is the identifier of the resource. +func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string) (result MetricDefinitionCollection, err error) { + req, err := client.ListPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListPreparer prepares the List request. +func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client MetricDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/monitor/mgmt/2018-03-01/insights/metrics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/metrics.go new file mode 100644 index 0000000000000..a5d100355bd62 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/metrics.go @@ -0,0 +1,149 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetricsClient is the monitor Management Client +type MetricsClient struct { + BaseClient +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewMetricsClient creates an instance of the MetricsClient client. +func NewMetricsClient(subscriptionID string) MetricsClient { + return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewMetricsClientWithBaseURI creates an instance of the MetricsClient client. +func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { + return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// List **Lists the metric values for a resource**. +// +// resourceURI is the identifier of the resource. timespan is the timespan of the query. It is a string with the +// following format 'startDateTime_ISO/endDateTime_ISO'. interval is the interval (i.e. timegrain) of the query. +// metric is the name of the metric to retrieve. aggregation is the list of aggregation types (comma separated) to +// retrieve. top is the maximum number of records to retrieve. +// Valid only if $filter is specified. +// Defaults to 10. orderby is the aggregation to use for sorting results and the direction of the sort. +// Only one order can be specified. +// Examples: sum asc. filter is the **$filter** is used to reduce the set of metric data +// returned.
Example:
Metric contains metadata A, B and C.
- Return all time series of C where A = a1 and +// B = b1 or b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid +// variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**
This is invalid because the logical +// or operator cannot separate two different metadata names.
- Return all time series where A = a1, B = b1 and C +// = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = +// a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. resultType is reduces the set of data collected. The +// syntax allowed depends on the operation. See the operation's description for details. +func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metric string, aggregation string, top *float64, orderby string, filter string, resultType ResultType) (result Response, err error) { + req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metric, aggregation, top, orderby, filter, resultType) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") + } + + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListPreparer prepares the List request. +func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metric string, aggregation string, top *float64, orderby string, filter string, resultType ResultType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(metric) > 0 { + queryParameters["metric"] = autorest.Encode("query", metric) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client MetricsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MetricsClient) ListResponder(resp *http.Response) (result Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/monitor/mgmt/2017-05-01-preview/insights/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/models.go similarity index 71% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/models.go index aece5f5fa3c1b..82401666820ed 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/models.go @@ -25,7 +25,32 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// AggregationType enumerates the values for aggregation type. +type AggregationType string + +const ( + // Average ... + Average AggregationType = "Average" + // Count ... + Count AggregationType = "Count" + // Maximum ... + Maximum AggregationType = "Maximum" + // Minimum ... + Minimum AggregationType = "Minimum" + // None ... + None AggregationType = "None" + // Total ... + Total AggregationType = "Total" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. +func PossibleAggregationTypeValues() []AggregationType { + return []AggregationType{Average, Count, Maximum, Minimum, None, Total} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // CategoryType enumerates the values for category type. type CategoryType string @@ -36,13 +61,13 @@ const ( Metrics CategoryType = "Metrics" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. func PossibleCategoryTypeValues() []CategoryType { return []CategoryType{Logs, Metrics} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ComparisonOperationType enumerates the values for comparison operation type. type ComparisonOperationType string @@ -61,13 +86,13 @@ const ( NotEquals ComparisonOperationType = "NotEquals" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. func PossibleComparisonOperationTypeValues() []ComparisonOperationType { return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ConditionOperator enumerates the values for condition operator. type ConditionOperator string @@ -82,34 +107,57 @@ const ( ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. func PossibleConditionOperatorValues() []ConditionOperator { return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// EventLevel enumerates the values for event level. +type EventLevel string + +const ( + // Critical ... + Critical EventLevel = "Critical" + // Error ... + Error EventLevel = "Error" + // Informational ... + Informational EventLevel = "Informational" + // Verbose ... + Verbose EventLevel = "Verbose" + // Warning ... + Warning EventLevel = "Warning" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. +func PossibleEventLevelValues() []EventLevel { + return []EventLevel{Critical, Error, Informational, Verbose, Warning} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string const ( - // Average ... - Average MetricStatisticType = "Average" - // Max ... - Max MetricStatisticType = "Max" - // Min ... - Min MetricStatisticType = "Min" - // Sum ... - Sum MetricStatisticType = "Sum" + // MetricStatisticTypeAverage ... + MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeMax ... + MetricStatisticTypeMax MetricStatisticType = "Max" + // MetricStatisticTypeMin ... + MetricStatisticTypeMin MetricStatisticType = "Min" + // MetricStatisticTypeSum ... + MetricStatisticTypeSum MetricStatisticType = "Sum" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{Average, Max, Min, Sum} + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // OdataType enumerates the values for odata type. type OdataType string @@ -122,13 +170,13 @@ const ( OdataTypeRuleDataSource OdataType = "RuleDataSource" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleOdataTypeValues returns an array of possible values for the OdataType const type. func PossibleOdataTypeValues() []OdataType { return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. type OdataTypeBasicRuleAction string @@ -141,13 +189,13 @@ const ( OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. type OdataTypeBasicRuleCondition string @@ -162,13 +210,13 @@ const ( OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ReceiverStatus enumerates the values for receiver status. type ReceiverStatus string @@ -181,42 +229,59 @@ const ( NotSpecified ReceiverStatus = "NotSpecified" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. func PossibleReceiverStatusValues() []ReceiverStatus { return []ReceiverStatus{Disabled, Enabled, NotSpecified} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RecurrenceFrequency enumerates the values for recurrence frequency. type RecurrenceFrequency string const ( - // Day ... - Day RecurrenceFrequency = "Day" - // Hour ... - Hour RecurrenceFrequency = "Hour" - // Minute ... - Minute RecurrenceFrequency = "Minute" - // Month ... - Month RecurrenceFrequency = "Month" - // None ... - None RecurrenceFrequency = "None" - // Second ... - Second RecurrenceFrequency = "Second" - // Week ... - Week RecurrenceFrequency = "Week" - // Year ... - Year RecurrenceFrequency = "Year" + // RecurrenceFrequencyDay ... + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + // RecurrenceFrequencyHour ... + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + // RecurrenceFrequencyMinute ... + RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" + // RecurrenceFrequencyMonth ... + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + // RecurrenceFrequencyNone ... + RecurrenceFrequencyNone RecurrenceFrequency = "None" + // RecurrenceFrequencySecond ... + RecurrenceFrequencySecond RecurrenceFrequency = "Second" + // RecurrenceFrequencyWeek ... + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + // RecurrenceFrequencyYear ... + RecurrenceFrequencyYear RecurrenceFrequency = "Year" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{Day, Hour, Minute, Month, None, Second, Week, Year} + return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ResultType enumerates the values for result type. +type ResultType string + +const ( + // Data ... + Data ResultType = "Data" + // Metadata ... + Metadata ResultType = "Metadata" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// PossibleResultTypeValues returns an array of possible values for the ResultType const type. +func PossibleResultTypeValues() []ResultType { + return []ResultType{Data, Metadata} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ScaleDirection enumerates the values for scale direction. type ScaleDirection string @@ -229,13 +294,13 @@ const ( ScaleDirectionNone ScaleDirection = "None" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. func PossibleScaleDirectionValues() []ScaleDirection { return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ScaleType enumerates the values for scale type. type ScaleType string @@ -248,13 +313,32 @@ const ( PercentChangeCount ScaleType = "PercentChangeCount" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. func PossibleScaleTypeValues() []ScaleType { return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Sensitivity enumerates the values for sensitivity. +type Sensitivity string + +const ( + // High ... + High Sensitivity = "High" + // Low ... + Low Sensitivity = "Low" + // Medium ... + Medium Sensitivity = "Medium" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. +func PossibleSensitivityValues() []Sensitivity { + return []Sensitivity{High, Low, Medium} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // TimeAggregationOperator enumerates the values for time aggregation operator. type TimeAggregationOperator string @@ -271,13 +355,13 @@ const ( TimeAggregationOperatorTotal TimeAggregationOperator = "Total" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // TimeAggregationType enumerates the values for time aggregation type. type TimeAggregationType string @@ -294,13 +378,44 @@ const ( TimeAggregationTypeTotal TimeAggregationType = "Total" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Unit enumerates the values for unit. +type Unit string + +const ( + // UnitBytes ... + UnitBytes Unit = "Bytes" + // UnitByteSeconds ... + UnitByteSeconds Unit = "ByteSeconds" + // UnitBytesPerSecond ... + UnitBytesPerSecond Unit = "BytesPerSecond" + // UnitCount ... + UnitCount Unit = "Count" + // UnitCountPerSecond ... + UnitCountPerSecond Unit = "CountPerSecond" + // UnitMilliSeconds ... + UnitMilliSeconds Unit = "MilliSeconds" + // UnitPercent ... + UnitPercent Unit = "Percent" + // UnitSeconds ... + UnitSeconds Unit = "Seconds" + // UnitUnspecified ... + UnitUnspecified Unit = "Unspecified" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// PossibleUnitValues returns an array of possible values for the Unit const type. +func PossibleUnitValues() []Unit { + return []Unit{UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCount, UnitCountPerSecond, UnitMilliSeconds, UnitPercent, UnitSeconds, UnitUnspecified} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActionGroup an Azure action group. type ActionGroup struct { // GroupShortName - The short name of the action group. This will be used in SMS messages. @@ -319,9 +434,15 @@ type ActionGroup struct { AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` + // VoiceReceivers - The list of voice receivers that are part of this action group. + VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` + // LogicAppReceivers - The list of logic app receivers that are part of this action group. + LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` + // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. + AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActionGroupList a list of action groups. type ActionGroupList struct { autorest.Response `json:"-"` @@ -331,14 +452,14 @@ type ActionGroupList struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActionGroupPatch an Azure action group for patch operations. type ActionGroupPatch struct { // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. Enabled *bool `json:"enabled,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActionGroupPatchBody an action group object for the body of patch operations. type ActionGroupPatchBody struct { // Tags - Resource tags @@ -347,7 +468,7 @@ type ActionGroupPatchBody struct { *ActionGroupPatch `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for ActionGroupPatchBody. func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -360,7 +481,7 @@ func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -394,7 +515,7 @@ func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActionGroupResource an action group resource. type ActionGroupResource struct { autorest.Response `json:"-"` @@ -412,7 +533,7 @@ type ActionGroupResource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for ActionGroupResource. func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -437,7 +558,7 @@ func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -507,7 +628,7 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlert an Azure activity log alert. type ActivityLogAlert struct { // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. @@ -522,7 +643,7 @@ type ActivityLogAlert struct { Description *string `json:"description,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertActionGroup a pointer to an Azure Action Group. type ActivityLogAlertActionGroup struct { // ActionGroupID - The resourceId of the action group. This cannot be null or empty. @@ -531,7 +652,7 @@ type ActivityLogAlertActionGroup struct { WebhookProperties map[string]*string `json:"webhookProperties"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -544,14 +665,14 @@ func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertActionList a list of activity log alert actions. type ActivityLogAlertActionList struct { // ActionGroups - The list of activity log alerts. ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member conditions are // met. type ActivityLogAlertAllOfCondition struct { @@ -559,7 +680,7 @@ type ActivityLogAlertAllOfCondition struct { AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log field and // value. type ActivityLogAlertLeafCondition struct { @@ -569,7 +690,7 @@ type ActivityLogAlertLeafCondition struct { Equals *string `json:"equals,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertList a list of activity log alerts. type ActivityLogAlertList struct { autorest.Response `json:"-"` @@ -579,14 +700,14 @@ type ActivityLogAlertList struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertPatch an Azure activity log alert for patch operations. type ActivityLogAlertPatch struct { // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. Enabled *bool `json:"enabled,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. type ActivityLogAlertPatchBody struct { // Tags - Resource tags @@ -595,7 +716,7 @@ type ActivityLogAlertPatchBody struct { *ActivityLogAlertPatch `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -608,7 +729,7 @@ func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -642,7 +763,7 @@ func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ActivityLogAlertResource an activity log alert resource. type ActivityLogAlertResource struct { autorest.Response `json:"-"` @@ -660,7 +781,7 @@ type ActivityLogAlertResource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for ActivityLogAlertResource. func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -685,7 +806,7 @@ func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -755,7 +876,7 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AlertRule an alert rule. type AlertRule struct { // Name - the name of the alert rule. @@ -772,7 +893,7 @@ type AlertRule struct { LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for AlertRule struct. func (ar *AlertRule) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -840,7 +961,7 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AlertRuleResource the alert rule resource. type AlertRuleResource struct { autorest.Response `json:"-"` @@ -858,7 +979,7 @@ type AlertRuleResource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for AlertRuleResource. func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -883,7 +1004,7 @@ func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -953,7 +1074,7 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AlertRuleResourceCollection represents a collection of alert rule resources. type AlertRuleResourceCollection struct { autorest.Response `json:"-"` @@ -961,7 +1082,7 @@ type AlertRuleResourceCollection struct { Value *[]AlertRuleResource `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AlertRuleResourcePatch the alert rule object for patch operations. type AlertRuleResourcePatch struct { // Tags - Resource tags @@ -970,7 +1091,7 @@ type AlertRuleResourcePatch struct { *AlertRule `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for AlertRuleResourcePatch. func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -983,7 +1104,7 @@ func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1017,7 +1138,7 @@ func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutomationRunbookReceiver the Azure Automation Runbook notification receiver. type AutomationRunbookReceiver struct { // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. @@ -1034,7 +1155,7 @@ type AutomationRunbookReceiver struct { ServiceURI *string `json:"serviceUri,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleNotification autoscale notification. type AutoscaleNotification struct { // Operation - the operation associated with the notification and its value must be "scale" @@ -1045,7 +1166,7 @@ type AutoscaleNotification struct { Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleProfile autoscale profile. type AutoscaleProfile struct { // Name - the name of the profile. @@ -1060,7 +1181,7 @@ type AutoscaleProfile struct { Recurrence *Recurrence `json:"recurrence,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a resource. type AutoscaleSetting struct { // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. @@ -1075,7 +1196,7 @@ type AutoscaleSetting struct { TargetResourceURI *string `json:"targetResourceUri,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleSettingResource the autoscale setting resource. type AutoscaleSettingResource struct { autorest.Response `json:"-"` @@ -1093,7 +1214,7 @@ type AutoscaleSettingResource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for AutoscaleSettingResource. func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1118,7 +1239,7 @@ func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1188,7 +1309,7 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. type AutoscaleSettingResourceCollection struct { autorest.Response `json:"-"` @@ -1198,7 +1319,7 @@ type AutoscaleSettingResourceCollection struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleSettingResourceCollectionIterator provides access to a complete listing of AutoscaleSettingResource // values. type AutoscaleSettingResourceCollectionIterator struct { @@ -1206,7 +1327,7 @@ type AutoscaleSettingResourceCollectionIterator struct { page AutoscaleSettingResourceCollectionPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { @@ -1223,19 +1344,19 @@ func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Response returns the raw server response from the last page request. func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { @@ -1245,7 +1366,7 @@ func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingR return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // IsEmpty returns true if the ListResult contains no values. func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { return asrc.Value == nil || len(*asrc.Value) == 0 @@ -1263,14 +1384,14 @@ func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectio autorest.WithBaseURL(to.String(asrc.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. type AutoscaleSettingResourceCollectionPage struct { fn func(AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) asrc AutoscaleSettingResourceCollection } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *AutoscaleSettingResourceCollectionPage) Next() error { @@ -1282,19 +1403,19 @@ func (page *AutoscaleSettingResourceCollectionPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { return !page.asrc.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Response returns the raw server response from the last page request. func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { return page.asrc } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Values returns the slice of values for the current page or nil if there are no values. func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { if page.asrc.IsEmpty() { @@ -1303,7 +1424,7 @@ func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingRe return *page.asrc.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AutoscaleSettingResourcePatch the autoscale setting object for patch operations. type AutoscaleSettingResourcePatch struct { // Tags - Resource tags @@ -1312,7 +1433,7 @@ type AutoscaleSettingResourcePatch struct { *AutoscaleSetting `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1325,7 +1446,7 @@ func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1359,7 +1480,7 @@ func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AzureAppPushReceiver the Azure mobile App push notification receiver. type AzureAppPushReceiver struct { // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. @@ -1368,7 +1489,154 @@ type AzureAppPushReceiver struct { EmailAddress *string `json:"emailAddress,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// AzureFunctionReceiver an azure function receiver. +type AzureFunctionReceiver struct { + // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // FunctionAppResourceID - The azure resource id of the function app. + FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` + // FunctionName - The function name in the function app. + FunctionName *string `json:"functionName,omitempty"` + // HTTPTriggerURL - The http trigger url where http request sent to. + HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Baseline the baseline values for a single sensitivity value. +type Baseline struct { + // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' + Sensitivity Sensitivity `json:"sensitivity,omitempty"` + // LowThresholds - The low thresholds of the baseline. + LowThresholds *[]float64 `json:"lowThresholds,omitempty"` + // HighThresholds - The high thresholds of the baseline. + HighThresholds *[]float64 `json:"highThresholds,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// BaselineMetadataValue represents a baseline metadata value. +type BaselineMetadataValue struct { + // Name - the name of the metadata. + Name *LocalizableString `json:"name,omitempty"` + // Value - the value of the metadata. + Value *string `json:"value,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// BaselineProperties the baseline properties class. +type BaselineProperties struct { + // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + Timespan *string `json:"timespan,omitempty"` + // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + Interval *string `json:"interval,omitempty"` + // Aggregation - The aggregation type of the metric. + Aggregation *string `json:"aggregation,omitempty"` + // Timestamps - the array of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Baseline - the baseline values for each sensitivity. + Baseline *[]Baseline `json:"baseline,omitempty"` + // Metadata - the baseline metadata values. + Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// BaselineResponse the response to a baseline query. +type BaselineResponse struct { + autorest.Response `json:"-"` + // ID - the metric baseline Id. + ID *string `json:"id,omitempty"` + // Type - the resource type of the baseline resource. + Type *string `json:"type,omitempty"` + // Name - the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + // BaselineProperties - the properties of the baseline. + *BaselineProperties `json:"properties,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MarshalJSON is the custom marshaler for BaselineResponse. +func (br BaselineResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.ID != nil { + objectMap["id"] = br.ID + } + if br.Type != nil { + objectMap["type"] = br.Type + } + if br.Name != nil { + objectMap["name"] = br.Name + } + if br.BaselineProperties != nil { + objectMap["properties"] = br.BaselineProperties + } + return json.Marshal(objectMap) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. +func (br *BaselineResponse) UnmarshalJSON(body []byte) error { + 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 + } + br.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + br.Type = &typeVar + } + case "name": + if v != nil { + var name LocalizableString + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + br.Name = &name + } + case "properties": + if v != nil { + var baselineProperties BaselineProperties + err = json.Unmarshal(*v, &baselineProperties) + if err != nil { + return err + } + br.BaselineProperties = &baselineProperties + } + } + } + + return nil +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// CalculateBaselineResponse the response to a calcualte baseline call. +type CalculateBaselineResponse struct { + autorest.Response `json:"-"` + // Type - the resource type of the baseline resource. + Type *string `json:"type,omitempty"` + // Timestamps - the array of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Baseline - the baseline values for each sensitivity. + Baseline *[]Baseline `json:"baseline,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettings the diagnostic settings. type DiagnosticSettings struct { // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. @@ -1385,14 +1653,14 @@ type DiagnosticSettings struct { WorkspaceID *string `json:"workspaceId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettingsCategory the diagnostic settings Category. type DiagnosticSettingsCategory struct { // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' CategoryType CategoryType `json:"categoryType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettingsCategoryResource the diagnostic settings category resource. type DiagnosticSettingsCategoryResource struct { autorest.Response `json:"-"` @@ -1405,7 +1673,7 @@ type DiagnosticSettingsCategoryResource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1424,7 +1692,7 @@ func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1476,7 +1744,7 @@ func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category resources. type DiagnosticSettingsCategoryResourceCollection struct { autorest.Response `json:"-"` @@ -1484,7 +1752,7 @@ type DiagnosticSettingsCategoryResourceCollection struct { Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettingsResource the diagnostic setting resource. type DiagnosticSettingsResource struct { autorest.Response `json:"-"` @@ -1497,7 +1765,7 @@ type DiagnosticSettingsResource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for DiagnosticSettingsResource. func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1516,7 +1784,7 @@ func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1568,7 +1836,7 @@ func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // DiagnosticSettingsResourceCollection represents a collection of alert rule resources. type DiagnosticSettingsResourceCollection struct { autorest.Response `json:"-"` @@ -1576,7 +1844,7 @@ type DiagnosticSettingsResourceCollection struct { Value *[]DiagnosticSettingsResource `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // EmailNotification email notification of an autoscale event. type EmailNotification struct { // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. @@ -1587,7 +1855,7 @@ type EmailNotification struct { CustomEmails *[]string `json:"customEmails,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // EmailReceiver an email receiver. type EmailReceiver struct { // Name - The name of the email receiver. Names must be unique across all receivers within an action group. @@ -1598,14 +1866,14 @@ type EmailReceiver struct { Status ReceiverStatus `json:"status,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // EnableRequest describes a receiver that should be resubscribed. type EnableRequest struct { // ReceiverName - The name of the receiver to resubscribe. ReceiverName *string `json:"receiverName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -1614,7 +1882,274 @@ type ErrorResponse struct { Message *string `json:"message,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, +// Security, ServiceHealth, Alert, Recommendation, Policy. +type EventCategoryCollection struct { + autorest.Response `json:"-"` + // Value - the list that includes the Azure event categories. + Value *[]LocalizableString `json:"value,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// EventData the Azure event log entries are of type EventData +type EventData struct { + Authorization *SenderAuthorization `json:"authorization,omitempty"` + // Claims - key value pairs to identify ARM permissions. + Claims map[string]*string `json:"claims"` + // Caller - the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. + Caller *string `json:"caller,omitempty"` + // Description - the description of the event. + Description *string `json:"description,omitempty"` + // ID - the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. + ID *string `json:"id,omitempty"` + // EventDataID - the event data Id. This is a unique identifier for an event. + EventDataID *string `json:"eventDataId,omitempty"` + // CorrelationID - the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. + CorrelationID *string `json:"correlationId,omitempty"` + // EventName - the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. + EventName *LocalizableString `json:"eventName,omitempty"` + // Category - the event category. + Category *LocalizableString `json:"category,omitempty"` + // HTTPRequest - the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). + HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` + // Level - the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + Level EventLevel `json:"level,omitempty"` + // ResourceGroupName - the resource group name of the impacted resource. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceProviderName - the resource provider name of the impacted resource. + ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` + // ResourceID - the resource uri that uniquely identifies the resource that caused this event. + ResourceID *string `json:"resourceId,omitempty"` + // ResourceType - the resource type + ResourceType *LocalizableString `json:"resourceType,omitempty"` + // OperationID - It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. + OperationID *string `json:"operationId,omitempty"` + // OperationName - the operation name. + OperationName *LocalizableString `json:"operationName,omitempty"` + // Properties - the set of pairs (usually a Dictionary) that includes details about the event. + Properties map[string]*string `json:"properties"` + // Status - a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. + Status *LocalizableString `json:"status,omitempty"` + // SubStatus - the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) + SubStatus *LocalizableString `json:"subStatus,omitempty"` + // EventTimestamp - the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. + EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` + // SubmissionTimestamp - the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. + SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` + // SubscriptionID - the Azure subscription Id usually a GUID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // TenantID - the Azure tenant Id + TenantID *string `json:"tenantId,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MarshalJSON is the custom marshaler for EventData. +func (ed EventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ed.Authorization != nil { + objectMap["authorization"] = ed.Authorization + } + if ed.Claims != nil { + objectMap["claims"] = ed.Claims + } + if ed.Caller != nil { + objectMap["caller"] = ed.Caller + } + if ed.Description != nil { + objectMap["description"] = ed.Description + } + if ed.ID != nil { + objectMap["id"] = ed.ID + } + if ed.EventDataID != nil { + objectMap["eventDataId"] = ed.EventDataID + } + if ed.CorrelationID != nil { + objectMap["correlationId"] = ed.CorrelationID + } + if ed.EventName != nil { + objectMap["eventName"] = ed.EventName + } + if ed.Category != nil { + objectMap["category"] = ed.Category + } + if ed.HTTPRequest != nil { + objectMap["httpRequest"] = ed.HTTPRequest + } + if ed.Level != "" { + objectMap["level"] = ed.Level + } + if ed.ResourceGroupName != nil { + objectMap["resourceGroupName"] = ed.ResourceGroupName + } + if ed.ResourceProviderName != nil { + objectMap["resourceProviderName"] = ed.ResourceProviderName + } + if ed.ResourceID != nil { + objectMap["resourceId"] = ed.ResourceID + } + if ed.ResourceType != nil { + objectMap["resourceType"] = ed.ResourceType + } + if ed.OperationID != nil { + objectMap["operationId"] = ed.OperationID + } + if ed.OperationName != nil { + objectMap["operationName"] = ed.OperationName + } + if ed.Properties != nil { + objectMap["properties"] = ed.Properties + } + if ed.Status != nil { + objectMap["status"] = ed.Status + } + if ed.SubStatus != nil { + objectMap["subStatus"] = ed.SubStatus + } + if ed.EventTimestamp != nil { + objectMap["eventTimestamp"] = ed.EventTimestamp + } + if ed.SubmissionTimestamp != nil { + objectMap["submissionTimestamp"] = ed.SubmissionTimestamp + } + if ed.SubscriptionID != nil { + objectMap["subscriptionId"] = ed.SubscriptionID + } + if ed.TenantID != nil { + objectMap["tenantId"] = ed.TenantID + } + return json.Marshal(objectMap) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// EventDataCollection represents collection of events. +type EventDataCollection struct { + autorest.Response `json:"-"` + // Value - this list that includes the Azure audit logs. + Value *[]EventData `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of events. + NextLink *string `json:"nextLink,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// EventDataCollectionIterator provides access to a complete listing of EventData values. +type EventDataCollectionIterator struct { + i int + page EventDataCollectionPage +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EventDataCollectionIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventDataCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Response returns the raw server response from the last page request. +func (iter EventDataCollectionIterator) Response() EventDataCollection { + return iter.page.Response() +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EventDataCollectionIterator) Value() EventData { + if !iter.page.NotDone() { + return EventData{} + } + return iter.page.Values()[iter.i] +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// IsEmpty returns true if the ListResult contains no values. +func (edc EventDataCollection) IsEmpty() bool { + return edc.Value == nil || len(*edc.Value) == 0 +} + +// eventDataCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (edc EventDataCollection) eventDataCollectionPreparer() (*http.Request, error) { + if edc.NextLink == nil || len(to.String(edc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(edc.NextLink))) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// EventDataCollectionPage contains a page of EventData values. +type EventDataCollectionPage struct { + fn func(EventDataCollection) (EventDataCollection, error) + edc EventDataCollection +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EventDataCollectionPage) Next() error { + next, err := page.fn(page.edc) + if err != nil { + return err + } + page.edc = next + return nil +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventDataCollectionPage) NotDone() bool { + return !page.edc.IsEmpty() +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Response returns the raw server response from the last page request. +func (page EventDataCollectionPage) Response() EventDataCollection { + return page.edc +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventDataCollectionPage) Values() []EventData { + if page.edc.IsEmpty() { + return nil + } + return *page.edc.Value +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// HTTPRequestInfo the Http request info. +type HTTPRequestInfo struct { + // ClientRequestID - the client request id. + ClientRequestID *string `json:"clientRequestId,omitempty"` + // ClientIPAddress - the client Ip Address + ClientIPAddress *string `json:"clientIpAddress,omitempty"` + // Method - the Http request method. + Method *string `json:"method,omitempty"` + // URI - the Uri. + URI *string `json:"uri,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Incident an alert incident indicates the activation status of an alert rule. type Incident struct { autorest.Response `json:"-"` @@ -1630,7 +2165,7 @@ type Incident struct { ResolvedTime *date.Time `json:"resolvedTime,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // IncidentListResult the List incidents operation response. type IncidentListResult struct { autorest.Response `json:"-"` @@ -1638,7 +2173,7 @@ type IncidentListResult struct { Value *[]Incident `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ItsmReceiver an Itsm receiver. type ItsmReceiver struct { // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. @@ -1653,7 +2188,16 @@ type ItsmReceiver struct { Region *string `json:"region,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// LocalizableString the localizable string class. +type LocalizableString struct { + // Value - the invariant value. + Value *string `json:"value,omitempty"` + // LocalizedValue - the locale specific value. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. type LocationThresholdRuleCondition struct { // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. @@ -1666,7 +2210,7 @@ type LocationThresholdRuleCondition struct { OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition @@ -1684,37 +2228,37 @@ func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { return <rc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { return <rc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1765,7 +2309,18 @@ func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// LogicAppReceiver a logic app receiver. +type LogicAppReceiver struct { + // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // ResourceID - The azure resource id of the logic app receiver. + ResourceID *string `json:"resourceId,omitempty"` + // CallbackURL - The callback url where http request sent to. + CallbackURL *string `json:"callbackUrl,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // LogProfileCollection represents a collection of log profiles. type LogProfileCollection struct { autorest.Response `json:"-"` @@ -1773,7 +2328,7 @@ type LogProfileCollection struct { Value *[]LogProfileResource `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // LogProfileProperties the log profile properties. type LogProfileProperties struct { // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. @@ -1788,7 +2343,7 @@ type LogProfileProperties struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // LogProfileResource the log profile resource. type LogProfileResource struct { autorest.Response `json:"-"` @@ -1806,7 +2361,7 @@ type LogProfileResource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for LogProfileResource. func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1831,7 +2386,7 @@ func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1901,7 +2456,7 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // LogProfileResourcePatch the log profile resource for patch operations. type LogProfileResourcePatch struct { // Tags - Resource tags @@ -1910,7 +2465,7 @@ type LogProfileResourcePatch struct { *LogProfileProperties `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for LogProfileResourcePatch. func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1923,7 +2478,7 @@ func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1957,7 +2512,7 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. type LogSettings struct { // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. @@ -1968,7 +2523,7 @@ type LogSettings struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ManagementEventAggregationCondition how the data that is collected should be combined over time. type ManagementEventAggregationCondition struct { // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' @@ -1979,7 +2534,7 @@ type ManagementEventAggregationCondition struct { WindowSize *string `json:"windowSize,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ManagementEventRuleCondition a management event rule condition. type ManagementEventRuleCondition struct { // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. @@ -1990,7 +2545,7 @@ type ManagementEventRuleCondition struct { OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for ManagementEventRuleCondition. func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition @@ -2005,37 +2560,37 @@ func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { return &merc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { return &merc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2077,7 +2632,70 @@ func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetadataValue represents a metric metadata value. +type MetadataValue struct { + // Name - the name of the metadata. + Name *LocalizableString `json:"name,omitempty"` + // Value - the value of the metadata. + Value *string `json:"value,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Metric the result data of a query. +type Metric struct { + // ID - the metric Id. + ID *string `json:"id,omitempty"` + // Type - the resource type of the metric resource. + Type *string `json:"type,omitempty"` + // Name - the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' + Unit Unit `json:"unit,omitempty"` + // Timeseries - the time series returned when a data query is performed. + Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and the +// retention period for that time grain. +type MetricAvailability struct { + // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + TimeGrain *string `json:"timeGrain,omitempty"` + // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + Retention *string `json:"retention,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetricDefinition metric definition class specifies the metadata for a metric. +type MetricDefinition struct { + // IsDimensionRequired - Flag to indicate whether the dimension is required. + IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` + // ResourceID - the resource identifier of the resource that emitted the metric. + ResourceID *string `json:"resourceId,omitempty"` + // Name - the name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableString `json:"name,omitempty"` + // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' + Unit Unit `json:"unit,omitempty"` + // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` + // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. + MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` + // ID - the resource identifier of the metric definition. + ID *string `json:"id,omitempty"` + // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. + Dimensions *[]LocalizableString `json:"dimensions,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetricDefinitionCollection represents collection of metric definitions. +type MetricDefinitionCollection struct { + autorest.Response `json:"-"` + // Value - the values for the metric definitions. + Value *[]MetricDefinition `json:"value,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. type MetricSettings struct { // TimeGrain - the timegrain of the metric in ISO8601 format. @@ -2090,7 +2708,7 @@ type MetricSettings struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MetricTrigger the trigger that results in a scaling action. type MetricTrigger struct { // MetricName - the name of the metric that defines what the rule monitors. @@ -2099,7 +2717,7 @@ type MetricTrigger struct { MetricResourceURI *string `json:"metricResourceUri,omitempty"` // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'Average', 'Min', 'Max', 'Sum' + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' Statistic MetricStatisticType `json:"statistic,omitempty"` // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. TimeWindow *string `json:"timeWindow,omitempty"` @@ -2111,7 +2729,24 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// MetricValue represents a metric value. +type MetricValue struct { + // TimeStamp - the timestamp for the metric value in ISO 8601 format. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // Average - the average value in the time range. + Average *float64 `json:"average,omitempty"` + // Minimum - the least value in the time range. + Minimum *float64 `json:"minimum,omitempty"` + // Maximum - the greatest value in the time range. + Maximum *float64 `json:"maximum,omitempty"` + // Total - the sum of all of the values in the time range. + Total *float64 `json:"total,omitempty"` + // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. + Count *int64 `json:"count,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Operation microsoft Insights API operation definition. type Operation struct { // Name - Operation name: {provider}/{resource}/{operation} @@ -2120,7 +2755,7 @@ type Operation struct { Display *OperationDisplay `json:"display,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // OperationDisplay display metadata associated with the operation. type OperationDisplay struct { // Provider - Service provider: Microsoft.Insights @@ -2131,7 +2766,7 @@ type OperationDisplay struct { Operation *string `json:"operation,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of // operations and a URL link to get the next set of results. type OperationListResult struct { @@ -2142,7 +2777,7 @@ type OperationListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ProxyOnlyResource a proxy only azure resource object type ProxyOnlyResource struct { // ID - Azure resource Id @@ -2153,17 +2788,17 @@ type ProxyOnlyResource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate element // is used. type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' + // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' Frequency RecurrenceFrequency `json:"frequency,omitempty"` // Schedule - the scheduling constraints for when the profile begins. Schedule *RecurrentSchedule `json:"schedule,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RecurrentSchedule the scheduling constraints for when the profile begins. type RecurrentSchedule struct { // TimeZone - the timezone for the hours of the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time @@ -2176,7 +2811,7 @@ type RecurrentSchedule struct { Minutes *[]int32 `json:"minutes,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // Resource an azure resource object type Resource struct { // ID - Azure resource Id @@ -2191,7 +2826,7 @@ type Resource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2213,7 +2848,21 @@ func (r Resource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// Response the response to a metrics query. +type Response struct { + autorest.Response `json:"-"` + // Cost - The integer value representing the cost of the query, for data case. + Cost *float64 `json:"cost,omitempty"` + // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + Timespan *string `json:"timespan,omitempty"` + // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + Interval *string `json:"interval,omitempty"` + // Value - the value of the collection. + Value *[]Metric `json:"value,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RetentionPolicy specifies the retention policy for the log. type RetentionPolicy struct { // Enabled - a value indicating whether the retention policy is enabled. @@ -2222,7 +2871,7 @@ type RetentionPolicy struct { Days *int32 `json:"days,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is // resolved. type BasicRuleAction interface { @@ -2231,7 +2880,7 @@ type BasicRuleAction interface { AsRuleAction() (*RuleAction, bool) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is // resolved. type RuleAction struct { @@ -2280,7 +2929,7 @@ func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { return raArray, nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for RuleAction. func (ra RuleAction) MarshalJSON() ([]byte, error) { ra.OdataType = OdataTypeRuleAction @@ -2291,31 +2940,31 @@ func (ra RuleAction) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleAction is the BasicRuleAction implementation for RuleAction. func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { return &ra, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { return &ra, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // BasicRuleCondition the condition that results in the alert rule being activated. type BasicRuleCondition interface { AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) @@ -2324,7 +2973,7 @@ type BasicRuleCondition interface { AsRuleCondition() (*RuleCondition, bool) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleCondition the condition that results in the alert rule being activated. type RuleCondition struct { // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. @@ -2378,7 +3027,7 @@ func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) return rcArray, nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for RuleCondition. func (rc RuleCondition) MarshalJSON() ([]byte, error) { rc.OdataType = OdataTypeRuleCondition @@ -2390,37 +3039,37 @@ func (rc RuleCondition) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { return &rc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { return &rc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for RuleCondition struct. func (rc *RuleCondition) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2453,7 +3102,7 @@ func (rc *RuleCondition) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // BasicRuleDataSource the resource from which the rule collects its data. type BasicRuleDataSource interface { AsRuleMetricDataSource() (*RuleMetricDataSource, bool) @@ -2461,7 +3110,7 @@ type BasicRuleDataSource interface { AsRuleDataSource() (*RuleDataSource, bool) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleDataSource the resource from which the rule collects its data. type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. @@ -2511,7 +3160,7 @@ func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, erro return rdsArray, nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for RuleDataSource. func (rds RuleDataSource) MarshalJSON() ([]byte, error) { rds.OdataType = OdataTypeRuleDataSource @@ -2525,31 +3174,31 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { return &rds, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { return &rds, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleEmailAction specifies the action to send email when the rule condition is evaluated. The discriminator is // always RuleEmailAction in this case. type RuleEmailAction struct { @@ -2561,7 +3210,7 @@ type RuleEmailAction struct { OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for RuleEmailAction. func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction @@ -2578,38 +3227,38 @@ func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { return &rea, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { return &rea, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleManagementEventClaimsDataSource the claims for a rule management event data source. type RuleManagementEventClaimsDataSource struct { // EmailAddress - the email address. EmailAddress *string `json:"emailAddress,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleManagementEventDataSource a rule management event data source. The discriminator fields is always // RuleManagementEventDataSource in this case. type RuleManagementEventDataSource struct { @@ -2637,7 +3286,7 @@ type RuleManagementEventDataSource struct { OdataType OdataType `json:"odata.type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for RuleManagementEventDataSource. func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource @@ -2678,31 +3327,31 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { return &rmeds, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { return &rmeds, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource in this // case. type RuleMetricDataSource struct { @@ -2714,7 +3363,7 @@ type RuleMetricDataSource struct { OdataType OdataType `json:"odata.type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for RuleMetricDataSource. func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource @@ -2731,31 +3380,31 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { return &rmds, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { return &rmds, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The // discriminator is always RuleWebhookAction in this case. type RuleWebhookAction struct { @@ -2767,7 +3416,7 @@ type RuleWebhookAction struct { OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for RuleWebhookAction. func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction @@ -2784,31 +3433,31 @@ func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { return &rwa, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { return &rwa, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ScaleAction the parameters for the scaling action. type ScaleAction struct { // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' @@ -2821,7 +3470,7 @@ type ScaleAction struct { Cooldown *string `json:"cooldown,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ScaleCapacity the number of instances that can be used during this profile. type ScaleCapacity struct { // Minimum - the minimum number of instances for the resource. @@ -2832,7 +3481,7 @@ type ScaleCapacity struct { Default *string `json:"default,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ScaleRule a rule that provide the triggers and parameters for the scaling action. type ScaleRule struct { // MetricTrigger - the trigger that results in a scaling action. @@ -2841,7 +3490,19 @@ type ScaleRule struct { ScaleAction *ScaleAction `json:"scaleAction,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// SenderAuthorization the authorization used by the user who has performed the operation that led to this event. +// This captures the RBAC properties of the event. These usually include the 'action', 'role' and the 'scope' +type SenderAuthorization struct { + // Action - the permissible actions. For instance: microsoft.support/supporttickets/write + Action *string `json:"action,omitempty"` + // Role - the role of the user. For instance: Subscription Admin + Role *string `json:"role,omitempty"` + // Scope - the scope. + Scope *string `json:"scope,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // SmsReceiver an SMS receiver. type SmsReceiver struct { // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. @@ -2854,7 +3515,7 @@ type SmsReceiver struct { Status ReceiverStatus `json:"status,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ThresholdRuleCondition a rule condition based on a metric crossing a threshold. type ThresholdRuleCondition struct { // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' @@ -2871,7 +3532,7 @@ type ThresholdRuleCondition struct { OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for ThresholdRuleCondition. func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition @@ -2895,37 +3556,37 @@ func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { return &trc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { return nil, false } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { return &trc, true } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2994,7 +3655,27 @@ func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. +type TimeSeriesElement struct { + // Metadatavalues - the metadata values returned if $filter was specified in the call. + Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` + // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. + Data *[]MetricValue `json:"data,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// TimeSeriesInformation the time series info needed for calculating the baseline. +type TimeSeriesInformation struct { + // Sensitivities - the list of sensitivities for calculating the baseline. + Sensitivities *[]string `json:"sensitivities,omitempty"` + // Values - The metric values to calculate the baseline. + Values *[]float64 `json:"values,omitempty"` + // Timestamps - the array of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // TimeWindow a specific date-time for the profile. type TimeWindow struct { // TimeZone - the timezone of the start and end times for the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time @@ -3005,7 +3686,18 @@ type TimeWindow struct { End *date.Time `json:"end,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// VoiceReceiver a voice receiver. +type VoiceReceiver struct { + // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // CountryCode - The country code of the voice receiver. + CountryCode *string `json:"countryCode,omitempty"` + // PhoneNumber - The phone number of the voice receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // WebhookNotification webhook notification of an autoscale event. type WebhookNotification struct { // ServiceURI - the service address to receive the notification. @@ -3014,7 +3706,7 @@ type WebhookNotification struct { Properties map[string]*string `json:"properties"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // MarshalJSON is the custom marshaler for WebhookNotification. func (wn WebhookNotification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -3027,7 +3719,7 @@ func (wn WebhookNotification) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // WebhookReceiver a webhook receiver. type WebhookReceiver struct { // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/operations.go similarity index 89% rename from vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/operations.go index 0f8daa94860ab..beb2e31aa8edf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/operations.go @@ -24,25 +24,25 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // OperationsClient is the monitor Management Client type OperationsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewOperationsClient creates an instance of the OperationsClient client. func NewOperationsClient(subscriptionID string) OperationsClient { return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // List lists all of the available operations from Microsoft.Insights provider. func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { req, err := client.ListPreparer(ctx) @@ -66,7 +66,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { const APIVersion = "2015-04-01" @@ -82,7 +82,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // 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) { @@ -90,7 +90,7 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // 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) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go new file mode 100644 index 0000000000000..474a715d93276 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go @@ -0,0 +1,160 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// TenantActivityLogsClient is the monitor Management Client +type TenantActivityLogsClient struct { + BaseClient +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. +func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { + return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient client. +func NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { + return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for +// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that +// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that +// were generated at the tenant level. +// +// filter is reduces the set of data collected.
The **$filter** is very restricted and allows only the +// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and +// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq +// ''.
- List events for resource: $filter=eventTimestamp ge '' and +// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq ''.
- +// List events for a subscription: $filter=eventTimestamp ge '' and eventTimestamp le '' and +// eventChannels eq 'Admin, Operation'.
- List events for a resource provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceProvider eq +// ''.
- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp +// ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq +// 'Admin, Operation' and correlationId eq ''.
**NOTE**: No other syntax is allowed. +// selectParameter is used to fetch events with only the given properties.
The **$select** argument is a comma +// separated list of property names to be returned. Possible values are: *authorization*, *claims*, +// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, +// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, +// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* +func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.edc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") + return + } + + result.edc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") + } + + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListPreparer prepares the List request. +func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TenantActivityLogsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 TenantActivityLogsClient) listNextResults(lastResults EventDataCollection) (result EventDataCollection, err error) { + req, err := lastResults.eventDataCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { + result.page, err = client.List(ctx, filter, selectParameter) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/version.go similarity index 84% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/version.go index 1403fb37098ce..c37c069c8367e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights/version.go @@ -1,4 +1,4 @@ -package sql +package insights import "github.com/Azure/azure-sdk-for-go/version" @@ -18,13 +18,13 @@ import "github.com/Azure/azure-sdk-for-go/version" // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " sql/2015-05-01-preview" + return "Azure-SDK-For-Go/" + version.Number + " insights/2018-03-01" } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. +// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights instead. // 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/mysql/mgmt/2017-04-30-preview/mysql/performancetiers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/performancetiers.go deleted file mode 100644 index c7db15a3fee52..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/performancetiers.go +++ /dev/null @@ -1,103 +0,0 @@ -package mysql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// 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" - "net/http" -) - -// PerformanceTiersClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. -type PerformanceTiersClient struct { - BaseClient -} - -// NewPerformanceTiersClient creates an instance of the PerformanceTiersClient client. -func NewPerformanceTiersClient(subscriptionID string) PerformanceTiersClient { - return NewPerformanceTiersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPerformanceTiersClientWithBaseURI creates an instance of the PerformanceTiersClient client. -func NewPerformanceTiersClientWithBaseURI(baseURI string, subscriptionID string) PerformanceTiersClient { - return PerformanceTiersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all the performance tiers in a given subscription. -func (client PerformanceTiersClient) List(ctx context.Context) (result PerformanceTierListResult, err error) { - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PerformanceTiersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.PerformanceTiersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PerformanceTiersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PerformanceTiersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/performanceTiers", 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 PerformanceTiersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PerformanceTiersClient) ListResponder(resp *http.Response) (result PerformanceTierListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - 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/mysql/mgmt/2017-04-30-preview/mysql/checknameavailability.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/checknameavailability.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/checknameavailability.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/checknameavailability.go index 022a9d003c1bc..aff51201d0826 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/checknameavailability.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/checknameavailability.go @@ -26,7 +26,8 @@ import ( ) // CheckNameAvailabilityClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and +// configurations with new business model. type CheckNameAvailabilityClient struct { BaseClient } @@ -42,8 +43,8 @@ func NewCheckNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID st } // Execute check the availability of name for resource -// -// nameAvailabilityRequest is the required parameters for checking if resource name is available. +// Parameters: +// nameAvailabilityRequest - the required parameters for checking if resource name is available. func (client CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (result NameAvailability, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: nameAvailabilityRequest, @@ -78,7 +79,7 @@ func (client CheckNameAvailabilityClient) ExecutePreparer(ctx context.Context, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/client.go similarity index 92% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/client.go index 8fb41d952da22..97fc51c4a1980 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/client.go @@ -1,7 +1,7 @@ -// Package mysql implements the Azure ARM Mysql service API version 2017-04-30-preview. +// Package mysql implements the Azure ARM Mysql service API version 2017-12-01. // // The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources -// including servers, databases, firewall rules, log files and configurations. +// including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. package mysql // Copyright (c) Microsoft and contributors. All rights reserved. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/configurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/configurations.go similarity index 87% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/configurations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/configurations.go index 7840739c65937..c2d669c9dc883 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/configurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/configurations.go @@ -25,7 +25,8 @@ import ( ) // ConfigurationsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and +// configurations with new business model. type ConfigurationsClient struct { BaseClient } @@ -41,10 +42,12 @@ func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) C } // CreateOrUpdate updates a configuration of a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. configurationName is the -// name of the server configuration. parameters is the required parameters for updating a server configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// configurationName - the name of the server configuration. +// parameters - the required parameters for updating a server configuration. func (client ConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, configurationName, parameters) if err != nil { @@ -70,7 +73,7 @@ func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +91,17 @@ func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, r // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -114,10 +119,11 @@ func (client ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) } // Get gets information about a configuration of server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. configurationName is the -// name of the server configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// configurationName - the name of the server configuration. func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, configurationName) if err != nil { @@ -149,7 +155,7 @@ func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -183,9 +189,10 @@ func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Con } // ListByServer list all the configurations in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ConfigurationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ConfigurationListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -216,7 +223,7 @@ func (client ConfigurationsClient) ListByServerPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/databases.go similarity index 85% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/databases.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/databases.go index 52f2fbb2965ad..d659483733bcb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/databases.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/databases.go @@ -25,7 +25,8 @@ import ( ) // DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +// for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations +// with new business model. type DatabasesClient struct { BaseClient } @@ -41,10 +42,12 @@ func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) Databa } // CreateOrUpdate creates a new database or updates an existing database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. parameters is the required parameters for creating or updating a database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// parameters - the required parameters for creating or updating a database. func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -70,7 +73,7 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +91,17 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -114,10 +119,11 @@ func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (resu } // Delete deletes a database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -143,7 +149,7 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,15 +165,17 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -184,10 +192,11 @@ func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autor } // Get gets information about a database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -219,7 +228,7 @@ func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -253,9 +262,10 @@ func (client DatabasesClient) GetResponder(resp *http.Response) (result Database } // ListByServer list all the databases in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -286,7 +296,7 @@ func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/firewallrules.go similarity index 86% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/firewallrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/firewallrules.go index 04bd6a3b66558..528aeaa2f0052 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/firewallrules.go @@ -26,7 +26,8 @@ import ( ) // FirewallRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and +// configurations with new business model. type FirewallRulesClient struct { BaseClient } @@ -42,10 +43,12 @@ func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) Fi } // CreateOrUpdate creates a new firewall rule or updates an existing firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the server firewall rule. parameters is the required parameters for creating or updating a firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the server firewall rule. +// parameters - the required parameters for creating or updating a firewall rule. func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRulesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -82,7 +85,7 @@ func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -100,15 +103,17 @@ func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, re // 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) (future FirewallRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -126,10 +131,11 @@ func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) ( } // Delete deletes a server firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the server firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the server firewall rule. func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRulesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) if err != nil { @@ -155,7 +161,7 @@ func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -171,15 +177,17 @@ func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGr // 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) (future FirewallRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -196,10 +204,11 @@ func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result a } // Get gets information about a server firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the server firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the server firewall rule. func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) if err != nil { @@ -231,7 +240,7 @@ func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -265,9 +274,10 @@ func (client FirewallRulesClient) GetResponder(resp *http.Response) (result Fire } // ListByServer list all the firewall rules in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -298,7 +308,7 @@ func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/locationbasedperformancetier.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/locationbasedperformancetier.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/locationbasedperformancetier.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/locationbasedperformancetier.go index be6a669bbf666..16c645ad8ba43 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/locationbasedperformancetier.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/locationbasedperformancetier.go @@ -25,8 +25,8 @@ import ( ) // LocationBasedPerformanceTierClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure MySQL resources including servers, databases, firewall rules, log files and -// configurations. +// delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files +// and configurations with new business model. type LocationBasedPerformanceTierClient struct { BaseClient } @@ -43,8 +43,8 @@ func NewLocationBasedPerformanceTierClientWithBaseURI(baseURI string, subscripti } // List list all the performance tiers at specified location in a given subscription. -// -// locationName is the name of the location. +// Parameters: +// locationName - the name of the location. func (client LocationBasedPerformanceTierClient) List(ctx context.Context, locationName string) (result PerformanceTierListResult, err error) { req, err := client.ListPreparer(ctx, locationName) if err != nil { @@ -74,7 +74,7 @@ func (client LocationBasedPerformanceTierClient) ListPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/logfiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/logfiles.go similarity index 92% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/logfiles.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/logfiles.go index 85edf75deff7d..ef252ba46bc14 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/logfiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/logfiles.go @@ -25,7 +25,8 @@ import ( ) // LogFilesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +// Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with +// new business model. type LogFilesClient struct { BaseClient } @@ -41,9 +42,10 @@ func NewLogFilesClientWithBaseURI(baseURI string, subscriptionID string) LogFile } // ListByServer list all the log files in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client LogFilesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result LogFileListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -74,7 +76,7 @@ func (client LogFilesClient) ListByServerPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/models.go similarity index 66% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/models.go index c4196a8ad5497..2511603f4c7e6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/models.go @@ -22,6 +22,7 @@ import ( "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" "net/http" ) @@ -31,6 +32,8 @@ type CreateMode string const ( // CreateModeDefault ... CreateModeDefault CreateMode = "Default" + // CreateModeGeoRestore ... + CreateModeGeoRestore CreateMode = "GeoRestore" // CreateModePointInTimeRestore ... CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" // CreateModeServerPropertiesForCreate ... @@ -39,7 +42,22 @@ const ( // PossibleCreateModeValues returns an array of possible values for the CreateMode const type. func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeDefault, CreateModePointInTimeRestore, CreateModeServerPropertiesForCreate} + return []CreateMode{CreateModeDefault, CreateModeGeoRestore, CreateModePointInTimeRestore, CreateModeServerPropertiesForCreate} +} + +// GeoRedundantBackup enumerates the values for geo redundant backup. +type GeoRedundantBackup string + +const ( + // Disabled ... + Disabled GeoRedundantBackup = "Disabled" + // Enabled ... + Enabled GeoRedundantBackup = "Enabled" +) + +// PossibleGeoRedundantBackupValues returns an array of possible values for the GeoRedundantBackup const type. +func PossibleGeoRedundantBackupValues() []GeoRedundantBackup { + return []GeoRedundantBackup{Disabled, Enabled} } // OperationOrigin enumerates the values for operation origin. @@ -63,17 +81,17 @@ func PossibleOperationOriginValues() []OperationOrigin { type ServerState string const ( - // Disabled ... - Disabled ServerState = "Disabled" - // Dropping ... - Dropping ServerState = "Dropping" - // Ready ... - Ready ServerState = "Ready" + // ServerStateDisabled ... + ServerStateDisabled ServerState = "Disabled" + // ServerStateDropping ... + ServerStateDropping ServerState = "Dropping" + // ServerStateReady ... + ServerStateReady ServerState = "Ready" ) // PossibleServerStateValues returns an array of possible values for the ServerState const type. func PossibleServerStateValues() []ServerState { - return []ServerState{Disabled, Dropping, Ready} + return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady} } // ServerVersion enumerates the values for server version. @@ -97,13 +115,15 @@ type SkuTier string const ( // Basic ... Basic SkuTier = "Basic" - // Standard ... - Standard SkuTier = "Standard" + // GeneralPurpose ... + GeneralPurpose SkuTier = "GeneralPurpose" + // MemoryOptimized ... + MemoryOptimized SkuTier = "MemoryOptimized" ) // PossibleSkuTierValues returns an array of possible values for the SkuTier const type. func PossibleSkuTierValues() []SkuTier { - return []SkuTier{Basic, Standard} + return []SkuTier{Basic, GeneralPurpose, MemoryOptimized} } // SslEnforcementEnum enumerates the values for ssl enforcement enum. @@ -121,6 +141,27 @@ func PossibleSslEnforcementEnumValues() []SslEnforcementEnum { return []SslEnforcementEnum{SslEnforcementEnumDisabled, SslEnforcementEnumEnabled} } +// VirtualNetworkRuleState enumerates the values for virtual network rule state. +type VirtualNetworkRuleState string + +const ( + // Deleting ... + Deleting VirtualNetworkRuleState = "Deleting" + // Initializing ... + Initializing VirtualNetworkRuleState = "Initializing" + // InProgress ... + InProgress VirtualNetworkRuleState = "InProgress" + // Ready ... + Ready VirtualNetworkRuleState = "Ready" + // Unknown ... + Unknown VirtualNetworkRuleState = "Unknown" +) + +// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. +func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { + return []VirtualNetworkRuleState{Deleting, Initializing, InProgress, Ready, Unknown} +} + // Configuration represents a Configuration. type Configuration struct { autorest.Response `json:"-"` @@ -230,12 +271,11 @@ type ConfigurationProperties struct { // operation. type ConfigurationsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ConfigurationsCreateOrUpdateFuture) Result(client ConfigurationsClient) (c Configuration, err error) { +func (future *ConfigurationsCreateOrUpdateFuture) Result(client ConfigurationsClient) (c Configuration, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -243,34 +283,15 @@ func (future ConfigurationsCreateOrUpdateFuture) Result(client ConfigurationsCli return } if !done { - return c, azure.NewAsyncOpIncompleteError("mysql.ConfigurationsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - c, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.ConfigurationsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - c, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -376,12 +397,11 @@ type DatabaseProperties struct { // operation. type DatabasesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -389,34 +409,15 @@ func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Da return } if !done { - return d, azure.NewAsyncOpIncompleteError("mysql.DatabasesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - d, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.DatabasesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - d, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -424,12 +425,11 @@ func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Da // DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DatabasesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { +func (future *DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -437,35 +437,10 @@ func (future DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest. return } if !done { - return ar, azure.NewAsyncOpIncompleteError("mysql.DatabasesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.DatabasesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -570,12 +545,11 @@ type FirewallRuleProperties struct { // operation. type FirewallRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClient) (fr FirewallRule, err error) { +func (future *FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClient) (fr FirewallRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -583,34 +557,15 @@ func (future FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClien return } if !done { - return fr, azure.NewAsyncOpIncompleteError("mysql.FirewallRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.FirewallRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { + fr, err = client.CreateOrUpdateResponder(fr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - fr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -618,12 +573,11 @@ func (future FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClien // FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type FirewallRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FirewallRulesDeleteFuture) Result(client FirewallRulesClient) (ar autorest.Response, err error) { +func (future *FirewallRulesDeleteFuture) Result(client FirewallRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -631,35 +585,10 @@ func (future FirewallRulesDeleteFuture) Result(client FirewallRulesClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("mysql.FirewallRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.FirewallRulesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -753,8 +682,6 @@ type LogFileListResult struct { // LogFileProperties the properties of a log file. type LogFileProperties struct { - // Name - Log file name. - Name *string `json:"name,omitempty"` // SizeInKB - Size of the log file. SizeInKB *int64 `json:"sizeInKB,omitempty"` // CreatedTime - Creation timestamp of the log file. @@ -846,8 +773,6 @@ type PerformanceTierListResult struct { type PerformanceTierProperties struct { // ID - ID of the performance tier. ID *string `json:"id,omitempty"` - // BackupRetentionDays - Backup retention in days for the performance tier edition - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` // ServiceLevelObjectives - Service level objectives associated with the performance tier ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` } @@ -858,10 +783,18 @@ type PerformanceTierServiceLevelObjectives struct { ID *string `json:"id,omitempty"` // Edition - Edition of the performance tier. Edition *string `json:"edition,omitempty"` - // Dtu - Database throughput unit associated with the service level objective - Dtu *int32 `json:"dtu,omitempty"` - // StorageMB - Maximum storage in MB associated with the service level objective - StorageMB *int32 `json:"storageMB,omitempty"` + // VCore - vCore associated with the service level objective + VCore *int32 `json:"vCore,omitempty"` + // HardwareGeneration - Hardware generation associated with the service level objective + HardwareGeneration *string `json:"hardwareGeneration,omitempty"` + // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition + MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` + // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition + MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` + // MaxStorageMB - Max storage allowed for a server. + MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` + // MinStorageMB - Max storage allowed for a server. + MinStorageMB *int32 `json:"minStorageMB,omitempty"` } // ProxyResource resource properties. @@ -1087,34 +1020,37 @@ type ServerListResult struct { type ServerProperties struct { // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). AdministratorLogin *string `json:"administratorLogin,omitempty"` - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // UserVisibleState - A state of a server that is visible to user. Possible values include: 'Ready', 'Dropping', 'Disabled' + // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled' UserVisibleState ServerState `json:"userVisibleState,omitempty"` // FullyQualifiedDomainName - The fully qualified domain name of a server. FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + // EarliestRestoreDate - Earliest restore point creation time (ISO8601 format) + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` } // BasicServerPropertiesForCreate the properties used to create a new server. type BasicServerPropertiesForCreate interface { AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) + AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) } // ServerPropertiesForCreate the properties used to create a new server. type ServerPropertiesForCreate struct { - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore' + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' CreateMode CreateMode `json:"createMode,omitempty"` } @@ -1134,6 +1070,10 @@ func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerProperties var spfr ServerPropertiesForRestore err := json.Unmarshal(body, &spfr) return spfr, err + case string(CreateModeGeoRestore): + var spfgr ServerPropertiesForGeoRestore + err := json.Unmarshal(body, &spfgr) + return spfgr, err default: var spfc ServerPropertiesForCreate err := json.Unmarshal(body, &spfc) @@ -1163,15 +1103,15 @@ func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPro func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { spfc.CreateMode = CreateModeServerPropertiesForCreate objectMap := make(map[string]interface{}) - if spfc.StorageMB != nil { - objectMap["storageMB"] = spfc.StorageMB - } if spfc.Version != "" { objectMap["version"] = spfc.Version } if spfc.SslEnforcement != "" { objectMap["sslEnforcement"] = spfc.SslEnforcement } + if spfc.StorageProfile != nil { + objectMap["storageProfile"] = spfc.StorageProfile + } if spfc.CreateMode != "" { objectMap["createMode"] = spfc.CreateMode } @@ -1188,6 +1128,11 @@ func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPro return nil, false } +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. +func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return nil, false +} + // AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { return &spfc, true @@ -1204,13 +1149,13 @@ type ServerPropertiesForDefaultCreate struct { AdministratorLogin *string `json:"administratorLogin,omitempty"` // AdministratorLoginPassword - The password of the administrator login. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore' + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' CreateMode CreateMode `json:"createMode,omitempty"` } @@ -1224,15 +1169,15 @@ func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { if spfdc.AdministratorLoginPassword != nil { objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword } - if spfdc.StorageMB != nil { - objectMap["storageMB"] = spfdc.StorageMB - } if spfdc.Version != "" { objectMap["version"] = spfdc.Version } if spfdc.SslEnforcement != "" { objectMap["sslEnforcement"] = spfdc.SslEnforcement } + if spfdc.StorageProfile != nil { + objectMap["storageProfile"] = spfdc.StorageProfile + } if spfdc.CreateMode != "" { objectMap["createMode"] = spfdc.CreateMode } @@ -1249,6 +1194,11 @@ func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*S return nil, false } +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. +func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return nil, false +} + // AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { return nil, false @@ -1259,19 +1209,81 @@ func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() return &spfdc, true } -// ServerPropertiesForRestore the properties to a new server by restoring from a backup. +// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different region from +// a geo replicated backup. +type ServerPropertiesForGeoRestore struct { + // SourceServerID - The source server id to restore from. + SourceServerID *string `json:"sourceServerId,omitempty"` + // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' + Version ServerVersion `json:"version,omitempty"` + // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' + CreateMode CreateMode `json:"createMode,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { + spfgr.CreateMode = CreateModeGeoRestore + objectMap := make(map[string]interface{}) + if spfgr.SourceServerID != nil { + objectMap["sourceServerId"] = spfgr.SourceServerID + } + if spfgr.Version != "" { + objectMap["version"] = spfgr.Version + } + if spfgr.SslEnforcement != "" { + objectMap["sslEnforcement"] = spfgr.SslEnforcement + } + if spfgr.StorageProfile != nil { + objectMap["storageProfile"] = spfgr.StorageProfile + } + if spfgr.CreateMode != "" { + objectMap["createMode"] = spfgr.CreateMode + } + return json.Marshal(objectMap) +} + +// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { + return nil, false +} + +// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { + return nil, false +} + +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return &spfgr, true +} + +// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { + return nil, false +} + +// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { + return &spfgr, true +} + +// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup. type ServerPropertiesForRestore struct { // SourceServerID - The source server id to restore from. SourceServerID *string `json:"sourceServerId,omitempty"` // RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from. RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore' + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' CreateMode CreateMode `json:"createMode,omitempty"` } @@ -1285,15 +1297,15 @@ func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { if spfr.RestorePointInTime != nil { objectMap["restorePointInTime"] = spfr.RestorePointInTime } - if spfr.StorageMB != nil { - objectMap["storageMB"] = spfr.StorageMB - } if spfr.Version != "" { objectMap["version"] = spfr.Version } if spfr.SslEnforcement != "" { objectMap["sslEnforcement"] = spfr.SslEnforcement } + if spfr.StorageProfile != nil { + objectMap["storageProfile"] = spfr.StorageProfile + } if spfr.CreateMode != "" { objectMap["createMode"] = spfr.CreateMode } @@ -1310,6 +1322,11 @@ func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPr return &spfr, true } +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. +func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return nil, false +} + // AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { return nil, false @@ -1320,51 +1337,30 @@ func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (Basic return &spfr, true } -// ServersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersCreateOrUpdateFuture struct { +// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ServersCreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersCreateOrUpdateFuture) Result(client ServersClient) (s Server, err error) { +func (future *ServersCreateFuture) Result(client ServersClient) (s Server, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "mysql.ServersCreateFuture", "Result", future.Response(), "Polling failure") return } if !done { - return s, azure.NewAsyncOpIncompleteError("mysql.ServersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.ServersCreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.CreateResponder(s.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "mysql.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1372,12 +1368,11 @@ func (future ServersCreateOrUpdateFuture) Result(client ServersClient) (s Server // ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) { +func (future *ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1385,47 +1380,21 @@ func (future ServersDeleteFuture) Result(client ServersClient) (ar autorest.Resp return } if !done { - return ar, azure.NewAsyncOpIncompleteError("mysql.ServersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.ServersDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersUpdateFuture) Result(client ServersClient) (s Server, err error) { +func (future *ServersUpdateFuture) Result(client ServersClient) (s Server, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1433,34 +1402,15 @@ func (future ServersUpdateFuture) Result(client ServersClient) (s Server, err er return } if !done { - return s, azure.NewAsyncOpIncompleteError("mysql.ServersUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("mysql.ServersUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1534,8 +1484,8 @@ func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { // ServerUpdateParametersProperties the properties that can be updated for a server. type ServerUpdateParametersProperties struct { - // StorageMB - The max storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // AdministratorLoginPassword - The password of the administrator login. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` // Version - The version of a server. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' @@ -1546,9 +1496,9 @@ type ServerUpdateParametersProperties struct { // Sku billing information related properties of a server. type Sku struct { - // Name - The name of the sku, typically, a letter + Number code, e.g. P3. + // Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'Standard' + // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' Tier SkuTier `json:"tier,omitempty"` // Capacity - The scale up/out capacity, representing server's compute units. Capacity *int32 `json:"capacity,omitempty"` @@ -1558,6 +1508,16 @@ type Sku struct { Family *string `json:"family,omitempty"` } +// StorageProfile storage Profile properties of a server +type StorageProfile struct { + // BackupRetentionDays - Backup retention days for the server. + BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` + // GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled' + GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` + // StorageMB - Max storage allowed for a server. + StorageMB *int32 `json:"storageMB,omitempty"` +} + // TrackedResource resource properties including location and tags for track resources. type TrackedResource struct { // Location - The location the resource resides in. @@ -1592,3 +1552,249 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { } return json.Marshal(objectMap) } + +// VirtualNetworkRule a virtual network rule. +type VirtualNetworkRule struct { + autorest.Response `json:"-"` + // VirtualNetworkRuleProperties - Resource properties. + *VirtualNetworkRuleProperties `json:"properties,omitempty"` + // ID - Resource ID + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkRule. +func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnr.VirtualNetworkRuleProperties != nil { + objectMap["properties"] = vnr.VirtualNetworkRuleProperties + } + if vnr.ID != nil { + objectMap["id"] = vnr.ID + } + if vnr.Name != nil { + objectMap["name"] = vnr.Name + } + if vnr.Type != nil { + objectMap["type"] = vnr.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. +func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkRuleProperties VirtualNetworkRuleProperties + err = json.Unmarshal(*v, &virtualNetworkRuleProperties) + if err != nil { + return err + } + vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnr.Type = &typeVar + } + } + } + + return nil +} + +// VirtualNetworkRuleListResult a list of virtual network rules. +type VirtualNetworkRuleListResult struct { + autorest.Response `json:"-"` + // Value - Array of results. + Value *[]VirtualNetworkRule `json:"value,omitempty"` + // NextLink - Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. +type VirtualNetworkRuleListResultIterator struct { + i int + page VirtualNetworkRuleListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkRuleListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { + if !iter.page.NotDone() { + return VirtualNetworkRule{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { + return vnrlr.Value == nil || len(*vnrlr.Value) == 0 +} + +// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer() (*http.Request, error) { + if vnrlr.NextLink == nil || len(to.String(vnrlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnrlr.NextLink))) +} + +// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. +type VirtualNetworkRuleListResultPage struct { + fn func(VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) + vnrlr VirtualNetworkRuleListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkRuleListResultPage) Next() error { + next, err := page.fn(page.vnrlr) + if err != nil { + return err + } + page.vnrlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkRuleListResultPage) NotDone() bool { + return !page.vnrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { + return page.vnrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { + if page.vnrlr.IsEmpty() { + return nil + } + return *page.vnrlr.Value +} + +// VirtualNetworkRuleProperties properties of a virtual network rule. +type VirtualNetworkRuleProperties struct { + // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. + VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` + // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + // State - Virtual Network Rule State. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + State VirtualNetworkRuleState `json:"state,omitempty"` +} + +// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkRulesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualNetworkRulesCreateOrUpdateFuture) Result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("mysql.VirtualNetworkRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { + vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualNetworkRulesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualNetworkRulesDeleteFuture) Result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("mysql.VirtualNetworkRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/operations.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/operations.go index 921148785f335..6c36b558e70c0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/operations.go @@ -25,7 +25,8 @@ import ( ) // OperationsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +// for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations +// with new business model. type OperationsClient struct { BaseClient } @@ -65,7 +66,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/servers.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/servers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/servers.go index fc22975e6e6dc..66b2f6678ffa1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/servers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/servers.go @@ -26,7 +26,8 @@ import ( ) // ServersClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MySQL resources including servers, databases, firewall rules, log files and configurations. +// Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with +// new business model. type ServersClient struct { BaseClient } @@ -41,51 +42,48 @@ func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersC return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates a new server or updates an existing server. The update action will overwrite the existing -// server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the required -// parameters for creating or updating a server. -func (client ServersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (result ServersCreateOrUpdateFuture, err error) { +// Create creates a new server or updates an existing server. The update action will overwrite the existing server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for creating or updating a server. +func (client ServersClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (result ServersCreateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, }}, - {Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.InclusiveMinimum, Rule: 1024, Chain: nil}}}, - }}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "CreateOrUpdate", err.Error()) + return result, validation.NewError("mysql.ServersClient", "Create", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) + req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Create", nil, "Failure preparing request") return } - result, err = client.CreateOrUpdateSender(req) + result, err = client.CreateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Create", result.Response(), "Failure sending request") return } return } -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (*http.Request, error) { +// CreatePreparer prepares the Create request. +func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -100,24 +98,26 @@ func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resource return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. -func (client ServersClient) CreateOrUpdateSender(req *http.Request) (future ServersCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) +func (client ServersClient) CreateSender(req *http.Request) (future ServersCreateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// CreateResponder handles the response to the Create request. The method always // closes the http.Response Body. -func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, err error) { +func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -129,9 +129,10 @@ func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result } // Delete deletes a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -156,7 +157,7 @@ func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -172,15 +173,17 @@ func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupNam // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -197,9 +200,10 @@ func (client ServersClient) DeleteResponder(resp *http.Response) (result autores } // Get gets information about a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -230,7 +234,7 @@ func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -292,7 +296,7 @@ func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, er "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,9 +330,9 @@ func (client ServersClient) ListResponder(resp *http.Response) (result ServerLis } // ListByResourceGroup list all the servers in a given resource group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResult, err error) { req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -358,7 +362,7 @@ func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -393,10 +397,11 @@ func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (r // Update updates an existing server. The request body can contain one to many of the properties present in the normal // server definition. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the required -// parameters for updating a server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for updating a server. func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (result ServersUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { @@ -421,7 +426,7 @@ func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -439,15 +444,17 @@ func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupNam // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/version.go similarity index 93% rename from vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/version.go index 91fde84c3b824..c59c0a27bf6d9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " mysql/2017-04-30-preview" + return "Azure-SDK-For-Go/" + version.Number + " mysql/2017-12-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/virtualnetworkrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/virtualnetworkrules.go new file mode 100644 index 0000000000000..99b70e42de663 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql/virtualnetworkrules.go @@ -0,0 +1,366 @@ +package mysql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// VirtualNetworkRulesClient is the the Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and +// configurations with new business model. +type VirtualNetworkRulesClient struct { + BaseClient +} + +// NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. +func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { + return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient client. +func NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { + return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an existing virtual network rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. +// parameters - the requested virtual Network Rule Resource state. +func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("mysql.VirtualNetworkRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), + } + + const APIVersion = "2017-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.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the virtual network rule with the given name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. +func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), + } + + const APIVersion = "2017-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.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a virtual network rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. +func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), + } + + const APIVersion = "2017-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.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of virtual network rules in a server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { + result.fn = client.listByServerNextResults + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.vnrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure sending request") + return + } + + result.vnrlr, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforMySQL/servers/{serverName}/virtualNetworkRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByServerNextResults retrieves the next set of results, if any. +func (client VirtualNetworkRulesClient) listByServerNextResults(lastResults VirtualNetworkRuleListResult) (result VirtualNetworkRuleListResult, err error) { + req, err := lastResults.virtualNetworkRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { + result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/applicationgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/applicationgateways.go similarity index 93% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/applicationgateways.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/applicationgateways.go index 7206327b0cee7..e697a3fe0937f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/applicationgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/applicationgateways.go @@ -69,7 +69,7 @@ func (client ApplicationGatewaysClient) BackendHealthPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +88,17 @@ func (client ApplicationGatewaysClient) BackendHealthPreparer(ctx context.Contex // BackendHealthSender sends the BackendHealth request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (future ApplicationGatewaysBackendHealthFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -126,6 +128,10 @@ func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, reso Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMinimum, Rule: 8, Chain: nil}, + }}, }}, }}}}}); err != nil { return result, validation.NewError("network.ApplicationGatewaysClient", "CreateOrUpdate", err.Error()) @@ -154,7 +160,7 @@ func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -172,15 +178,17 @@ func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ApplicationGatewaysCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -225,7 +233,7 @@ func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -241,15 +249,17 @@ func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, reso // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (future ApplicationGatewaysDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -299,7 +309,7 @@ func (client ApplicationGatewaysClient) GetPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -364,7 +374,7 @@ func (client ApplicationGatewaysClient) GetSslPredefinedPolicyPreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -430,7 +440,7 @@ func (client ApplicationGatewaysClient) ListPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -520,7 +530,7 @@ func (client ApplicationGatewaysClient) ListAllPreparer(ctx context.Context) (*h "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -609,7 +619,7 @@ func (client ApplicationGatewaysClient) ListAvailableSslOptionsPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -672,7 +682,7 @@ func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesPrepar "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -761,7 +771,7 @@ func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -822,7 +832,7 @@ func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -838,15 +848,17 @@ func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resou // StartSender sends the Start request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) StartSender(req *http.Request) (future ApplicationGatewaysStartFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -890,7 +902,7 @@ func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -906,15 +918,17 @@ func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resour // StopSender sends the Stop request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) StopSender(req *http.Request) (future ApplicationGatewaysStopFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -959,7 +973,7 @@ func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -977,15 +991,17 @@ func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) UpdateTagsSender(req *http.Request) (future ApplicationGatewaysUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/applicationsecuritygroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/applicationsecuritygroups.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/applicationsecuritygroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/applicationsecuritygroups.go index 133c1552c7e9b..6a200feca3b2c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/applicationsecuritygroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/applicationsecuritygroups.go @@ -68,7 +68,7 @@ func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,15 +86,17 @@ func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(ctx context // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ApplicationSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationSecurityGroupsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -139,7 +141,7 @@ func (client ApplicationSecurityGroupsClient) DeletePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,15 +157,17 @@ func (client ApplicationSecurityGroupsClient) DeletePreparer(ctx context.Context // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ApplicationSecurityGroupsClient) DeleteSender(req *http.Request) (future ApplicationSecurityGroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -213,7 +217,7 @@ func (client ApplicationSecurityGroupsClient) GetPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -279,7 +283,7 @@ func (client ApplicationSecurityGroupsClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -369,7 +373,7 @@ func (client ApplicationSecurityGroupsClient) ListAllPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/availableendpointservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/availableendpointservices.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/availableendpointservices.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/availableendpointservices.go index 33c9771c97c27..644244d34ce96 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/availableendpointservices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/availableendpointservices.go @@ -72,7 +72,7 @@ func (client AvailableEndpointServicesClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/bgpservicecommunities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/bgpservicecommunities.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/bgpservicecommunities.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/bgpservicecommunities.go index d05553742ab60..3cce20d6a3f67 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/bgpservicecommunities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/bgpservicecommunities.go @@ -69,7 +69,7 @@ func (client BgpServiceCommunitiesClient) ListPreparer(ctx context.Context) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/client.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/client.go index 3358b99754422..d45d54dcf4575 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/client.go @@ -87,7 +87,7 @@ func (client BaseClient) CheckDNSNameAvailabilityPreparer(ctx context.Context, l "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, "domainNameLabel": autorest.Encode("query", domainNameLabel), diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/connectionmonitors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/connectionmonitors.go new file mode 100644 index 0000000000000..72025998bef98 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/connectionmonitors.go @@ -0,0 +1,552 @@ +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ConnectionMonitorsClient is the network Client +type ConnectionMonitorsClient struct { + BaseClient +} + +// NewConnectionMonitorsClient creates an instance of the ConnectionMonitorsClient client. +func NewConnectionMonitorsClient(subscriptionID string) ConnectionMonitorsClient { + return NewConnectionMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConnectionMonitorsClientWithBaseURI creates an instance of the ConnectionMonitorsClient client. +func NewConnectionMonitorsClientWithBaseURI(baseURI string, subscriptionID string) ConnectionMonitorsClient { + return ConnectionMonitorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +// parameters - parameters that define the operation to create a connection monitor. +func (client ConnectionMonitorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor) (result ConnectionMonitorsCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Source", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Source.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ConnectionMonitorParameters.Destination", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.ConnectionMonitorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConnectionMonitorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", 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 ConnectionMonitorsClient) CreateOrUpdateSender(req *http.Request) (future ConnectionMonitorsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionMonitorResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConnectionMonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", 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 ConnectionMonitorsClient) DeleteSender(req *http.Request) (future ConnectionMonitorsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a connection monitor by name. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorResult, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "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.ConnectionMonitorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectionMonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + 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/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", 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 ConnectionMonitorsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) GetResponder(resp *http.Response) (result ConnectionMonitorResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all connection monitors for the specified Network Watcher. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +func (client ConnectionMonitorsClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result ConnectionMonitorListResult, err error) { + req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ConnectionMonitorsClient) ListPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + 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/networkWatchers/{networkWatcherName}/connectionMonitors", 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 ConnectionMonitorsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) ListResponder(resp *http.Response) (result ConnectionMonitorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Query query a snapshot of the most recent connection states. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name given to the connection monitor. +func (client ConnectionMonitorsClient) Query(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsQueryFuture, err error) { + req, err := client.QueryPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Query", nil, "Failure preparing request") + return + } + + result, err = client.QuerySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Query", result.Response(), "Failure sending request") + return + } + + return +} + +// QueryPreparer prepares the Query request. +func (client ConnectionMonitorsClient) QueryPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// QuerySender sends the Query request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) QuerySender(req *http.Request) (future ConnectionMonitorsQueryFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// QueryResponder handles the response to the Query request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) QueryResponder(resp *http.Response) (result ConnectionMonitorQueryResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts the specified connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Start(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStartFuture, err error) { + req, err := client.StartPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ConnectionMonitorsClient) StartPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/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 ConnectionMonitorsClient) StartSender(req *http.Request) (future ConnectionMonitorsStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops the specified connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStopFuture, err error) { + req, err := client.StopPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ConnectionMonitorsClient) StopPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/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 ConnectionMonitorsClient) StopSender(req *http.Request) (future ConnectionMonitorsStopFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/ddosprotectionplans.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/ddosprotectionplans.go new file mode 100644 index 0000000000000..dff8aa645af93 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/ddosprotectionplans.go @@ -0,0 +1,434 @@ +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// DdosProtectionPlansClient is the network Client +type DdosProtectionPlansClient struct { + BaseClient +} + +// NewDdosProtectionPlansClient creates an instance of the DdosProtectionPlansClient client. +func NewDdosProtectionPlansClient(subscriptionID string) DdosProtectionPlansClient { + return NewDdosProtectionPlansClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDdosProtectionPlansClientWithBaseURI creates an instance of the DdosProtectionPlansClient client. +func NewDdosProtectionPlansClientWithBaseURI(baseURI string, subscriptionID string) DdosProtectionPlansClient { + return DdosProtectionPlansClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a DDoS protection plan. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosProtectionPlanName - the name of the DDoS protection plan. +// parameters - parameters supplied to the create or update operation. +func (client DdosProtectionPlansClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan) (result DdosProtectionPlansCreateOrUpdateFuture, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ddosProtectionPlanName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DdosProtectionPlansClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosProtectionPlanName": autorest.Encode("path", ddosProtectionPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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.Network/ddosProtectionPlans/{ddosProtectionPlanName}", 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 DdosProtectionPlansClient) CreateOrUpdateSender(req *http.Request) (future DdosProtectionPlansCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) CreateOrUpdateResponder(resp *http.Response) (result DdosProtectionPlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified DDoS protection plan. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosProtectionPlanName - the name of the DDoS protection plan. +func (client DdosProtectionPlansClient) Delete(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (result DdosProtectionPlansDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, ddosProtectionPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DdosProtectionPlansClient) DeletePreparer(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosProtectionPlanName": autorest.Encode("path", ddosProtectionPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/ddosProtectionPlans/{ddosProtectionPlanName}", 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 DdosProtectionPlansClient) DeleteSender(req *http.Request) (future DdosProtectionPlansDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified DDoS protection plan. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosProtectionPlanName - the name of the DDoS protection plan. +func (client DdosProtectionPlansClient) Get(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (result DdosProtectionPlan, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, ddosProtectionPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "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.DdosProtectionPlansClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DdosProtectionPlansClient) GetPreparer(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosProtectionPlanName": autorest.Encode("path", ddosProtectionPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + 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/ddosProtectionPlans/{ddosProtectionPlanName}", 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 DdosProtectionPlansClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) GetResponder(resp *http.Response) (result DdosProtectionPlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all DDoS protection plans in a subscription. +func (client DdosProtectionPlansClient) List(ctx context.Context) (result DdosProtectionPlanListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dpplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "List", resp, "Failure sending request") + return + } + + result.dpplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DdosProtectionPlansClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans", 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 DdosProtectionPlansClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) ListResponder(resp *http.Response) (result DdosProtectionPlanListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 DdosProtectionPlansClient) listNextResults(lastResults DdosProtectionPlanListResult) (result DdosProtectionPlanListResult, err error) { + req, err := lastResults.ddosProtectionPlanListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "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.DdosProtectionPlansClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DdosProtectionPlansClient) ListComplete(ctx context.Context) (result DdosProtectionPlanListResultIterator, err error) { + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all the DDoS protection plans in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client DdosProtectionPlansClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DdosProtectionPlanListResultPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dpplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dpplr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DdosProtectionPlansClient) 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-04-01" + 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/ddosProtectionPlans", 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 DdosProtectionPlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) ListByResourceGroupResponder(resp *http.Response) (result DdosProtectionPlanListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 DdosProtectionPlansClient) listByResourceGroupNextResults(lastResults DdosProtectionPlanListResult) (result DdosProtectionPlanListResult, err error) { + req, err := lastResults.ddosProtectionPlanListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "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, "network.DdosProtectionPlansClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DdosProtectionPlansClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DdosProtectionPlanListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/defaultsecurityrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/defaultsecurityrules.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/defaultsecurityrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/defaultsecurityrules.go index 6d42c7f8f666a..e9b67604bb695 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/defaultsecurityrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/defaultsecurityrules.go @@ -75,7 +75,7 @@ func (client DefaultSecurityRulesClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -143,7 +143,7 @@ func (client DefaultSecurityRulesClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuitauthorizations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitauthorizations.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuitauthorizations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitauthorizations.go index 8e947afac02f8..68b111b938da6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuitauthorizations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitauthorizations.go @@ -73,7 +73,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -91,15 +91,17 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -146,7 +148,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,15 +164,17 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -222,7 +226,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -290,7 +294,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitconnections.go new file mode 100644 index 0000000000000..9755bb3364781 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitconnections.go @@ -0,0 +1,265 @@ +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ExpressRouteCircuitConnectionsClient is the network Client +type ExpressRouteCircuitConnectionsClient struct { + BaseClient +} + +// NewExpressRouteCircuitConnectionsClient creates an instance of the ExpressRouteCircuitConnectionsClient client. +func NewExpressRouteCircuitConnectionsClient(subscriptionID string) ExpressRouteCircuitConnectionsClient { + return NewExpressRouteCircuitConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitConnectionsClientWithBaseURI creates an instance of the ExpressRouteCircuitConnectionsClient +// client. +func NewExpressRouteCircuitConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitConnectionsClient { + return ExpressRouteCircuitConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Express Route Circuit Connection in the specified express route circuits. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// connectionName - the name of the express route circuit connection. +// expressRouteCircuitConnectionParameters - parameters supplied to the create or update express route circuit +// circuit connection operation. +func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection) (result ExpressRouteCircuitConnectionsCreateOrUpdateFuture, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "connectionName": autorest.Encode("path", connectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", pathParameters), + autorest.WithJSON(expressRouteCircuitConnectionParameters), + 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 ExpressRouteCircuitConnectionsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Express Route Circuit Connection from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// connectionName - the name of the express route circuit connection. +func (client ExpressRouteCircuitConnectionsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result ExpressRouteCircuitConnectionsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, peeringName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "connectionName": autorest.Encode("path", connectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", 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 ExpressRouteCircuitConnectionsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitConnectionsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Express Route Circuit Connection from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// connectionName - the name of the express route circuit connection. +func (client ExpressRouteCircuitConnectionsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result ExpressRouteCircuitConnection, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, peeringName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "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.ExpressRouteCircuitConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "connectionName": autorest.Encode("path", connectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + 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/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", 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 ExpressRouteCircuitConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitConnectionsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/network/mgmt/2017-09-01/network/expressroutecircuitpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitpeerings.go similarity index 89% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuitpeerings.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitpeerings.go index 5813098efc781..c35da42b365e2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuitpeerings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuitpeerings.go @@ -21,6 +21,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) @@ -46,6 +47,17 @@ func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptio // peeringName - the name of the peering. // peeringParameters - parameters supplied to the create or update express route circuit peering operation. func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (result ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: peeringParameters, + Constraints: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", err.Error()) + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, peeringName, peeringParameters) if err != nil { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") @@ -70,7 +82,7 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +100,17 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -143,7 +157,7 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,15 +173,17 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Conte // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitPeeringsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -219,7 +235,7 @@ func (client ExpressRouteCircuitPeeringsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -287,7 +303,7 @@ func (client ExpressRouteCircuitPeeringsClient) ListPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuits.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuits.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuits.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuits.go index add90435b89db..0549350fbd2a2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressroutecircuits.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecircuits.go @@ -68,7 +68,7 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,15 +86,17 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Cont // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -139,7 +141,7 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,15 +157,17 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, res // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -213,7 +217,7 @@ func (client ExpressRouteCircuitsClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -282,7 +286,7 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -349,7 +353,7 @@ func (client ExpressRouteCircuitsClient) GetStatsPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -415,7 +419,7 @@ func (client ExpressRouteCircuitsClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -505,7 +509,7 @@ func (client ExpressRouteCircuitsClient) ListAllPreparer(ctx context.Context) (* "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -597,7 +601,7 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -613,15 +617,17 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Contex // ListArpTableSender sends the ListArpTable request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCircuitsListArpTableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -671,7 +677,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -687,15 +693,17 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Con // ListRoutesTableSender sends the ListRoutesTable request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -745,7 +753,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -761,15 +769,17 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx cont // ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -815,7 +825,7 @@ func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -833,15 +843,17 @@ func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) UpdateTagsSender(req *http.Request) (future ExpressRouteCircuitsUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecrossconnectionpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecrossconnectionpeerings.go new file mode 100644 index 0000000000000..207b272ff0e25 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecrossconnectionpeerings.go @@ -0,0 +1,367 @@ +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ExpressRouteCrossConnectionPeeringsClient is the network Client +type ExpressRouteCrossConnectionPeeringsClient struct { + BaseClient +} + +// NewExpressRouteCrossConnectionPeeringsClient creates an instance of the ExpressRouteCrossConnectionPeeringsClient +// client. +func NewExpressRouteCrossConnectionPeeringsClient(subscriptionID string) ExpressRouteCrossConnectionPeeringsClient { + return NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCrossConnectionPeeringsClientWithBaseURI creates an instance of the +// ExpressRouteCrossConnectionPeeringsClient client. +func NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCrossConnectionPeeringsClient { + return ExpressRouteCrossConnectionPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a peering in the specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// peeringParameters - parameters supplied to the create or update ExpressRouteCrossConnection peering +// operation. +func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering) (result ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: peeringParameters, + Constraints: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties.PeerASN", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties.PeerASN", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties.PeerASN", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.ExpressRouteCrossConnectionPeeringsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, peeringParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", pathParameters), + autorest.WithJSON(peeringParameters), + 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 ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCrossConnectionPeering, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified peering from the ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +func (client ExpressRouteCrossConnectionPeeringsClient) Delete(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (result ExpressRouteCrossConnectionPeeringsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, crossConnectionName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCrossConnectionPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", 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 ExpressRouteCrossConnectionPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCrossConnectionPeeringsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified peering for the ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +func (client ExpressRouteCrossConnectionPeeringsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (result ExpressRouteCrossConnectionPeering, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, crossConnectionName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "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.ExpressRouteCrossConnectionPeeringsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCrossConnectionPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + 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/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", 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 ExpressRouteCrossConnectionPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) GetResponder(resp *http.Response) (result ExpressRouteCrossConnectionPeering, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all peerings in a specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +func (client ExpressRouteCrossConnectionPeeringsClient) List(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnectionPeeringListPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, crossConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erccpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "List", resp, "Failure sending request") + return + } + + result.erccpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCrossConnectionPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + 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/expressRouteCrossConnections/{crossConnectionName}/peerings", 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 ExpressRouteCrossConnectionPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) ListResponder(resp *http.Response) (result ExpressRouteCrossConnectionPeeringList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ExpressRouteCrossConnectionPeeringsClient) listNextResults(lastResults ExpressRouteCrossConnectionPeeringList) (result ExpressRouteCrossConnectionPeeringList, err error) { + req, err := lastResults.expressRouteCrossConnectionPeeringListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "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.ExpressRouteCrossConnectionPeeringsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCrossConnectionPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnectionPeeringListIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, crossConnectionName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecrossconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecrossconnections.go new file mode 100644 index 0000000000000..85457ebf75c11 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressroutecrossconnections.go @@ -0,0 +1,667 @@ +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ExpressRouteCrossConnectionsClient is the network Client +type ExpressRouteCrossConnectionsClient struct { + BaseClient +} + +// NewExpressRouteCrossConnectionsClient creates an instance of the ExpressRouteCrossConnectionsClient client. +func NewExpressRouteCrossConnectionsClient(subscriptionID string) ExpressRouteCrossConnectionsClient { + return NewExpressRouteCrossConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCrossConnectionsClientWithBaseURI creates an instance of the ExpressRouteCrossConnectionsClient +// client. +func NewExpressRouteCrossConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCrossConnectionsClient { + return ExpressRouteCrossConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate update the specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// parameters - parameters supplied to the update express route crossConnection operation. +func (client ExpressRouteCrossConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (result ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, crossConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCrossConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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.Network/expressRouteCrossConnections/{crossConnectionName}", 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 ExpressRouteCrossConnectionsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets details about the specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group (peering location of the circuit). +// crossConnectionName - the name of the ExpressRouteCrossConnection (service key of the circuit). +func (client ExpressRouteCrossConnectionsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnection, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, crossConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "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.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCrossConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + 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/expressRouteCrossConnections/{crossConnectionName}", 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 ExpressRouteCrossConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) GetResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves all the ExpressRouteCrossConnections in a subscription. +func (client ExpressRouteCrossConnectionsClient) List(ctx context.Context) (result ExpressRouteCrossConnectionListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ercclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.ercclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCrossConnectionsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections", 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 ExpressRouteCrossConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ExpressRouteCrossConnectionsClient) listNextResults(lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) { + req, err := lastResults.expressRouteCrossConnectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "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.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCrossConnectionsClient) ListComplete(ctx context.Context) (result ExpressRouteCrossConnectionListResultIterator, err error) { + result.page, err = client.List(ctx) + return +} + +// ListArpTable gets the currently advertised ARP table associated with the express route cross connection in a +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// devicePath - the path of the device +func (client ExpressRouteCrossConnectionsClient) ListArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListArpTableFuture, err error) { + req, err := client.ListArpTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", nil, "Failure preparing request") + return + } + + result, err = client.ListArpTableSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", result.Response(), "Failure sending request") + return + } + + return +} + +// ListArpTablePreparer prepares the ListArpTable request. +func (client ExpressRouteCrossConnectionsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListArpTableSender sends the ListArpTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListArpTableFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ListArpTableResponder handles the response to the ListArpTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup retrieves all the ExpressRouteCrossConnections in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ercclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ercclr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ExpressRouteCrossConnectionsClient) 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-04-01" + 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/expressRouteCrossConnections", 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 ExpressRouteCrossConnectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ExpressRouteCrossConnectionsClient) listByResourceGroupNextResults(lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) { + req, err := lastResults.expressRouteCrossConnectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "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, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListRoutesTable gets the currently advertised routes table associated with the express route cross connection in a +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableFuture, err error) { + req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", nil, "Failure preparing request") + return + } + + result, err = client.ListRoutesTableSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", result.Response(), "Failure sending request") + return + } + + return +} + +// ListRoutesTablePreparer prepares the ListRoutesTable request. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRoutesTableSender sends the ListRoutesTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRoutesTableSummary gets the route table summary associated with the express route cross connection in a resource +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) { + req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", nil, "Failure preparing request") + return + } + + result, err = client.ListRoutesTableSummarySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", result.Response(), "Failure sending request") + return + } + + return +} + +// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates an express route cross connection tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the cross connection. +// crossConnectionParameters - parameters supplied to update express route cross connection tags. +func (client ExpressRouteCrossConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (result ExpressRouteCrossConnectionsUpdateTagsFuture, err error) { + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, crossConnectionName, crossConnectionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ExpressRouteCrossConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-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/expressRouteCrossConnections/{crossConnectionName}", pathParameters), + autorest.WithJSON(crossConnectionParameters), + 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 ExpressRouteCrossConnectionsClient) UpdateTagsSender(req *http.Request) (future ExpressRouteCrossConnectionsUpdateTagsFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/network/mgmt/2017-09-01/network/expressrouteserviceproviders.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressrouteserviceproviders.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressrouteserviceproviders.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressrouteserviceproviders.go index fa7749078b641..2ef9137b81f01 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/expressrouteserviceproviders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/expressrouteserviceproviders.go @@ -70,7 +70,7 @@ func (client ExpressRouteServiceProvidersClient) ListPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/inboundnatrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/inboundnatrules.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/inboundnatrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/inboundnatrules.go index 3820400e26e79..d1330fe9bc052 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/inboundnatrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/inboundnatrules.go @@ -90,7 +90,7 @@ func (client InboundNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -108,15 +108,17 @@ func (client InboundNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client InboundNatRulesClient) CreateOrUpdateSender(req *http.Request) (future InboundNatRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -163,7 +165,7 @@ func (client InboundNatRulesClient) DeletePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -179,15 +181,17 @@ func (client InboundNatRulesClient) DeletePreparer(ctx context.Context, resource // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client InboundNatRulesClient) DeleteSender(req *http.Request) (future InboundNatRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -240,7 +244,7 @@ func (client InboundNatRulesClient) GetPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -311,7 +315,7 @@ func (client InboundNatRulesClient) ListPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaceipconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaceipconfigurations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaceipconfigurations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaceipconfigurations.go index 98599a39a7045..b47e7744098ca 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaceipconfigurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaceipconfigurations.go @@ -75,7 +75,7 @@ func (client InterfaceIPConfigurationsClient) GetPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -143,7 +143,7 @@ func (client InterfaceIPConfigurationsClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaceloadbalancers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaceloadbalancers.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaceloadbalancers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaceloadbalancers.go index 1e817547c4217..75e521e81a8da 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaceloadbalancers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaceloadbalancers.go @@ -74,7 +74,7 @@ func (client InterfaceLoadBalancersClient) ListPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaces.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaces.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaces.go index 55a0fe6d9cf4b..a72e773300ec1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/interfaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/interfaces.go @@ -68,7 +68,7 @@ func (client InterfacesClient) CreateOrUpdatePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,15 +86,17 @@ func (client InterfacesClient) CreateOrUpdatePreparer(ctx context.Context, resou // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (future InterfacesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -139,7 +141,7 @@ func (client InterfacesClient) DeletePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,15 +157,17 @@ func (client InterfacesClient) DeletePreparer(ctx context.Context, resourceGroup // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) DeleteSender(req *http.Request) (future InterfacesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -214,7 +218,7 @@ func (client InterfacesClient) GetPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -278,7 +282,7 @@ func (client InterfacesClient) GetEffectiveRouteTablePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -294,15 +298,17 @@ func (client InterfacesClient) GetEffectiveRouteTablePreparer(ctx context.Contex // GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (future InterfacesGetEffectiveRouteTableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -505,7 +511,7 @@ func (client InterfacesClient) ListPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -595,7 +601,7 @@ func (client InterfacesClient) ListAllPreparer(ctx context.Context) (*http.Reque "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -683,7 +689,7 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -699,15 +705,17 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(ctx co // ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (future InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1050,7 +1058,7 @@ func (client InterfacesClient) UpdateTagsPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1068,15 +1076,17 @@ func (client InterfacesClient) UpdateTagsPreparer(ctx context.Context, resourceG // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) UpdateTagsSender(req *http.Request) (future InterfacesUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerbackendaddresspools.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerbackendaddresspools.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerbackendaddresspools.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerbackendaddresspools.go index ea449f5b71748..4d3024656a66a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerbackendaddresspools.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerbackendaddresspools.go @@ -76,7 +76,7 @@ func (client LoadBalancerBackendAddressPoolsClient) GetPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -144,7 +144,7 @@ func (client LoadBalancerBackendAddressPoolsClient) ListPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerfrontendipconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerfrontendipconfigurations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerfrontendipconfigurations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerfrontendipconfigurations.go index 142a7f8636432..6c54b8a1e1430 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerfrontendipconfigurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerfrontendipconfigurations.go @@ -77,7 +77,7 @@ func (client LoadBalancerFrontendIPConfigurationsClient) GetPreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -145,7 +145,7 @@ func (client LoadBalancerFrontendIPConfigurationsClient) ListPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerloadbalancingrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerloadbalancingrules.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerloadbalancingrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerloadbalancingrules.go index afc0d13884ab7..931c9d05618ed 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerloadbalancingrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerloadbalancingrules.go @@ -76,7 +76,7 @@ func (client LoadBalancerLoadBalancingRulesClient) GetPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -144,7 +144,7 @@ func (client LoadBalancerLoadBalancingRulesClient) ListPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancernetworkinterfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancernetworkinterfaces.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancernetworkinterfaces.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancernetworkinterfaces.go index 0ec6f68d06245..0ab02d9bf324f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancernetworkinterfaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancernetworkinterfaces.go @@ -75,7 +75,7 @@ func (client LoadBalancerNetworkInterfacesClient) ListPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerprobes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerprobes.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerprobes.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerprobes.go index 55a86c7da98f1..9cfa13ded3ec6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancerprobes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancerprobes.go @@ -75,7 +75,7 @@ func (client LoadBalancerProbesClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -143,7 +143,7 @@ func (client LoadBalancerProbesClient) ListPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancers.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancers.go index d2706bd2bea34..ed6509e9681f6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/loadbalancers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/loadbalancers.go @@ -68,7 +68,7 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,15 +86,17 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(ctx context.Context, re // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (future LoadBalancersCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -139,7 +141,7 @@ func (client LoadBalancersClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,15 +157,17 @@ func (client LoadBalancersClient) DeletePreparer(ctx context.Context, resourceGr // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) DeleteSender(req *http.Request) (future LoadBalancersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -214,7 +218,7 @@ func (client LoadBalancersClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -283,7 +287,7 @@ func (client LoadBalancersClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -373,7 +377,7 @@ func (client LoadBalancersClient) ListAllPreparer(ctx context.Context) (*http.Re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -462,7 +466,7 @@ func (client LoadBalancersClient) UpdateTagsPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -480,15 +484,17 @@ func (client LoadBalancersClient) UpdateTagsPreparer(ctx context.Context, resour // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) UpdateTagsSender(req *http.Request) (future LoadBalancersUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/localnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/localnetworkgateways.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/localnetworkgateways.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/localnetworkgateways.go index 7872ca81439c5..386ed2e43ae6e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/localnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/localnetworkgateways.go @@ -77,7 +77,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -95,15 +95,17 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Cont // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future LocalNetworkGatewaysCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -154,7 +156,7 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -170,15 +172,17 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, res // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (future LocalNetworkGatewaysDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -234,7 +238,7 @@ func (client LocalNetworkGatewaysClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -300,7 +304,7 @@ func (client LocalNetworkGatewaysClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -395,7 +399,7 @@ func (client LocalNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -413,15 +417,17 @@ func (client LocalNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future LocalNetworkGatewaysUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/models.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/models.go index 15cf9c6f03359..647dd9674c0ab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/models.go @@ -374,6 +374,57 @@ func PossibleBgpPeerStateValues() []BgpPeerState { return []BgpPeerState{BgpPeerStateConnected, BgpPeerStateConnecting, BgpPeerStateIdle, BgpPeerStateStopped, BgpPeerStateUnknown} } +// CircuitConnectionStatus enumerates the values for circuit connection status. +type CircuitConnectionStatus string + +const ( + // Connected ... + Connected CircuitConnectionStatus = "Connected" + // Connecting ... + Connecting CircuitConnectionStatus = "Connecting" + // Disconnected ... + Disconnected CircuitConnectionStatus = "Disconnected" +) + +// PossibleCircuitConnectionStatusValues returns an array of possible values for the CircuitConnectionStatus const type. +func PossibleCircuitConnectionStatusValues() []CircuitConnectionStatus { + return []CircuitConnectionStatus{Connected, Connecting, Disconnected} +} + +// ConnectionMonitorSourceStatus enumerates the values for connection monitor source status. +type ConnectionMonitorSourceStatus string + +const ( + // Active ... + Active ConnectionMonitorSourceStatus = "Active" + // Inactive ... + Inactive ConnectionMonitorSourceStatus = "Inactive" + // Uknown ... + Uknown ConnectionMonitorSourceStatus = "Uknown" +) + +// PossibleConnectionMonitorSourceStatusValues returns an array of possible values for the ConnectionMonitorSourceStatus const type. +func PossibleConnectionMonitorSourceStatusValues() []ConnectionMonitorSourceStatus { + return []ConnectionMonitorSourceStatus{Active, Inactive, Uknown} +} + +// 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 @@ -458,15 +509,15 @@ func PossibleEffectiveRouteSourceValues() []EffectiveRouteSource { type EffectiveRouteState string const ( - // Active ... - Active EffectiveRouteState = "Active" - // Invalid ... - Invalid EffectiveRouteState = "Invalid" + // 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{Active, Invalid} + return []EffectiveRouteState{EffectiveRouteStateActive, EffectiveRouteStateInvalid} } // EffectiveSecurityRuleProtocol enumerates the values for effective security rule protocol. @@ -486,6 +537,23 @@ func PossibleEffectiveSecurityRuleProtocolValues() []EffectiveSecurityRuleProtoc return []EffectiveSecurityRuleProtocol{All, TCP, UDP} } +// EvaluationState enumerates the values for evaluation state. +type EvaluationState string + +const ( + // Completed ... + Completed EvaluationState = "Completed" + // InProgress ... + InProgress EvaluationState = "InProgress" + // NotStarted ... + NotStarted EvaluationState = "NotStarted" +) + +// PossibleEvaluationStateValues returns an array of possible values for the EvaluationState const type. +func PossibleEvaluationStateValues() []EvaluationState { + return []EvaluationState{Completed, InProgress, NotStarted} +} + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixState enumerates the values for express route circuit // peering advertised public prefix state. type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string @@ -521,23 +589,6 @@ func PossibleExpressRouteCircuitPeeringStateValues() []ExpressRouteCircuitPeerin return []ExpressRouteCircuitPeeringState{ExpressRouteCircuitPeeringStateDisabled, ExpressRouteCircuitPeeringStateEnabled} } -// ExpressRouteCircuitPeeringType enumerates the values for express route circuit peering type. -type ExpressRouteCircuitPeeringType string - -const ( - // AzurePrivatePeering ... - AzurePrivatePeering ExpressRouteCircuitPeeringType = "AzurePrivatePeering" - // AzurePublicPeering ... - AzurePublicPeering ExpressRouteCircuitPeeringType = "AzurePublicPeering" - // MicrosoftPeering ... - MicrosoftPeering ExpressRouteCircuitPeeringType = "MicrosoftPeering" -) - -// PossibleExpressRouteCircuitPeeringTypeValues returns an array of possible values for the ExpressRouteCircuitPeeringType const type. -func PossibleExpressRouteCircuitPeeringTypeValues() []ExpressRouteCircuitPeeringType { - return []ExpressRouteCircuitPeeringType{AzurePrivatePeering, AzurePublicPeering, MicrosoftPeering} -} - // ExpressRouteCircuitSkuFamily enumerates the values for express route circuit sku family. type ExpressRouteCircuitSkuFamily string @@ -568,6 +619,51 @@ func PossibleExpressRouteCircuitSkuTierValues() []ExpressRouteCircuitSkuTier { return []ExpressRouteCircuitSkuTier{ExpressRouteCircuitSkuTierPremium, ExpressRouteCircuitSkuTierStandard} } +// 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 ( + // AzurePrivatePeering ... + AzurePrivatePeering ExpressRoutePeeringType = "AzurePrivatePeering" + // AzurePublicPeering ... + AzurePublicPeering ExpressRoutePeeringType = "AzurePublicPeering" + // MicrosoftPeering ... + MicrosoftPeering ExpressRoutePeeringType = "MicrosoftPeering" +) + +// PossibleExpressRoutePeeringTypeValues returns an array of possible values for the ExpressRoutePeeringType const type. +func PossibleExpressRoutePeeringTypeValues() []ExpressRoutePeeringType { + return []ExpressRoutePeeringType{AzurePrivatePeering, AzurePublicPeering, MicrosoftPeering} +} + +// HTTPMethod enumerates the values for http method. +type HTTPMethod string + +const ( + // Get ... + Get HTTPMethod = "Get" +) + +// PossibleHTTPMethodValues returns an array of possible values for the HTTPMethod const type. +func PossibleHTTPMethodValues() []HTTPMethod { + return []HTTPMethod{Get} +} + // IkeEncryption enumerates the values for ike encryption. type IkeEncryption string @@ -582,30 +678,38 @@ const ( DES IkeEncryption = "DES" // DES3 ... DES3 IkeEncryption = "DES3" + // GCMAES128 ... + GCMAES128 IkeEncryption = "GCMAES128" + // GCMAES256 ... + GCMAES256 IkeEncryption = "GCMAES256" ) // PossibleIkeEncryptionValues returns an array of possible values for the IkeEncryption const type. func PossibleIkeEncryptionValues() []IkeEncryption { - return []IkeEncryption{AES128, AES192, AES256, DES, DES3} + return []IkeEncryption{AES128, AES192, AES256, DES, DES3, GCMAES128, GCMAES256} } // IkeIntegrity enumerates the values for ike integrity. type IkeIntegrity string const ( - // MD5 ... - MD5 IkeIntegrity = "MD5" - // SHA1 ... - SHA1 IkeIntegrity = "SHA1" - // SHA256 ... - SHA256 IkeIntegrity = "SHA256" - // SHA384 ... - SHA384 IkeIntegrity = "SHA384" + // 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{MD5, SHA1, SHA256, SHA384} + return []IkeIntegrity{IkeIntegrityGCMAES128, IkeIntegrityGCMAES256, IkeIntegrityMD5, IkeIntegritySHA1, IkeIntegritySHA256, IkeIntegritySHA384} } // IPAllocationMethod enumerates the values for ip allocation method. @@ -623,6 +727,21 @@ func PossibleIPAllocationMethodValues() []IPAllocationMethod { return []IPAllocationMethod{Dynamic, Static} } +// 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} +} + // IpsecEncryption enumerates the values for ipsec encryption. type IpsecEncryption string @@ -778,17 +897,17 @@ func PossibleNextHopTypeValues() []NextHopType { type OperationStatus string const ( - // Failed ... - Failed OperationStatus = "Failed" - // InProgress ... - InProgress OperationStatus = "InProgress" - // Succeeded ... - Succeeded OperationStatus = "Succeeded" + // 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{Failed, InProgress, Succeeded} + return []OperationStatus{OperationStatusFailed, OperationStatusInProgress, OperationStatusSucceeded} } // Origin enumerates the values for origin. @@ -879,17 +998,21 @@ const ( 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, PfsGroupPFS2, PfsGroupPFS2048, PfsGroupPFS24} + return []PfsGroup{PfsGroupECP256, PfsGroupECP384, PfsGroupNone, PfsGroupPFS1, PfsGroupPFS14, PfsGroupPFS2, PfsGroupPFS2048, PfsGroupPFS24, PfsGroupPFSMM} } // ProbeProtocol enumerates the values for probe protocol. @@ -898,13 +1021,15 @@ 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, ProbeProtocolTCP} + return []ProbeProtocol{ProbeProtocolHTTP, ProbeProtocolHTTPS, ProbeProtocolTCP} } // ProcessorArchitecture enumerates the values for processor architecture. @@ -926,34 +1051,38 @@ func PossibleProcessorArchitectureValues() []ProcessorArchitecture { type Protocol string const ( + // ProtocolHTTP ... + ProtocolHTTP Protocol = "Http" + // ProtocolHTTPS ... + ProtocolHTTPS Protocol = "Https" + // ProtocolIcmp ... + ProtocolIcmp Protocol = "Icmp" // ProtocolTCP ... - ProtocolTCP Protocol = "TCP" - // ProtocolUDP ... - ProtocolUDP Protocol = "UDP" + ProtocolTCP Protocol = "Tcp" ) // PossibleProtocolValues returns an array of possible values for the Protocol const type. func PossibleProtocolValues() []Protocol { - return []Protocol{ProtocolTCP, ProtocolUDP} + return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolIcmp, ProtocolTCP} } // 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" + // Deleting ... + Deleting ProvisioningState = "Deleting" + // Failed ... + Failed ProvisioningState = "Failed" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" + // Updating ... + Updating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} + return []ProvisioningState{Deleting, Failed, Succeeded, Updating} } // PublicIPAddressSkuName enumerates the values for public ip address sku name. @@ -1134,6 +1263,12 @@ 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 ... @@ -1142,15 +1277,21 @@ const ( 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" ) // PossibleVirtualNetworkGatewaySkuNameValues returns an array of possible values for the VirtualNetworkGatewaySkuName const type. func PossibleVirtualNetworkGatewaySkuNameValues() []VirtualNetworkGatewaySkuName { - return []VirtualNetworkGatewaySkuName{VirtualNetworkGatewaySkuNameBasic, VirtualNetworkGatewaySkuNameHighPerformance, VirtualNetworkGatewaySkuNameStandard, VirtualNetworkGatewaySkuNameUltraPerformance, VirtualNetworkGatewaySkuNameVpnGw1, VirtualNetworkGatewaySkuNameVpnGw2, VirtualNetworkGatewaySkuNameVpnGw3} + return []VirtualNetworkGatewaySkuName{VirtualNetworkGatewaySkuNameBasic, VirtualNetworkGatewaySkuNameErGw1AZ, VirtualNetworkGatewaySkuNameErGw2AZ, VirtualNetworkGatewaySkuNameErGw3AZ, VirtualNetworkGatewaySkuNameHighPerformance, VirtualNetworkGatewaySkuNameStandard, VirtualNetworkGatewaySkuNameUltraPerformance, VirtualNetworkGatewaySkuNameVpnGw1, VirtualNetworkGatewaySkuNameVpnGw1AZ, VirtualNetworkGatewaySkuNameVpnGw2, VirtualNetworkGatewaySkuNameVpnGw2AZ, VirtualNetworkGatewaySkuNameVpnGw3, VirtualNetworkGatewaySkuNameVpnGw3AZ} } // VirtualNetworkGatewaySkuTier enumerates the values for virtual network gateway sku tier. @@ -1159,6 +1300,12 @@ 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 ... @@ -1167,15 +1314,21 @@ const ( 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" ) // PossibleVirtualNetworkGatewaySkuTierValues returns an array of possible values for the VirtualNetworkGatewaySkuTier const type. func PossibleVirtualNetworkGatewaySkuTierValues() []VirtualNetworkGatewaySkuTier { - return []VirtualNetworkGatewaySkuTier{VirtualNetworkGatewaySkuTierBasic, VirtualNetworkGatewaySkuTierHighPerformance, VirtualNetworkGatewaySkuTierStandard, VirtualNetworkGatewaySkuTierUltraPerformance, VirtualNetworkGatewaySkuTierVpnGw1, VirtualNetworkGatewaySkuTierVpnGw2, VirtualNetworkGatewaySkuTierVpnGw3} + return []VirtualNetworkGatewaySkuTier{VirtualNetworkGatewaySkuTierBasic, VirtualNetworkGatewaySkuTierErGw1AZ, VirtualNetworkGatewaySkuTierErGw2AZ, VirtualNetworkGatewaySkuTierErGw3AZ, VirtualNetworkGatewaySkuTierHighPerformance, VirtualNetworkGatewaySkuTierStandard, VirtualNetworkGatewaySkuTierUltraPerformance, VirtualNetworkGatewaySkuTierVpnGw1, VirtualNetworkGatewaySkuTierVpnGw1AZ, VirtualNetworkGatewaySkuTierVpnGw2, VirtualNetworkGatewaySkuTierVpnGw2AZ, VirtualNetworkGatewaySkuTierVpnGw3, VirtualNetworkGatewaySkuTierVpnGw3AZ} } // VirtualNetworkGatewayType enumerates the values for virtual network gateway type. @@ -1197,17 +1350,17 @@ func PossibleVirtualNetworkGatewayTypeValues() []VirtualNetworkGatewayType { type VirtualNetworkPeeringState string const ( - // Connected ... - Connected VirtualNetworkPeeringState = "Connected" - // Disconnected ... - Disconnected VirtualNetworkPeeringState = "Disconnected" - // Initiated ... - Initiated VirtualNetworkPeeringState = "Initiated" + // 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{Connected, Disconnected, Initiated} + return []VirtualNetworkPeeringState{VirtualNetworkPeeringStateConnected, VirtualNetworkPeeringStateDisconnected, VirtualNetworkPeeringStateInitiated} } // VpnClientProtocol enumerates the values for vpn client protocol. @@ -1373,7 +1526,7 @@ func (ag *ApplicationGateway) UnmarshalJSON(body []byte) error { // ApplicationGatewayAuthenticationCertificate authentication certificates of an application gateway. type ApplicationGatewayAuthenticationCertificate struct { *ApplicationGatewayAuthenticationCertificatePropertiesFormat `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 - Name of the authentication certificate that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -1718,7 +1871,7 @@ type ApplicationGatewayBackendAddress struct { // ApplicationGatewayBackendAddressPool backend Address Pool of an application gateway. type ApplicationGatewayBackendAddressPool struct { *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` - // Name - Resource that is unique within a resource group. This name can be used to access the resource. + // Name - Name of the backend address pool that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -1855,7 +2008,7 @@ type ApplicationGatewayBackendHealthServer struct { // ApplicationGatewayBackendHTTPSettings backend address pool settings of an application gateway. type ApplicationGatewayBackendHTTPSettings struct { *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `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 - Name of the backend http settings that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -1949,9 +2102,9 @@ func (agbhs *ApplicationGatewayBackendHTTPSettings) UnmarshalJSON(body []byte) e // ApplicationGatewayBackendHTTPSettingsPropertiesFormat properties of Backend address pool settings of an // application gateway. type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { - // Port - Port + // Port - The destination port on the backend. Port *int32 `json:"port,omitempty"` - // Protocol - Protocol. Possible values include: 'HTTP', 'HTTPS' + // Protocol - The protocol used to communicate with the backend. Possible values are 'Http' and 'Https'. Possible values include: 'HTTP', 'HTTPS' Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` // CookieBasedAffinity - Cookie based affinity. Possible values include: 'Enabled', 'Disabled' CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` @@ -2135,7 +2288,7 @@ type ApplicationGatewayFirewallRuleSetPropertiesFormat struct { // ApplicationGatewayFrontendIPConfiguration frontend IP configuration of an application gateway. type ApplicationGatewayFrontendIPConfiguration struct { *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `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 - Name of the frontend IP configuration that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -2244,7 +2397,7 @@ type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { // ApplicationGatewayFrontendPort frontend port of an application gateway. type ApplicationGatewayFrontendPort struct { *ApplicationGatewayFrontendPortPropertiesFormat `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 - Name of the frontend port that is unique within an Application Gateway Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -2346,7 +2499,7 @@ type ApplicationGatewayFrontendPortPropertiesFormat struct { // ApplicationGatewayHTTPListener http listener of an application gateway. type ApplicationGatewayHTTPListener struct { *ApplicationGatewayHTTPListenerPropertiesFormat `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 - Name of the HTTP listener that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -2443,7 +2596,7 @@ type ApplicationGatewayHTTPListenerPropertiesFormat struct { FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` // FrontendPort - Frontend port resource of an application gateway. FrontendPort *SubResource `json:"frontendPort,omitempty"` - // Protocol - Protocol. Possible values include: 'HTTP', 'HTTPS' + // Protocol - Protocol of the HTTP listener. Possible values are 'Http' and 'Https'. Possible values include: 'HTTP', 'HTTPS' Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` // HostName - Host name of HTTP listener. HostName *string `json:"hostName,omitempty"` @@ -2459,7 +2612,7 @@ type ApplicationGatewayHTTPListenerPropertiesFormat struct { // IP configuration is allowed. type ApplicationGatewayIPConfiguration struct { *ApplicationGatewayIPConfigurationPropertiesFormat `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 - Name of the IP configuration that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -2663,7 +2816,7 @@ func (page ApplicationGatewayListResultPage) Values() []ApplicationGateway { // ApplicationGatewayPathRule path rule of URL path map of an application gateway. type ApplicationGatewayPathRule struct { *ApplicationGatewayPathRulePropertiesFormat `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 - Name of the path rule that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -2771,7 +2924,7 @@ type ApplicationGatewayPathRulePropertiesFormat struct { // ApplicationGatewayProbe probe of the application gateway. type ApplicationGatewayProbe struct { *ApplicationGatewayProbePropertiesFormat `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 - Name of the probe that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -2872,7 +3025,7 @@ type ApplicationGatewayProbeHealthResponseMatch struct { // ApplicationGatewayProbePropertiesFormat properties of probe of an application gateway. type ApplicationGatewayProbePropertiesFormat struct { - // Protocol - Protocol. Possible values include: 'HTTP', 'HTTPS' + // Protocol - The protocol used for the probe. Possible values are 'Http' and 'Https'. Possible values include: 'HTTP', 'HTTPS' Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` // Host - Host name to send the probe to. Host *string `json:"host,omitempty"` @@ -2928,6 +3081,8 @@ type ApplicationGatewayPropertiesFormat struct { RedirectConfigurations *[]ApplicationGatewayRedirectConfiguration `json:"redirectConfigurations,omitempty"` // WebApplicationFirewallConfiguration - Web application firewall configuration. WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration,omitempty"` + // EnableHTTP2 - Whether HTTP2 is enabled on the application gateway resource. + EnableHTTP2 *bool `json:"enableHttp2,omitempty"` // ResourceGUID - Resource GUID property of the application gateway resource. ResourceGUID *string `json:"resourceGuid,omitempty"` // ProvisioningState - Provisioning state of the application gateway resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. @@ -2937,7 +3092,7 @@ type ApplicationGatewayPropertiesFormat struct { // ApplicationGatewayRedirectConfiguration redirect configuration of an application gateway. type ApplicationGatewayRedirectConfiguration struct { *ApplicationGatewayRedirectConfigurationPropertiesFormat `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 - Name of the redirect configuration that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -3052,7 +3207,7 @@ type ApplicationGatewayRedirectConfigurationPropertiesFormat struct { // ApplicationGatewayRequestRoutingRule request routing rule of an application gateway. type ApplicationGatewayRequestRoutingRule struct { *ApplicationGatewayRequestRoutingRulePropertiesFormat `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 - Name of the request routing rule that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -3150,7 +3305,7 @@ type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` // BackendAddressPool - Backend address pool resource of the application gateway. BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // BackendHTTPSettings - Frontend port resource of the application gateway. + // 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"` @@ -3166,12 +3321,11 @@ type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { // long-running operation. type ApplicationGatewaysBackendHealthFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGatewaysClient) (agbh ApplicationGatewayBackendHealth, err error) { +func (future *ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGatewaysClient) (agbh ApplicationGatewayBackendHealth, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3179,34 +3333,15 @@ func (future ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGa return } if !done { - return agbh, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthFuture") - } - if future.PollingMethod() == azure.PollingLocation { - agbh, err = client.BackendHealthResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", agbh.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", resp, "Failure sending request") - return - } - agbh, err = client.BackendHealthResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", resp, "Failure responding to request") } return } @@ -3215,12 +3350,11 @@ func (future ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGa // long-running operation. type ApplicationGatewaysCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { +func (future *ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3228,34 +3362,15 @@ func (future ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationG return } if !done { - return ag, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ag, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", ag.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - ag, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -3264,12 +3379,11 @@ func (future ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationG // operation. type ApplicationGatewaysDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysDeleteFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { +func (future *ApplicationGatewaysDeleteFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3277,35 +3391,10 @@ func (future ApplicationGatewaysDeleteFuture) Result(client ApplicationGatewaysC return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -3322,7 +3411,7 @@ type ApplicationGatewaySku struct { // ApplicationGatewaySslCertificate SSL certificates of an application gateway. type ApplicationGatewaySslCertificate struct { *ApplicationGatewaySslCertificatePropertiesFormat `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 - Name of the SSL certificate that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -3442,7 +3531,7 @@ type ApplicationGatewaySslPolicy struct { // ApplicationGatewaySslPredefinedPolicy an Ssl predefined policy type ApplicationGatewaySslPredefinedPolicy struct { autorest.Response `json:"-"` - // Name - Name of Ssl predefined policy. + // Name - Name of the Ssl predefined policy. Name *string `json:"name,omitempty"` *ApplicationGatewaySslPredefinedPolicyPropertiesFormat `json:"properties,omitempty"` // ID - Resource ID. @@ -3518,12 +3607,11 @@ type ApplicationGatewaySslPredefinedPolicyPropertiesFormat struct { // operation. type ApplicationGatewaysStartFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { +func (future *ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3531,35 +3619,10 @@ func (future ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysCl return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") return } - ar, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -3567,12 +3630,11 @@ func (future ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysCl // operation. type ApplicationGatewaysStopFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { +func (future *ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3580,35 +3642,10 @@ func (future ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysCli return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StopResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") return } - ar, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -3616,12 +3653,11 @@ func (future ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysCli // operation. type ApplicationGatewaysUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysUpdateTagsFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { +func (future *ApplicationGatewaysUpdateTagsFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3629,34 +3665,15 @@ func (future ApplicationGatewaysUpdateTagsFuture) Result(client ApplicationGatew return } if !done { - return ag, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ag, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(ag.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", ag.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - ag, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -3665,7 +3682,7 @@ func (future ApplicationGatewaysUpdateTagsFuture) Result(client ApplicationGatew // PathBasedRouting. type ApplicationGatewayURLPathMap struct { *ApplicationGatewayURLPathMapPropertiesFormat `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 - Name of the URL path map that is unique within an Application Gateway. Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` @@ -3783,6 +3800,10 @@ type ApplicationGatewayWebApplicationFirewallConfiguration struct { 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 - Maxium request body size for WAF. + MaxRequestBodySize *int32 `json:"maxRequestBodySize,omitempty"` } // ApplicationSecurityGroup an application security group in a resource group. @@ -4024,12 +4045,11 @@ type ApplicationSecurityGroupPropertiesFormat struct { // long-running operation. type ApplicationSecurityGroupsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client ApplicationSecurityGroupsClient) (asg ApplicationSecurityGroup, err error) { +func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client ApplicationSecurityGroupsClient) (asg ApplicationSecurityGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4037,34 +4057,15 @@ func (future ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client Applic return } if !done { - return asg, azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - asg, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", asg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - asg, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -4073,12 +4074,11 @@ func (future ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client Applic // operation. type ApplicationSecurityGroupsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationSecurityGroupsDeleteFuture) Result(client ApplicationSecurityGroupsClient) (ar autorest.Response, err error) { +func (future *ApplicationSecurityGroupsDeleteFuture) Result(client ApplicationSecurityGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4086,35 +4086,10 @@ func (future ApplicationSecurityGroupsDeleteFuture) Result(client ApplicationSec return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -4296,7 +4271,7 @@ type AvailableProvidersListState struct { // 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 are: 'InProgress', 'Succeeded', and 'Failed'. Possible values include: 'InProgress', 'Succeeded', 'Failed' + // Status - Status of the Azure async operation. Possible values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed' Status OperationStatus `json:"status,omitempty"` Error *Error `json:"error,omitempty"` } @@ -4717,187 +4692,867 @@ type BgpSettings struct { PeerWeight *int32 `json:"peerWeight,omitempty"` } -// 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"` +// 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 `json:"properties,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"` +// 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) } -// ConnectivityDestination parameters that define destination of connection. -type ConnectivityDestination struct { - // ResourceID - The ID of the resource to which a connection attempt will be made. +// 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 - The IP address or URI the resource to which a connection attempt will be made. + // Address - Address of the connection monitor destination (IP or domain name). Address *string `json:"address,omitempty"` - // Port - Port on which check connectivity will be performed. + // Port - The destination port used by connection monitor. Port *int32 `json:"port,omitempty"` } -// ConnectivityHop information about a hop between the source and the destination. -type ConnectivityHop struct { - // Type - The type of the hop. - Type *string `json:"type,omitempty"` - // ID - The ID of the hop. - ID *string `json:"id,omitempty"` - // Address - The IP address of the hop. - Address *string `json:"address,omitempty"` - // ResourceID - The ID of the resource corresponding to this hop. - ResourceID *string `json:"resourceId,omitempty"` - // NextHopIds - List of next hop identifiers. - NextHopIds *[]string `json:"nextHopIds,omitempty"` - // Issues - List of issues. - Issues *[]ConnectivityIssue `json:"issues,omitempty"` +// ConnectionMonitorListResult list of connection monitors. +type ConnectionMonitorListResult struct { + autorest.Response `json:"-"` + // Value - Information about connection monitors. + Value *[]ConnectionMonitorResult `json:"value,omitempty"` } -// ConnectivityInformation information on the connectivity status. -type ConnectivityInformation struct { +// ConnectionMonitorParameters parameters that define the operation to create a connection monitor. +type ConnectionMonitorParameters struct { + Source *ConnectionMonitorSource `json:"source,omitempty"` + 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"` +} + +// ConnectionMonitorQueryResult list of connection states snaphots. +type ConnectionMonitorQueryResult struct { autorest.Response `json:"-"` - // Hops - List of hops between the source and the destination. - Hops *[]ConnectivityHop `json:"hops,omitempty"` - // ConnectionStatus - The connection status. Possible values include: 'ConnectionStatusUnknown', 'ConnectionStatusConnected', 'ConnectionStatusDisconnected', 'ConnectionStatusDegraded' - ConnectionStatus ConnectionStatus `json:"connectionStatus,omitempty"` - // AvgLatencyInMs - Average latency in milliseconds. - AvgLatencyInMs *int32 `json:"avgLatencyInMs,omitempty"` - // MinLatencyInMs - Minimum latency in milliseconds. - MinLatencyInMs *int32 `json:"minLatencyInMs,omitempty"` - // MaxLatencyInMs - Maximum latency in milliseconds. - MaxLatencyInMs *int32 `json:"maxLatencyInMs,omitempty"` - // ProbesSent - Total number of probes sent. - ProbesSent *int32 `json:"probesSent,omitempty"` - // ProbesFailed - Number of failed probes. - ProbesFailed *int32 `json:"probesFailed,omitempty"` + // SourceStatus - Status of connection monitor source. Possible values include: 'Uknown', 'Active', 'Inactive' + SourceStatus ConnectionMonitorSourceStatus `json:"sourceStatus,omitempty"` + // States - Information about connection states. + States *[]ConnectionStateSnapshot `json:"states,omitempty"` } -// ConnectivityIssue information about an issue encountered in the process of checking for connectivity. -type ConnectivityIssue struct { - // Origin - The origin of the issue. Possible values include: 'OriginLocal', 'OriginInbound', 'OriginOutbound' - Origin Origin `json:"origin,omitempty"` - // Severity - The severity of the issue. Possible values include: 'SeverityError', 'SeverityWarning' - Severity Severity `json:"severity,omitempty"` - // Type - The type of issue. Possible values include: 'IssueTypeUnknown', 'IssueTypeAgentStopped', 'IssueTypeGuestFirewall', 'IssueTypeDNSResolution', 'IssueTypeSocketBind', 'IssueTypeNetworkSecurityRule', 'IssueTypeUserDefinedRoute', 'IssueTypePortThrottled', 'IssueTypePlatform' - Type IssueType `json:"type,omitempty"` - // Context - Provides additional context on the issue. - Context *[]map[string]*string `json:"context,omitempty"` +// ConnectionMonitorResult information about the connection monitor. +type ConnectionMonitorResult struct { + autorest.Response `json:"-"` + // Name - Name of the connection monitor. + Name *string `json:"name,omitempty"` + // ID - ID of the connection monitor. + ID *string `json:"id,omitempty"` + Etag *string `json:"etag,omitempty"` + // Type - 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 `json:"properties,omitempty"` } -// ConnectivityParameters parameters that determine how the connectivity check will be performed. -type ConnectivityParameters struct { - Source *ConnectivitySource `json:"source,omitempty"` - Destination *ConnectivityDestination `json:"destination,omitempty"` +// MarshalJSON is the custom marshaler for ConnectionMonitorResult. +func (cmr ConnectionMonitorResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cmr.Name != nil { + objectMap["name"] = cmr.Name + } + if cmr.ID != nil { + objectMap["id"] = cmr.ID + } + if cmr.Etag != nil { + objectMap["etag"] = cmr.Etag + } + if cmr.Type != nil { + objectMap["type"] = cmr.Type + } + 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) } -// 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"` +// 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 } -// 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"` +// ConnectionMonitorResultProperties describes the properties of a connection monitor. +type ConnectionMonitorResultProperties struct { + // ProvisioningState - The provisioning state of the connection monitor. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // StartTime - The date and time when the connection monitor was started. + StartTime *date.Time `json:"startTime,omitempty"` + // MonitoringStatus - The monitoring status of the connection monitor. + MonitoringStatus *string `json:"monitoringStatus,omitempty"` + Source *ConnectionMonitorSource `json:"source,omitempty"` + 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"` } -// 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"` +// ConnectionMonitorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectionMonitorsCreateOrUpdateFuture struct { + azure.Future } -// DNSNameAvailabilityResult response for the CheckDnsNameAvailability API service call. -type DNSNameAvailabilityResult struct { - autorest.Response `json:"-"` - // Available - Domain availability (True/False). - Available *bool `json:"available,omitempty"` +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ConnectionMonitorsCreateOrUpdateFuture) Result(client ConnectionMonitorsClient) (cmr ConnectionMonitorResult, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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 } -// 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"` +// ConnectionMonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsDeleteFuture struct { + azure.Future } -// 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 +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ConnectionMonitorsDeleteFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsDeleteFuture", "Result", future.Response(), "Polling failure") + return } - if ensg.Association != nil { - objectMap["association"] = ensg.Association + if !done { + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsDeleteFuture") + return } - if ensg.EffectiveSecurityRules != nil { - objectMap["effectiveSecurityRules"] = ensg.EffectiveSecurityRules + ar.Response = future.Response() + return +} + +// 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"` +} + +// ConnectionMonitorsQueryFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsQueryFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ConnectionMonitorsQueryFuture) Result(client ConnectionMonitorsClient) (cmqr ConnectionMonitorQueryResult, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", future.Response(), "Polling failure") + return } - if ensg.TagMap != nil { - objectMap["tagMap"] = ensg.TagMap + if !done { + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsQueryFuture") + return } - return json.Marshal(objectMap) + 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 } -// EffectiveNetworkSecurityGroupAssociation the effective network security group association. -type EffectiveNetworkSecurityGroupAssociation struct { - // 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"` +// ConnectionMonitorsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsStartFuture struct { + azure.Future } -// EffectiveNetworkSecurityGroupListResult response for list effective network security groups API service call. -type EffectiveNetworkSecurityGroupListResult struct { +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ConnectionMonitorsStartFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ConnectionMonitorsStopFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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:"-"` - // Value - A list of effective network security groups. - Value *[]EffectiveNetworkSecurityGroup `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` + // KeyLength - The virtual network connection reset shared key length, should between 1 and 128. + KeyLength *int32 `json:"keyLength,omitempty"` } -// 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 are: 'Tcp', 'Udp', and 'All'. Possible values include: 'TCP', 'UDP', 'All' - 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 seperator (e.g. 100-400), or an asterix (*) - SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` - // DestinationPortRanges - The destination port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as seperator (e.g. 100-400), or an asterix (*) - 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, AureLoadBalancer, Internet), System Tags, and the asterix (*). - SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` - // DestinationAddressPrefixes - The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AureLoadBalancer, Internet), System Tags, and the asterix (*). - DestinationAddressPrefixes *[]string `json:"destinationAddressPrefixes,omitempty"` - // ExpandedSourceAddressPrefix - The expanded source address prefix. - ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` - // ExpandedDestinationAddressPrefix - Expanded destination address prefix. +// 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"` +} + +// 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: 'NotStarted', 'InProgress', 'Completed' + EvaluationState EvaluationState `json:"evaluationState,omitempty"` + // Hops - List of hops between the source and the destination. + Hops *[]ConnectivityHop `json:"hops,omitempty"` +} + +// 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"` +} + +// ConnectivityHop information about a hop between the source and the destination. +type ConnectivityHop struct { + // Type - The type of the hop. + Type *string `json:"type,omitempty"` + // ID - The ID of the hop. + ID *string `json:"id,omitempty"` + // Address - The IP address of the hop. + Address *string `json:"address,omitempty"` + // ResourceID - The ID of the resource corresponding to this hop. + ResourceID *string `json:"resourceId,omitempty"` + // NextHopIds - List of next hop identifiers. + NextHopIds *[]string `json:"nextHopIds,omitempty"` + // Issues - List of issues. + Issues *[]ConnectivityIssue `json:"issues,omitempty"` +} + +// ConnectivityInformation information on the connectivity status. +type ConnectivityInformation struct { + autorest.Response `json:"-"` + // Hops - List of hops between the source and the destination. + Hops *[]ConnectivityHop `json:"hops,omitempty"` + // ConnectionStatus - The connection status. Possible values include: 'ConnectionStatusUnknown', 'ConnectionStatusConnected', 'ConnectionStatusDisconnected', 'ConnectionStatusDegraded' + ConnectionStatus ConnectionStatus `json:"connectionStatus,omitempty"` + // AvgLatencyInMs - Average latency in milliseconds. + AvgLatencyInMs *int32 `json:"avgLatencyInMs,omitempty"` + // MinLatencyInMs - Minimum latency in milliseconds. + MinLatencyInMs *int32 `json:"minLatencyInMs,omitempty"` + // MaxLatencyInMs - Maximum latency in milliseconds. + MaxLatencyInMs *int32 `json:"maxLatencyInMs,omitempty"` + // ProbesSent - Total number of probes sent. + ProbesSent *int32 `json:"probesSent,omitempty"` + // ProbesFailed - Number of failed probes. + ProbesFailed *int32 `json:"probesFailed,omitempty"` +} + +// ConnectivityIssue information about an issue encountered in the process of checking for connectivity. +type ConnectivityIssue struct { + // Origin - The origin of the issue. Possible values include: 'OriginLocal', 'OriginInbound', 'OriginOutbound' + Origin Origin `json:"origin,omitempty"` + // Severity - The severity of the issue. Possible values include: 'SeverityError', 'SeverityWarning' + Severity Severity `json:"severity,omitempty"` + // Type - The type of issue. Possible values include: 'IssueTypeUnknown', 'IssueTypeAgentStopped', 'IssueTypeGuestFirewall', 'IssueTypeDNSResolution', 'IssueTypeSocketBind', 'IssueTypeNetworkSecurityRule', 'IssueTypeUserDefinedRoute', 'IssueTypePortThrottled', 'IssueTypePlatform' + Type IssueType `json:"type,omitempty"` + // Context - Provides additional context on the issue. + Context *[]map[string]*string `json:"context,omitempty"` +} + +// ConnectivityParameters parameters that determine how the connectivity check will be performed. +type ConnectivityParameters struct { + Source *ConnectivitySource `json:"source,omitempty"` + Destination *ConnectivityDestination `json:"destination,omitempty"` + // Protocol - Network protocol. Possible values include: 'ProtocolTCP', 'ProtocolHTTP', 'ProtocolHTTPS', 'ProtocolIcmp' + Protocol Protocol `json:"protocol,omitempty"` + ProtocolConfiguration *ProtocolConfiguration `json:"protocolConfiguration,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"` +} + +// DdosProtectionPlan a DDoS protection plan in a resource group. +type DdosProtectionPlan struct { + autorest.Response `json:"-"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - 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 - 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.ID != nil { + objectMap["id"] = dpp.ID + } + if dpp.Name != nil { + objectMap["name"] = dpp.Name + } + if dpp.Type != nil { + objectMap["type"] = dpp.Type + } + if dpp.Location != nil { + objectMap["location"] = dpp.Location + } + if dpp.Tags != nil { + objectMap["tags"] = dpp.Tags + } + if dpp.DdosProtectionPlanPropertiesFormat != nil { + objectMap["properties"] = dpp.DdosProtectionPlanPropertiesFormat + } + if dpp.Etag != nil { + objectMap["etag"] = dpp.Etag + } + 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 - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DdosProtectionPlanListResultIterator provides access to a complete listing of DdosProtectionPlan values. +type DdosProtectionPlanListResultIterator struct { + i int + page DdosProtectionPlanListResultPage +} + +// Next advances 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (dpplr DdosProtectionPlanListResult) IsEmpty() bool { + return dpplr.Value == nil || len(*dpplr.Value) == 0 +} + +// ddosProtectionPlanListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dpplr DdosProtectionPlanListResult) ddosProtectionPlanListResultPreparer() (*http.Request, error) { + if dpplr.NextLink == nil || len(to.String(dpplr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dpplr.NextLink))) +} + +// DdosProtectionPlanListResultPage contains a page of DdosProtectionPlan values. +type DdosProtectionPlanListResultPage struct { + fn func(DdosProtectionPlanListResult) (DdosProtectionPlanListResult, error) + dpplr DdosProtectionPlanListResult +} + +// Next advances to the 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) Next() error { + next, err := page.fn(page.dpplr) + if err != nil { + return err + } + page.dpplr = next + return nil +} + +// 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 +} + +// DdosProtectionPlanPropertiesFormat dDoS protection plan properties. +type DdosProtectionPlanPropertiesFormat struct { + // ResourceGUID - 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 - The provisioning state of the DDoS protection plan resource. Possible values are: 'Succeeded', 'Updating', 'Deleting', and 'Failed'. + ProvisioningState *string `json:"provisioningState,omitempty"` + // VirtualNetworks - The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. + VirtualNetworks *[]SubResource `json:"virtualNetworks,omitempty"` +} + +// DdosProtectionPlansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosProtectionPlansCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DdosProtectionPlansCreateOrUpdateFuture) Result(client DdosProtectionPlansClient) (dpp DdosProtectionPlan, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DdosProtectionPlansDeleteFuture) Result(client DdosProtectionPlansClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("network.DdosProtectionPlansDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// 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"` +} + +// DNSNameAvailabilityResult response for the CheckDnsNameAvailability API service call. +type DNSNameAvailabilityResult struct { + autorest.Response `json:"-"` + // Available - Domain availability (True/False). + Available *bool `json:"available,omitempty"` +} + +// 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 { + // 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 - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// 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 are: 'Tcp', 'Udp', and 'All'. Possible values include: 'TCP', 'UDP', 'All' + 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 seperator (e.g. 100-400), or an asterix (*) + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - The destination port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as seperator (e.g. 100-400), or an asterix (*) + 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, AureLoadBalancer, Internet), System Tags, and the asterix (*). + SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` + // DestinationAddressPrefixes - The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AureLoadBalancer, Internet), System Tags, and the asterix (*). + 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 are: 'Allow' and 'Deny'. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' Access SecurityRuleAccess `json:"access,omitempty"` @@ -4907,165 +5562,1277 @@ type EffectiveNetworkSecurityRule struct { 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"` - // Source - Who created the route. Possible values are: 'Unknown', 'User', 'VirtualNetworkGateway', and 'Default'. Possible values include: 'EffectiveRouteSourceUnknown', 'EffectiveRouteSourceUser', 'EffectiveRouteSourceVirtualNetworkGateway', 'EffectiveRouteSourceDefault' - Source EffectiveRouteSource `json:"source,omitempty"` - // State - The value of effective route. Possible values are: 'Active' and 'Invalid'. Possible values include: 'Active', 'Invalid' - 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 are: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' - NextHopType RouteNextHopType `json:"nextHopType,omitempty"` +// EffectiveRoute effective Route +type EffectiveRoute struct { + // Name - The name of the user defined route. This is optional. + Name *string `json:"name,omitempty"` + // Source - Who created the route. Possible values are: 'Unknown', 'User', 'VirtualNetworkGateway', and 'Default'. Possible values include: 'EffectiveRouteSourceUnknown', 'EffectiveRouteSourceUser', 'EffectiveRouteSourceVirtualNetworkGateway', 'EffectiveRouteSourceDefault' + Source EffectiveRouteSource `json:"source,omitempty"` + // State - The value of effective route. Possible values are: 'Active' and 'Invalid'. 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 are: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. 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 - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// EndpointServiceResult endpoint service. +type EndpointServiceResult struct { + // Name - Name of the endpoint service. + Name *string `json:"name,omitempty"` + // Type - Type of the endpoint service. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// 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 +} + +// Next advances 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (eslr EndpointServicesListResult) IsEmpty() bool { + return eslr.Value == nil || len(*eslr.Value) == 0 +} + +// endpointServicesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eslr EndpointServicesListResult) endpointServicesListResultPreparer() (*http.Request, error) { + if eslr.NextLink == nil || len(to.String(eslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eslr.NextLink))) +} + +// EndpointServicesListResultPage contains a page of EndpointServiceResult values. +type EndpointServicesListResultPage struct { + fn func(EndpointServicesListResult) (EndpointServicesListResult, error) + eslr EndpointServicesListResult +} + +// Next advances to the 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) Next() error { + next, err := page.fn(page.eslr) + if err != nil { + return err + } + page.eslr = next + return nil +} + +// 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 +} + +// Error ... +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]ErrorDetails `json:"details,omitempty"` + InnerError *string `json:"innerError,omitempty"` +} + +// ErrorDetails ... +type ErrorDetails struct { + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ExpressRouteCircuit expressRouteCircuit resource +type ExpressRouteCircuit struct { + autorest.Response `json:"-"` + // Sku - The SKU. + Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` + *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` + // Etag - Gets 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 - Resource name. + Name *string `json:"name,omitempty"` + // Type - 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.Etag != nil { + objectMap["etag"] = erc.Etag + } + if erc.ID != nil { + objectMap["id"] = erc.ID + } + if erc.Name != nil { + objectMap["name"] = erc.Name + } + if erc.Type != nil { + objectMap["type"] = erc.Type + } + 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 `json:"properties,omitempty"` + // Name - Gets 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 - 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 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.Etag != nil { + objectMap["etag"] = erca.Etag + } + 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 "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.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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 `json:"properties,omitempty"` + // Name - Gets 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 - 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 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.Etag != nil { + objectMap["etag"] = ercc.Etag + } + 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ercc.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCircuitConnectionPropertiesFormat ... +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"` + // CircuitConnectionStatus - Express Route Circuit Connection State. Possible values are: 'Connected' and 'Disconnected'. Possible values include: 'Connected', 'Connecting', 'Disconnected' + CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` + // ProvisioningState - Provisioning state of the circuit connection resource. Possible values are: 'Succeded', 'Updating', 'Deleting', and 'Failed'. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ExpressRouteCircuitConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitConnectionsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) Result(client ExpressRouteCircuitConnectionsClient) (ercc ExpressRouteCircuitConnection, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitConnectionsDeleteFuture) Result(client ExpressRouteCircuitConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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 +} + +// Next advances 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (erclr ExpressRouteCircuitListResult) IsEmpty() bool { + return erclr.Value == nil || len(*erclr.Value) == 0 +} + +// expressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erclr ExpressRouteCircuitListResult) expressRouteCircuitListResultPreparer() (*http.Request, error) { + if erclr.NextLink == nil || len(to.String(erclr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erclr.NextLink))) +} + +// ExpressRouteCircuitListResultPage contains a page of ExpressRouteCircuit values. +type ExpressRouteCircuitListResultPage struct { + fn func(ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error) + erclr ExpressRouteCircuitListResult +} + +// Next advances to the 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) Next() error { + next, err := page.fn(page.erclr) + if err != nil { + return err + } + page.erclr = next + return nil +} + +// 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 +} + +// ExpressRouteCircuitPeering peering in an ExpressRouteCircuit resource. +type ExpressRouteCircuitPeering struct { + autorest.Response `json:"-"` + *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` + // Name - Gets 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 - 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 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.Etag != nil { + objectMap["etag"] = ercp.Etag + } + 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 "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 of AdvertisedPublicPrefixes. + AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` + // AdvertisedCommunities - The communities of bgp peering. Spepcified for microsoft peering + AdvertisedCommunities *[]string `json:"advertisedCommunities,omitempty"` + // AdvertisedPublicPrefixesState - AdvertisedPublicPrefixState of the Peering resource. Possible values are 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. Possible values include: 'NotConfigured', 'Configuring', 'Configured', 'ValidationNeeded' + 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"` +} + +// 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 +} + +// Next advances 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (ercplr ExpressRouteCircuitPeeringListResult) IsEmpty() bool { + return ercplr.Value == nil || len(*ercplr.Value) == 0 +} + +// expressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ercplr ExpressRouteCircuitPeeringListResult) expressRouteCircuitPeeringListResultPreparer() (*http.Request, error) { + if ercplr.NextLink == nil || len(to.String(ercplr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ercplr.NextLink))) +} + +// ExpressRouteCircuitPeeringListResultPage contains a page of ExpressRouteCircuitPeering values. +type ExpressRouteCircuitPeeringListResultPage struct { + fn func(ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error) + ercplr ExpressRouteCircuitPeeringListResult +} + +// Next advances to the 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) Next() error { + next, err := page.fn(page.ercplr) + if err != nil { + return err + } + page.ercplr = next + return nil +} + +// 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 +} + +// ExpressRouteCircuitPeeringPropertiesFormat ... +type ExpressRouteCircuitPeeringPropertiesFormat struct { + // PeeringType - The peering type. Possible values include: 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' + 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 - Gets peering stats. + Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` + // ProvisioningState - Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + ProvisioningState *string `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + // LastModifiedBy - Gets whether the provider or the customer last modified the peering. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // RouteFilter - The reference of the RouteFilter resource. + RouteFilter *RouteFilter `json:"routeFilter,omitempty"` + // Ipv6PeeringConfig - The IPv6 peering configuration. + Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` + // Connections - The list of circuit connections associated with Azure Private Peering for this circuit. + Connections *[]ExpressRouteCircuitConnection `json:"connections,omitempty"` +} + +// ExpressRouteCircuitPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitPeeringsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) Result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitPeeringsDeleteFuture) Result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + 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 are 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', 'Deprovisioning' + 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"` + // ProvisioningState - Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + ProvisioningState *string `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,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 - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` +// ExpressRouteCircuitReference ... +type ExpressRouteCircuitReference struct { + // ID - Corresponding Express Route Circuit Id. + ID *string `json:"id,omitempty"` } -// EndpointServiceResult endpoint service. -type EndpointServiceResult struct { - // Name - Name of the endpoint service. - Name *string `json:"name,omitempty"` - // Type - Type of the endpoint service. - Type *string `json:"type,omitempty"` - // ID - Resource 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"` } -// EndpointServicesListResult response for the ListAvailableEndpointServices API service call. -type EndpointServicesListResult struct { +// 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"` +} + +// ExpressRouteCircuitsArpTableListResult response for ListArpTable associated with the Express Route Circuits API. +type ExpressRouteCircuitsArpTableListResult struct { autorest.Response `json:"-"` - // Value - List of available endpoint services in a region. - Value *[]EndpointServiceResult `json:"value,omitempty"` + // Value - Gets list of the ARP table. + Value *[]ExpressRouteCircuitArpTable `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 +// ExpressRouteCircuitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsCreateOrUpdateFuture struct { + azure.Future } -// Next advances 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) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitsCreateOrUpdateFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return } - err := iter.page.Next() + if !done { + 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.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitsDeleteFuture) Result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) if err != nil { - iter.i-- - return err + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Polling failure") + return } - iter.i = 0 - return nil + if !done { + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") + return + } + ar.Response = future.Response() + return } -// 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()) +// 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"` } -// Response returns the raw server response from the last page request. -func (iter EndpointServicesListResultIterator) Response() EndpointServicesListResult { - return iter.page.Response() +// 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 are 'Standard' and 'Premium'. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium' + Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` + // Family - The family of the SKU. Possible values are: 'UnlimitedData' and 'MeteredData'. Possible values include: 'UnlimitedData', 'MeteredData' + Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` } -// 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{} +// ExpressRouteCircuitsListArpTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsListArpTableFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitsListArpTableFuture) Result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Polling failure") + return } - return iter.page.Values()[iter.i] + if !done { + 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 } -// IsEmpty returns true if the ListResult contains no values. -func (eslr EndpointServicesListResult) IsEmpty() bool { - return eslr.Value == nil || len(*eslr.Value) == 0 +// ExpressRouteCircuitsListRoutesTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsListRoutesTableFuture struct { + azure.Future } -// endpointServicesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eslr EndpointServicesListResult) endpointServicesListResultPreparer() (*http.Request, error) { - if eslr.NextLink == nil || len(to.String(eslr.NextLink)) < 1 { - return nil, nil +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitsListRoutesTableFuture) Result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Polling failure") + return } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eslr.NextLink))) + if !done { + 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 } -// EndpointServicesListResultPage contains a page of EndpointServiceResult values. -type EndpointServicesListResultPage struct { - fn func(EndpointServicesListResult) (EndpointServicesListResult, error) - eslr EndpointServicesListResult +// ExpressRouteCircuitsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsListRoutesTableSummaryFuture struct { + azure.Future } -// Next advances to the 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) Next() error { - next, err := page.fn(page.eslr) +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) Result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { + var done bool + done, err = future.Done(client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") + return } - page.eslr = next - return nil + if !done { + 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"` } -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EndpointServicesListResultPage) NotDone() bool { - return !page.eslr.IsEmpty() +// ExpressRouteCircuitStats contains stats associated with the peering. +type ExpressRouteCircuitStats struct { + autorest.Response `json:"-"` + // PrimarybytesIn - Gets BytesIn of the peering. + PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` + // PrimarybytesOut - Gets BytesOut of the peering. + PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` + // SecondarybytesIn - Gets BytesIn of the peering. + SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` + // SecondarybytesOut - Gets BytesOut of the peering. + SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` } -// Response returns the raw server response from the last page request. -func (page EndpointServicesListResultPage) Response() EndpointServicesListResult { - return page.eslr +// ExpressRouteCircuitsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExpressRouteCircuitsUpdateTagsFuture struct { + azure.Future } -// 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 +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExpressRouteCircuitsUpdateTagsFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return } - return *page.eslr.Value -} - -// Error ... -type Error struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ErrorDetails `json:"details,omitempty"` - InnerError *string `json:"innerError,omitempty"` -} - -// ErrorDetails ... -type ErrorDetails struct { - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` + if !done { + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsUpdateTagsFuture") + 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.UpdateTagsResponder(erc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", erc.Response.Response, "Failure responding to request") + } + } + return } -// ExpressRouteCircuit expressRouteCircuit resource -type ExpressRouteCircuit struct { - autorest.Response `json:"-"` - // Sku - The SKU. - Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` - *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` +// ExpressRouteCrossConnection expressRouteCrossConnection resource +type ExpressRouteCrossConnection struct { + autorest.Response `json:"-"` + *ExpressRouteCrossConnectionProperties `json:"properties,omitempty"` // Etag - Gets a unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` // ID - Resource ID. @@ -5080,38 +6847,35 @@ type ExpressRouteCircuit struct { Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for ExpressRouteCircuit. -func (erc ExpressRouteCircuit) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnection. +func (ercc ExpressRouteCrossConnection) 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 ercc.ExpressRouteCrossConnectionProperties != nil { + objectMap["properties"] = ercc.ExpressRouteCrossConnectionProperties } - if erc.Etag != nil { - objectMap["etag"] = erc.Etag + if ercc.Etag != nil { + objectMap["etag"] = ercc.Etag } - if erc.ID != nil { - objectMap["id"] = erc.ID + if ercc.ID != nil { + objectMap["id"] = ercc.ID } - if erc.Name != nil { - objectMap["name"] = erc.Name + if ercc.Name != nil { + objectMap["name"] = ercc.Name } - if erc.Type != nil { - objectMap["type"] = erc.Type + if ercc.Type != nil { + objectMap["type"] = ercc.Type } - if erc.Location != nil { - objectMap["location"] = erc.Location + if ercc.Location != nil { + objectMap["location"] = ercc.Location } - if erc.Tags != nil { - objectMap["tags"] = erc.Tags + if ercc.Tags != nil { + objectMap["tags"] = ercc.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuit struct. -func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { +// 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 { @@ -5119,23 +6883,14 @@ func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { } 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) + var expressRouteCrossConnectionProperties ExpressRouteCrossConnectionProperties + err = json.Unmarshal(*v, &expressRouteCrossConnectionProperties) if err != nil { return err } - erc.ExpressRouteCircuitPropertiesFormat = &expressRouteCircuitPropertiesFormat + ercc.ExpressRouteCrossConnectionProperties = &expressRouteCrossConnectionProperties } case "etag": if v != nil { @@ -5144,7 +6899,7 @@ func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { if err != nil { return err } - erc.Etag = &etag + ercc.Etag = &etag } case "id": if v != nil { @@ -5153,7 +6908,7 @@ func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { if err != nil { return err } - erc.ID = &ID + ercc.ID = &ID } case "name": if v != nil { @@ -5162,7 +6917,7 @@ func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { if err != nil { return err } - erc.Name = &name + ercc.Name = &name } case "type": if v != nil { @@ -5171,7 +6926,7 @@ func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { if err != nil { return err } - erc.Type = &typeVar + ercc.Type = &typeVar } case "location": if v != nil { @@ -5180,7 +6935,7 @@ func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { if err != nil { return err } - erc.Location = &location + ercc.Location = &location } case "tags": if v != nil { @@ -5189,223 +6944,33 @@ func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { if err != nil { return err } - erc.Tags = tags - } - } - } - - return nil -} - -// ExpressRouteCircuitArpTable the ARP table associated with the ExpressRouteCircuit. -type ExpressRouteCircuitArpTable struct { - // Age - Age - Age *int32 `json:"age,omitempty"` - // Interface - Interface - 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 `json:"properties,omitempty"` - // Name - Gets 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 - 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 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.Etag != nil { - objectMap["etag"] = erca.Etag - } - 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 "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erca.ID = &ID + ercc.Tags = tags } } } - - return nil -} - -// ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture struct { - azure.Future - req *http.Request -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - return erca, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erca, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - erca, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") - } - return -} - -// ExpressRouteCircuitAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitAuthorizationsDeleteFuture struct { - azure.Future - req *http.Request -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future ExpressRouteCircuitAuthorizationsDeleteFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", resp, "Failure responding to request") - } - return + + return nil } -// ExpressRouteCircuitListResult response for ListExpressRouteCircuit API service call. -type ExpressRouteCircuitListResult struct { +// ExpressRouteCrossConnectionListResult response for ListExpressRouteCrossConnection API service call. +type ExpressRouteCrossConnectionListResult struct { autorest.Response `json:"-"` - // Value - A list of ExpressRouteCircuits in a resource group. - Value *[]ExpressRouteCircuit `json:"value,omitempty"` + // Value - A list of ExpressRouteCrossConnection resources. + Value *[]ExpressRouteCrossConnection `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 { +// ExpressRouteCrossConnectionListResultIterator provides access to a complete listing of +// ExpressRouteCrossConnection values. +type ExpressRouteCrossConnectionListResultIterator struct { i int - page ExpressRouteCircuitListResultPage + page ExpressRouteCrossConnectionListResultPage } // Next advances 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) Next() error { +func (iter *ExpressRouteCrossConnectionListResultIterator) Next() error { iter.i++ if iter.i < len(iter.page.Values()) { return nil @@ -5420,80 +6985,80 @@ func (iter *ExpressRouteCircuitListResultIterator) Next() error { } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteCircuitListResultIterator) NotDone() bool { +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 ExpressRouteCircuitListResultIterator) Response() ExpressRouteCircuitListResult { +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 ExpressRouteCircuitListResultIterator) Value() ExpressRouteCircuit { +func (iter ExpressRouteCrossConnectionListResultIterator) Value() ExpressRouteCrossConnection { if !iter.page.NotDone() { - return ExpressRouteCircuit{} + return ExpressRouteCrossConnection{} } return iter.page.Values()[iter.i] } // IsEmpty returns true if the ListResult contains no values. -func (erclr ExpressRouteCircuitListResult) IsEmpty() bool { - return erclr.Value == nil || len(*erclr.Value) == 0 +func (ercclr ExpressRouteCrossConnectionListResult) IsEmpty() bool { + return ercclr.Value == nil || len(*ercclr.Value) == 0 } -// expressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. +// expressRouteCrossConnectionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (erclr ExpressRouteCircuitListResult) expressRouteCircuitListResultPreparer() (*http.Request, error) { - if erclr.NextLink == nil || len(to.String(erclr.NextLink)) < 1 { +func (ercclr ExpressRouteCrossConnectionListResult) expressRouteCrossConnectionListResultPreparer() (*http.Request, error) { + if ercclr.NextLink == nil || len(to.String(ercclr.NextLink)) < 1 { return nil, nil } return autorest.Prepare(&http.Request{}, autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(erclr.NextLink))) + autorest.WithBaseURL(to.String(ercclr.NextLink))) } -// ExpressRouteCircuitListResultPage contains a page of ExpressRouteCircuit values. -type ExpressRouteCircuitListResultPage struct { - fn func(ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error) - erclr ExpressRouteCircuitListResult +// ExpressRouteCrossConnectionListResultPage contains a page of ExpressRouteCrossConnection values. +type ExpressRouteCrossConnectionListResultPage struct { + fn func(ExpressRouteCrossConnectionListResult) (ExpressRouteCrossConnectionListResult, error) + ercclr ExpressRouteCrossConnectionListResult } // Next advances to the 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) Next() error { - next, err := page.fn(page.erclr) +func (page *ExpressRouteCrossConnectionListResultPage) Next() error { + next, err := page.fn(page.ercclr) if err != nil { return err } - page.erclr = next + page.ercclr = next return nil } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteCircuitListResultPage) NotDone() bool { - return !page.erclr.IsEmpty() +func (page ExpressRouteCrossConnectionListResultPage) NotDone() bool { + return !page.ercclr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ExpressRouteCircuitListResultPage) Response() ExpressRouteCircuitListResult { - return page.erclr +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 ExpressRouteCircuitListResultPage) Values() []ExpressRouteCircuit { - if page.erclr.IsEmpty() { +func (page ExpressRouteCrossConnectionListResultPage) Values() []ExpressRouteCrossConnection { + if page.ercclr.IsEmpty() { return nil } - return *page.erclr.Value + return *page.ercclr.Value } -// ExpressRouteCircuitPeering peering in an ExpressRouteCircuit resource. -type ExpressRouteCircuitPeering struct { - autorest.Response `json:"-"` - *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` +// ExpressRouteCrossConnectionPeering peering in an ExpressRoute Cross Connection resource. +type ExpressRouteCrossConnectionPeering struct { + autorest.Response `json:"-"` + *ExpressRouteCrossConnectionPeeringProperties `json:"properties,omitempty"` // Name - Gets 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 - A unique read-only string that changes whenever the resource is updated. @@ -5502,26 +7067,26 @@ type ExpressRouteCircuitPeering struct { ID *string `json:"id,omitempty"` } -// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeering. -func (ercp ExpressRouteCircuitPeering) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeering. +func (erccp ExpressRouteCrossConnectionPeering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ercp.ExpressRouteCircuitPeeringPropertiesFormat != nil { - objectMap["properties"] = ercp.ExpressRouteCircuitPeeringPropertiesFormat + if erccp.ExpressRouteCrossConnectionPeeringProperties != nil { + objectMap["properties"] = erccp.ExpressRouteCrossConnectionPeeringProperties } - if ercp.Name != nil { - objectMap["name"] = ercp.Name + if erccp.Name != nil { + objectMap["name"] = erccp.Name } - if ercp.Etag != nil { - objectMap["etag"] = ercp.Etag + if erccp.Etag != nil { + objectMap["etag"] = erccp.Etag } - if ercp.ID != nil { - objectMap["id"] = ercp.ID + if erccp.ID != nil { + objectMap["id"] = erccp.ID } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitPeering struct. -func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { +// 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 { @@ -5531,12 +7096,12 @@ func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var expressRouteCircuitPeeringPropertiesFormat ExpressRouteCircuitPeeringPropertiesFormat - err = json.Unmarshal(*v, &expressRouteCircuitPeeringPropertiesFormat) + var expressRouteCrossConnectionPeeringProperties ExpressRouteCrossConnectionPeeringProperties + err = json.Unmarshal(*v, &expressRouteCrossConnectionPeeringProperties) if err != nil { return err } - ercp.ExpressRouteCircuitPeeringPropertiesFormat = &expressRouteCircuitPeeringPropertiesFormat + erccp.ExpressRouteCrossConnectionPeeringProperties = &expressRouteCrossConnectionPeeringProperties } case "name": if v != nil { @@ -5545,7 +7110,7 @@ func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { if err != nil { return err } - ercp.Name = &name + erccp.Name = &name } case "etag": if v != nil { @@ -5554,7 +7119,7 @@ func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { if err != nil { return err } - ercp.Etag = &etag + erccp.Etag = &etag } case "id": if v != nil { @@ -5563,7 +7128,7 @@ func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { if err != nil { return err } - ercp.ID = &ID + erccp.ID = &ID } } } @@ -5571,42 +7136,26 @@ func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { return nil } -// ExpressRouteCircuitPeeringConfig specifies the peering configuration. -type ExpressRouteCircuitPeeringConfig struct { - // AdvertisedPublicPrefixes - The reference of AdvertisedPublicPrefixes. - AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` - // AdvertisedCommunities - The communities of bgp peering. Spepcified for microsoft peering - AdvertisedCommunities *[]string `json:"advertisedCommunities,omitempty"` - // AdvertisedPublicPrefixesState - AdvertisedPublicPrefixState of the Peering resource. Possible values are 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. Possible values include: 'NotConfigured', 'Configuring', 'Configured', 'ValidationNeeded' - 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"` -} - -// ExpressRouteCircuitPeeringListResult response for ListPeering API service call retrieves all peerings that -// belong to an ExpressRouteCircuit. -type ExpressRouteCircuitPeeringListResult struct { +// 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 circuit. - Value *[]ExpressRouteCircuitPeering `json:"value,omitempty"` + // Value - The peerings in an express route cross connection. + Value *[]ExpressRouteCrossConnectionPeering `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 { +// ExpressRouteCrossConnectionPeeringListIterator provides access to a complete listing of +// ExpressRouteCrossConnectionPeering values. +type ExpressRouteCrossConnectionPeeringListIterator struct { i int - page ExpressRouteCircuitPeeringListResultPage + page ExpressRouteCrossConnectionPeeringListPage } // Next advances 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) Next() error { +func (iter *ExpressRouteCrossConnectionPeeringListIterator) Next() error { iter.i++ if iter.i < len(iter.page.Values()) { return nil @@ -5621,86 +7170,86 @@ func (iter *ExpressRouteCircuitPeeringListResultIterator) Next() error { } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteCircuitPeeringListResultIterator) NotDone() bool { +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 ExpressRouteCircuitPeeringListResultIterator) Response() ExpressRouteCircuitPeeringListResult { +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 ExpressRouteCircuitPeeringListResultIterator) Value() ExpressRouteCircuitPeering { +func (iter ExpressRouteCrossConnectionPeeringListIterator) Value() ExpressRouteCrossConnectionPeering { if !iter.page.NotDone() { - return ExpressRouteCircuitPeering{} + return ExpressRouteCrossConnectionPeering{} } return iter.page.Values()[iter.i] } // IsEmpty returns true if the ListResult contains no values. -func (ercplr ExpressRouteCircuitPeeringListResult) IsEmpty() bool { - return ercplr.Value == nil || len(*ercplr.Value) == 0 +func (erccpl ExpressRouteCrossConnectionPeeringList) IsEmpty() bool { + return erccpl.Value == nil || len(*erccpl.Value) == 0 } -// expressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. +// expressRouteCrossConnectionPeeringListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ercplr ExpressRouteCircuitPeeringListResult) expressRouteCircuitPeeringListResultPreparer() (*http.Request, error) { - if ercplr.NextLink == nil || len(to.String(ercplr.NextLink)) < 1 { +func (erccpl ExpressRouteCrossConnectionPeeringList) expressRouteCrossConnectionPeeringListPreparer() (*http.Request, error) { + if erccpl.NextLink == nil || len(to.String(erccpl.NextLink)) < 1 { return nil, nil } return autorest.Prepare(&http.Request{}, autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ercplr.NextLink))) + autorest.WithBaseURL(to.String(erccpl.NextLink))) } -// ExpressRouteCircuitPeeringListResultPage contains a page of ExpressRouteCircuitPeering values. -type ExpressRouteCircuitPeeringListResultPage struct { - fn func(ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error) - ercplr ExpressRouteCircuitPeeringListResult +// ExpressRouteCrossConnectionPeeringListPage contains a page of ExpressRouteCrossConnectionPeering values. +type ExpressRouteCrossConnectionPeeringListPage struct { + fn func(ExpressRouteCrossConnectionPeeringList) (ExpressRouteCrossConnectionPeeringList, error) + erccpl ExpressRouteCrossConnectionPeeringList } // Next advances to the 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) Next() error { - next, err := page.fn(page.ercplr) +func (page *ExpressRouteCrossConnectionPeeringListPage) Next() error { + next, err := page.fn(page.erccpl) if err != nil { return err } - page.ercplr = next + page.erccpl = next return nil } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteCircuitPeeringListResultPage) NotDone() bool { - return !page.ercplr.IsEmpty() +func (page ExpressRouteCrossConnectionPeeringListPage) NotDone() bool { + return !page.erccpl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ExpressRouteCircuitPeeringListResultPage) Response() ExpressRouteCircuitPeeringListResult { - return page.ercplr +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 ExpressRouteCircuitPeeringListResultPage) Values() []ExpressRouteCircuitPeering { - if page.ercplr.IsEmpty() { +func (page ExpressRouteCrossConnectionPeeringListPage) Values() []ExpressRouteCrossConnectionPeering { + if page.erccpl.IsEmpty() { return nil } - return *page.ercplr.Value + return *page.erccpl.Value } -// ExpressRouteCircuitPeeringPropertiesFormat ... -type ExpressRouteCircuitPeeringPropertiesFormat struct { - // PeeringType - The PeeringType. Possible values are: 'AzurePublicPeering', 'AzurePrivatePeering', and 'MicrosoftPeering'. Possible values include: 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' - PeeringType ExpressRouteCircuitPeeringType `json:"peeringType,omitempty"` - // State - The state of peering. Possible values are: 'Disabled' and 'Enabled'. Possible values include: 'ExpressRouteCircuitPeeringStateDisabled', 'ExpressRouteCircuitPeeringStateEnabled' - State ExpressRouteCircuitPeeringState `json:"state,omitempty"` +// ExpressRouteCrossConnectionPeeringProperties ... +type ExpressRouteCrossConnectionPeeringProperties struct { + // PeeringType - The peering type. Possible values include: 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' + 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 *int32 `json:"peerASN,omitempty"` + PeerASN *int64 `json:"peerASN,omitempty"` // PrimaryPeerAddressPrefix - The primary address prefix. PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` // SecondaryPeerAddressPrefix - The secondary address prefix. @@ -5715,522 +7264,255 @@ type ExpressRouteCircuitPeeringPropertiesFormat struct { VlanID *int32 `json:"vlanId,omitempty"` // MicrosoftPeeringConfig - The Microsoft peering configuration. MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` - // Stats - Gets peering stats. - Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` // ProvisioningState - Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. ProvisioningState *string `json:"provisioningState,omitempty"` // GatewayManagerEtag - The GatewayManager Etag. GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` // LastModifiedBy - Gets whether the provider or the customer last modified the peering. LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // RouteFilter - The reference of the RouteFilter resource. - RouteFilter *RouteFilter `json:"routeFilter,omitempty"` // Ipv6PeeringConfig - The IPv6 peering configuration. Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` } -// ExpressRouteCircuitPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitPeeringsCreateOrUpdateFuture struct { +// ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture) Result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { +func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) Result(client ExpressRouteCrossConnectionPeeringsClient) (erccp ExpressRouteCrossConnectionPeering, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - return ercp, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercp, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", erccp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - ercp, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// ExpressRouteCircuitPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a +// ExpressRouteCrossConnectionPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a // long-running operation. -type ExpressRouteCircuitPeeringsDeleteFuture struct { +type ExpressRouteCrossConnectionPeeringsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitPeeringsDeleteFuture) Result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { +func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) Result(client ExpressRouteCrossConnectionPeeringsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", resp, "Failure responding to request") - } + 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 are 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', 'Deprovisioning' +// ExpressRouteCrossConnectionProperties properties of ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionProperties struct { + // PrimaryAzurePort - The name of the primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - The name of the secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // STag - The identifier of the circuit traffic. + STag *int32 `json:"sTag,omitempty"` + // PeeringLocation - The peering location of the ExpressRoute circuit. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // BandwidthInMbps - 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 are 'NotProvisioned', 'Provisioning', 'Provisioned'. Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', 'Deprovisioning' 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 - Additional read only notes set by the connectivity provider. ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` - // ServiceProviderProperties - The ServiceProviderProperties. - ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` // ProvisioningState - Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. ProvisioningState *string `json:"provisioningState,omitempty"` - // GatewayManagerEtag - The GatewayManager Etag. - GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` -} - -// ExpressRouteCircuitRoutesTable the routes table associated with the ExpressRouteCircuit -type ExpressRouteCircuitRoutesTable struct { - // NetworkProperty - network - NetworkProperty *string `json:"network,omitempty"` - // NextHop - nextHop - NextHop *string `json:"nextHop,omitempty"` - // LocPrf - locPrf - LocPrf *string `json:"locPrf,omitempty"` - // Weight - weight. - Weight *int32 `json:"weight,omitempty"` - // Path - path - Path *string `json:"path,omitempty"` + // Peerings - The list of peerings. + Peerings *[]ExpressRouteCrossConnectionPeering `json:"peerings,omitempty"` } -// ExpressRouteCircuitRoutesTableSummary the routes table associated with the ExpressRouteCircuit. -type ExpressRouteCircuitRoutesTableSummary struct { - // Neighbor - Neighbor +// ExpressRouteCrossConnectionRoutesTableSummary the routes table associated with the ExpressRouteCircuit. +type ExpressRouteCrossConnectionRoutesTableSummary struct { + // Neighbor - IP address of Neighbor router 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"` + // 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"` - // 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"` -} - -// ExpressRouteCircuitsArpTableListResult response for ListArpTable associated with the Express Route Circuits API. -type ExpressRouteCircuitsArpTableListResult struct { - autorest.Response `json:"-"` - // Value - Gets list of the ARP table. - Value *[]ExpressRouteCircuitArpTable `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,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"` } -// ExpressRouteCircuitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// ExpressRouteCrossConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. -type ExpressRouteCircuitsCreateOrUpdateFuture struct { - azure.Future - req *http.Request -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsCreateOrUpdateFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - return erc, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erc, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - erc, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") - } - return -} - -// ExpressRouteCircuitsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExpressRouteCircuitsDeleteFuture struct { +type ExpressRouteCrossConnectionsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsDeleteFuture) Result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { +func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) Result(client ExpressRouteCrossConnectionsClient) (ercc ExpressRouteCrossConnection, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", ercc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", resp, "Failure responding to request") } return } -// 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 are 'Standard' and 'Premium'. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium' - Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` - // Family - The family of the SKU. Possible values are: 'UnlimitedData' and 'MeteredData'. Possible values include: 'UnlimitedData', 'MeteredData' - Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` -} - -// ExpressRouteCircuitsListArpTableFuture an abstraction for monitoring and retrieving the results of a +// ExpressRouteCrossConnectionsListArpTableFuture an abstraction for monitoring and retrieving the results of a // long-running operation. -type ExpressRouteCircuitsListArpTableFuture struct { +type ExpressRouteCrossConnectionsListArpTableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsListArpTableFuture) Result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { +func (future *ExpressRouteCrossConnectionsListArpTableFuture) Result(client ExpressRouteCrossConnectionsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", future.Response(), "Polling failure") return } if !done { - return ercatlr, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListArpTableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercatlr, err = client.ListArpTableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListArpTableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", resp, "Failure sending request") - return - } - ercatlr, err = client.ListArpTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", resp, "Failure responding to request") } return } -// ExpressRouteCircuitsListRoutesTableFuture an abstraction for monitoring and retrieving the results of a +// ExpressRouteCrossConnectionsListRoutesTableFuture an abstraction for monitoring and retrieving the results of a // long-running operation. -type ExpressRouteCircuitsListRoutesTableFuture struct { +type ExpressRouteCrossConnectionsListRoutesTableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsListRoutesTableFuture) Result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { +func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) Result(client ExpressRouteCrossConnectionsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", future.Response(), "Polling failure") return } if !done { - return ercrtlr, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercrtlr, err = client.ListRoutesTableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", resp, "Failure sending request") - return - } - ercrtlr, err = client.ListRoutesTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", resp, "Failure responding to request") } return } -// ExpressRouteCircuitsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitsListRoutesTableSummaryFuture struct { +// ExpressRouteCrossConnectionsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCrossConnectionsListRoutesTableSummaryFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsListRoutesTableSummaryFuture) Result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { +func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) Result(client ExpressRouteCrossConnectionsClient) (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") return } if !done { - return ercrtslr, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableSummaryFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercrtslr, err = client.ListRoutesTableSummaryResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", erccrtslr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", resp, "Failure sending request") - return - } - ercrtslr, err = client.ListRoutesTableSummaryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", resp, "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 { +// 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 *[]ExpressRouteCircuitRoutesTableSummary `json:"value,omitempty"` + Value *[]ExpressRouteCrossConnectionRoutesTableSummary `json:"value,omitempty"` // NextLink - The URL to get the next set of results. NextLink *string `json:"nextLink,omitempty"` } -// ExpressRouteCircuitStats contains stats associated with the peering. -type ExpressRouteCircuitStats struct { - autorest.Response `json:"-"` - // PrimarybytesIn - Gets BytesIn of the peering. - PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` - // PrimarybytesOut - Gets BytesOut of the peering. - PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` - // SecondarybytesIn - Gets BytesIn of the peering. - SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` - // SecondarybytesOut - Gets BytesOut of the peering. - SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` -} - -// ExpressRouteCircuitsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExpressRouteCircuitsUpdateTagsFuture struct { +// ExpressRouteCrossConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCrossConnectionsUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsUpdateTagsFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { +func (future *ExpressRouteCrossConnectionsUpdateTagsFuture) Result(client ExpressRouteCrossConnectionsClient) (ercc ExpressRouteCrossConnection, err error) { var done bool done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") return } if !done { - return erc, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erc, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(ercc.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsUpdateTagsFuture", "Result", ercc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - erc, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -6465,12 +7747,13 @@ type ExpressRouteServiceProviderPropertiesFormat struct { ProvisioningState *string `json:"provisioningState,omitempty"` } -// FlowLogInformation information on the configuration of flow log. +// 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 logging. - TargetResourceID *string `json:"targetResourceId,omitempty"` - *FlowLogProperties `json:"properties,omitempty"` + // TargetResourceID - The ID of the resource to configure for flow log and traffic analytics (optional) . + TargetResourceID *string `json:"targetResourceId,omitempty"` + *FlowLogProperties `json:"properties,omitempty"` + FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` } // MarshalJSON is the custom marshaler for FlowLogInformation. @@ -6482,6 +7765,9 @@ func (fli FlowLogInformation) MarshalJSON() ([]byte, error) { if fli.FlowLogProperties != nil { objectMap["properties"] = fli.FlowLogProperties } + if fli.FlowAnalyticsConfiguration != nil { + objectMap["flowAnalyticsConfiguration"] = fli.FlowAnalyticsConfiguration + } return json.Marshal(objectMap) } @@ -6512,6 +7798,15 @@ func (fli *FlowLogInformation) UnmarshalJSON(body []byte) error { } fli.FlowLogProperties = &flowLogProperties } + case "flowAnalyticsConfiguration": + if v != nil { + var flowAnalyticsConfiguration TrafficAnalyticsProperties + err = json.Unmarshal(*v, &flowAnalyticsConfiguration) + if err != nil { + return err + } + fli.FlowAnalyticsConfiguration = &flowAnalyticsConfiguration + } } } @@ -6527,9 +7822,10 @@ type FlowLogProperties struct { RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` } -// FlowLogStatusParameters parameters that define a resource to query flow log status. +// 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 logging status. + // TargetResourceID - The target resource where getting the flow log and traffic analytics (optional) status. TargetResourceID *string `json:"targetResourceId,omitempty"` } @@ -6676,6 +7972,24 @@ type GatewayRouteListResult struct { Value *[]GatewayRoute `json:"value,omitempty"` } +// HTTPConfiguration HTTP configuration of the connectivity check. +type HTTPConfiguration struct { + // Method - HTTP method. Possible values include: 'Get' + 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 describes 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"` +} + // InboundNatPool inbound NAT pool of the load balancer. type InboundNatPool struct { // InboundNatPoolPropertiesFormat - Properties of load balancer inbound nat pool. @@ -6769,6 +8083,10 @@ type InboundNatPoolPropertiesFormat struct { 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"` // ProvisioningState - Gets the provisioning state of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. ProvisioningState *string `json:"provisioningState,omitempty"` } @@ -6981,12 +8299,11 @@ type InboundNatRulePropertiesFormat struct { // operation. type InboundNatRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesClient) (inr InboundNatRule, err error) { +func (future *InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesClient) (inr InboundNatRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6994,34 +8311,15 @@ func (future InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesC return } if !done { - return inr, azure.NewAsyncOpIncompleteError("network.InboundNatRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - inr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", inr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - inr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -7030,12 +8328,11 @@ func (future InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesC // operation. type InboundNatRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InboundNatRulesDeleteFuture) Result(client InboundNatRulesClient) (ar autorest.Response, err error) { +func (future *InboundNatRulesDeleteFuture) Result(client InboundNatRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7043,35 +8340,10 @@ func (future InboundNatRulesDeleteFuture) Result(client InboundNatRulesClient) ( return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.InboundNatRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -7664,12 +8936,11 @@ type InterfacePropertiesFormat struct { // operation. type InterfacesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i Interface, err error) { +func (future *InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i Interface, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7677,34 +8948,15 @@ func (future InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i return } if !done { - return i, azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - i, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - i, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -7712,12 +8964,11 @@ func (future InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i // InterfacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type InterfacesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesDeleteFuture) Result(client InterfacesClient) (ar autorest.Response, err error) { +func (future *InterfacesDeleteFuture) Result(client InterfacesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7725,35 +8976,10 @@ func (future InterfacesDeleteFuture) Result(client InterfacesClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -7761,12 +8987,11 @@ func (future InterfacesDeleteFuture) Result(client InterfacesClient) (ar autores // long-running operation. type InterfacesGetEffectiveRouteTableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) { +func (future *InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7774,34 +8999,15 @@ func (future InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesCli return } if !done { - return erlr, azure.NewAsyncOpIncompleteError("network.InterfacesGetEffectiveRouteTableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erlr, err = client.GetEffectiveRouteTableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesGetEffectiveRouteTableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", erlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", resp, "Failure sending request") - return - } - erlr, err = client.GetEffectiveRouteTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", resp, "Failure responding to request") } return } @@ -7810,12 +9016,11 @@ func (future InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesCli // long-running operation. type InterfacesListEffectiveNetworkSecurityGroupsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client InterfacesClient) (ensglr EffectiveNetworkSecurityGroupListResult, err error) { +func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client InterfacesClient) (ensglr EffectiveNetworkSecurityGroupListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7823,34 +9028,15 @@ func (future InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client I return } if !done { - return ensglr, azure.NewAsyncOpIncompleteError("network.InterfacesListEffectiveNetworkSecurityGroupsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesListEffectiveNetworkSecurityGroupsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", ensglr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", resp, "Failure sending request") - return - } - ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", resp, "Failure responding to request") } return } @@ -7858,12 +9044,11 @@ func (future InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client I // InterfacesUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running operation. type InterfacesUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesUpdateTagsFuture) Result(client InterfacesClient) (i Interface, err error) { +func (future *InterfacesUpdateTagsFuture) Result(client InterfacesClient) (i Interface, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7871,34 +9056,15 @@ func (future InterfacesUpdateTagsFuture) Result(client InterfacesClient) (i Inte return } if !done { - return i, azure.NewAsyncOpIncompleteError("network.InterfacesUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - i, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(i.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", i.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - i, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -8017,16 +9183,24 @@ type IpsecPolicy struct { 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: 'DES', 'DES3', 'AES128', 'AES192', 'AES256' + // IkeEncryption - The IKE encryption algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` - // IkeIntegrity - The IKE integrity algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', 'SHA384' + // 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 Groups used in IKE Phase 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' DhGroup DhGroup `json:"dhGroup,omitempty"` - // PfsGroup - The DH Groups used in IKE Phase 2 for new child SA. Possible values include: 'PfsGroupNone', 'PfsGroupPFS1', 'PfsGroupPFS2', 'PfsGroupPFS2048', 'PfsGroupECP256', 'PfsGroupECP384', 'PfsGroupPFS24' + // PfsGroup - The Pfs Groups 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"` } +// IPTag contains the IpTag associated with the public IP address +type IPTag struct { + // IPTagType - Gets or sets the ipTag type: Example FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + // Tag - Gets or sets value of the IpTag associated with the public IP. Example SQL, Storage etc + Tag *string `json:"tag,omitempty"` +} + // Ipv6ExpressRouteCircuitPeeringConfig contains IPv6 peering config. type Ipv6ExpressRouteCircuitPeeringConfig struct { // PrimaryPeerAddressPrefix - The primary address prefix. @@ -8718,12 +9892,11 @@ type LoadBalancerPropertiesFormat struct { // operation. type LoadBalancersCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { +func (future *LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8731,34 +9904,15 @@ func (future LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClien return } if !done { - return lb, azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lb, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", lb.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - lb, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -8766,12 +9920,11 @@ func (future LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClien // LoadBalancersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type LoadBalancersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LoadBalancersDeleteFuture) Result(client LoadBalancersClient) (ar autorest.Response, err error) { +func (future *LoadBalancersDeleteFuture) Result(client LoadBalancersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8779,35 +9932,10 @@ func (future LoadBalancersDeleteFuture) Result(client LoadBalancersClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -8821,12 +9949,11 @@ type LoadBalancerSku struct { // operation. type LoadBalancersUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LoadBalancersUpdateTagsFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { +func (future *LoadBalancersUpdateTagsFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8834,34 +9961,15 @@ func (future LoadBalancersUpdateTagsFuture) Result(client LoadBalancersClient) ( return } if !done { - return lb, azure.NewAsyncOpIncompleteError("network.LoadBalancersUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lb, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(lb.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", lb.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - lb, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -9218,12 +10326,11 @@ type LocalNetworkGatewayPropertiesFormat struct { // long-running operation. type LocalNetworkGatewaysCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { +func (future *LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9231,34 +10338,15 @@ func (future LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetwor return } if !done { - return lng, azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lng, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", lng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - lng, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -9267,12 +10355,11 @@ func (future LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetwor // operation. type LocalNetworkGatewaysDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { +func (future *LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9280,35 +10367,10 @@ func (future LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGateway return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -9316,12 +10378,11 @@ func (future LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGateway // operation. type LocalNetworkGatewaysUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LocalNetworkGatewaysUpdateTagsFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { +func (future *LocalNetworkGatewaysUpdateTagsFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9329,34 +10390,15 @@ func (future LocalNetworkGatewaysUpdateTagsFuture) Result(client LocalNetworkGat return } if !done { - return lng, azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lng, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(lng.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", lng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - lng, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -9901,7 +10943,7 @@ func (pcr *PacketCaptureResult) UnmarshalJSON(body []byte) error { // PacketCaptureResultProperties describes the properties of a packet capture session. type PacketCaptureResultProperties struct { - // ProvisioningState - The provisioning state of the packet capture session. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + // ProvisioningState - The provisioning state of the packet capture session. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // Target - The ID of the targeted resource, only VM is currently supported. Target *string `json:"target,omitempty"` @@ -9918,12 +10960,11 @@ type PacketCaptureResultProperties struct { // PacketCapturesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type PacketCapturesCreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pcr PacketCaptureResult, err error) { +func (future *PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pcr PacketCaptureResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9931,34 +10972,15 @@ func (future PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pc return } if !done { - return pcr, azure.NewAsyncOpIncompleteError("network.PacketCapturesCreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pcr, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesCreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", pcr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", resp, "Failure sending request") - return - } - pcr, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", resp, "Failure responding to request") } return } @@ -9966,12 +10988,11 @@ func (future PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pc // PacketCapturesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type PacketCapturesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { +func (future *PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9979,35 +11000,10 @@ func (future PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.PacketCapturesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -10015,12 +11011,11 @@ func (future PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar // operation. type PacketCapturesGetStatusFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) (pcqsr PacketCaptureQueryStatusResult, err error) { +func (future *PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) (pcqsr PacketCaptureQueryStatusResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10028,34 +11023,15 @@ func (future PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) return } if !done { - return pcqsr, azure.NewAsyncOpIncompleteError("network.PacketCapturesGetStatusFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pcqsr, err = client.GetStatusResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesGetStatusFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", pcqsr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", resp, "Failure sending request") - return - } - pcqsr, err = client.GetStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", resp, "Failure responding to request") } return } @@ -10063,12 +11039,11 @@ func (future PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) // PacketCapturesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. type PacketCapturesStopFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesStopFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { +func (future *PacketCapturesStopFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10076,35 +11051,10 @@ func (future PacketCapturesStopFuture) Result(client PacketCapturesClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.PacketCapturesStopFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StopResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesStopFuture") return } - ar, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -10233,8 +11183,6 @@ type PatchRouteFilterRule struct { Name *string `json:"name,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` } @@ -10251,9 +11199,6 @@ func (prfr PatchRouteFilterRule) MarshalJSON() ([]byte, error) { if prfr.Etag != nil { objectMap["etag"] = prfr.Etag } - if prfr.Tags != nil { - objectMap["tags"] = prfr.Tags - } if prfr.ID != nil { objectMap["id"] = prfr.ID } @@ -10296,15 +11241,6 @@ func (prfr *PatchRouteFilterRule) UnmarshalJSON(body []byte) error { } prfr.Etag = &etag } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - prfr.Tags = tags - } case "id": if v != nil { var ID string @@ -10406,7 +11342,7 @@ func (p *Probe) UnmarshalJSON(body []byte) error { type ProbePropertiesFormat struct { // LoadBalancingRules - The load balancer rules that use this probe. LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` - // Protocol - The protocol of the end point. Possible values are: 'Http' or 'Tcp'. If 'Tcp' is specified, a received ACK is required for the probe to be successful. If 'Http' is specified, a 200 OK response from the specifies URI is required for the probe to be successful. Possible values include: 'ProbeProtocolHTTP', 'ProbeProtocolTCP' + // Protocol - The protocol of the end point. Possible values are: 'Http', 'Tcp', or 'Https'. 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"` @@ -10420,6 +11356,11 @@ type ProbePropertiesFormat struct { ProvisioningState *string `json:"provisioningState,omitempty"` } +// ProtocolConfiguration configuration of the protocol. +type ProtocolConfiguration struct { + HTTPConfiguration *HTTPConfiguration `json:"HTTPConfiguration,omitempty"` +} + // PublicIPAddress public IP address resource. type PublicIPAddress struct { autorest.Response `json:"-"` @@ -10586,12 +11527,11 @@ type PublicIPAddressDNSSettings struct { // operation. type PublicIPAddressesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { +func (future *PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10599,34 +11539,15 @@ func (future PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddres return } if !done { - return pia, azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pia, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", pia.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - pia, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -10635,12 +11556,11 @@ func (future PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddres // operation. type PublicIPAddressesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClient) (ar autorest.Response, err error) { +func (future *PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10648,35 +11568,10 @@ func (future PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClien return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -10684,12 +11579,11 @@ func (future PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClien // operation. type PublicIPAddressesUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PublicIPAddressesUpdateTagsFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { +func (future *PublicIPAddressesUpdateTagsFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10697,34 +11591,15 @@ func (future PublicIPAddressesUpdateTagsFuture) Result(client PublicIPAddressesC return } if !done { - return pia, azure.NewAsyncOpIncompleteError("network.PublicIPAddressesUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pia, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(pia.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", pia.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - pia, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -10841,6 +11716,8 @@ type PublicIPAddressPropertiesFormat struct { IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty"` // DNSSettings - The FQDN of the DNS record associated with the public IP address. DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,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"` // IdleTimeoutInMinutes - The idle timeout of the public IP address. @@ -11324,8 +12201,6 @@ type RouteFilterRule struct { Location *string `json:"location,omitempty"` // Etag - A unique read-only string that changes whenever the resource is updated. Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` } @@ -11345,9 +12220,6 @@ func (rfr RouteFilterRule) MarshalJSON() ([]byte, error) { if rfr.Etag != nil { objectMap["etag"] = rfr.Etag } - if rfr.Tags != nil { - objectMap["tags"] = rfr.Tags - } if rfr.ID != nil { objectMap["id"] = rfr.ID } @@ -11399,15 +12271,6 @@ func (rfr *RouteFilterRule) UnmarshalJSON(body []byte) error { } rfr.Etag = &etag } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rfr.Tags = tags - } case "id": if v != nil { var ID string @@ -11541,12 +12404,11 @@ type RouteFilterRulePropertiesFormat struct { // operation. type RouteFilterRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { +func (future *RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11554,34 +12416,15 @@ func (future RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRule return } if !done { - return rfr, azure.NewAsyncOpIncompleteError("network.RouteFilterRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rfr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", rfr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - rfr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -11590,12 +12433,11 @@ func (future RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRule // operation. type RouteFilterRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) (ar autorest.Response, err error) { +func (future *RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11603,35 +12445,10 @@ func (future RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RouteFilterRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -11639,12 +12456,11 @@ func (future RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) // operation. type RouteFilterRulesUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { +func (future *RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11652,34 +12468,15 @@ func (future RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) return } if !done { - return rfr, azure.NewAsyncOpIncompleteError("network.RouteFilterRulesUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rfr, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateResponder(rfr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", rfr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", resp, "Failure sending request") - return - } - rfr, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -11688,12 +12485,11 @@ func (future RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) // operation. type RouteFiltersCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { +func (future *RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11701,34 +12497,15 @@ func (future RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) return } if !done { - return rf, azure.NewAsyncOpIncompleteError("network.RouteFiltersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rf, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", rf.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - rf, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -11736,12 +12513,11 @@ func (future RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) // RouteFiltersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RouteFiltersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFiltersDeleteFuture) Result(client RouteFiltersClient) (ar autorest.Response, err error) { +func (future *RouteFiltersDeleteFuture) Result(client RouteFiltersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11749,47 +12525,21 @@ func (future RouteFiltersDeleteFuture) Result(client RouteFiltersClient) (ar aut return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RouteFiltersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // RouteFiltersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RouteFiltersUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFiltersUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { +func (future *RouteFiltersUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11797,34 +12547,15 @@ func (future RouteFiltersUpdateFuture) Result(client RouteFiltersClient) (rf Rou return } if !done { - return rf, azure.NewAsyncOpIncompleteError("network.RouteFiltersUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rf, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateResponder(rf.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", rf.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", resp, "Failure sending request") - return - } - rf, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -11946,12 +12677,11 @@ type RoutePropertiesFormat struct { // RoutesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RoutesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, err error) { +func (future *RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11959,34 +12689,15 @@ func (future RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, e return } if !done { - return r, azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - r, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", r.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - r, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -11994,12 +12705,11 @@ func (future RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, e // RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RoutesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RoutesDeleteFuture) Result(client RoutesClient) (ar autorest.Response, err error) { +func (future *RoutesDeleteFuture) Result(client RoutesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12007,35 +12717,10 @@ func (future RoutesDeleteFuture) Result(client RoutesClient) (ar autorest.Respon return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -12271,6 +12956,8 @@ type RouteTablePropertiesFormat struct { Routes *[]Route `json:"routes,omitempty"` // Subnets - A collection of references to subnets. Subnets *[]Subnet `json:"subnets,omitempty"` + // DisableBgpRoutePropagation - Gets or sets whether to disable the routes learned by BGP on that route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` // ProvisioningState - The provisioning state of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. ProvisioningState *string `json:"provisioningState,omitempty"` } @@ -12279,12 +12966,11 @@ type RouteTablePropertiesFormat struct { // operation. type RouteTablesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { +func (future *RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12292,34 +12978,15 @@ func (future RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) ( return } if !done { - return rt, azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rt, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - rt, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12327,12 +12994,11 @@ func (future RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) ( // RouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RouteTablesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autorest.Response, err error) { +func (future *RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12340,35 +13006,10 @@ func (future RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autor return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -12376,12 +13017,11 @@ func (future RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autor // operation. type RouteTablesUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteTablesUpdateTagsFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { +func (future *RouteTablesUpdateTagsFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12389,34 +13029,15 @@ func (future RouteTablesUpdateTagsFuture) Result(client RouteTablesClient) (rt R return } if !done { - return rt, azure.NewAsyncOpIncompleteError("network.RouteTablesUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rt, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteTablesUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(rt.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", rt.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - rt, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -12674,12 +13295,11 @@ type SecurityGroupPropertiesFormat struct { // operation. type SecurityGroupsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { +func (future *SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12687,34 +13307,15 @@ func (future SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsCli return } if !done { - return sg, azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sg, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sg, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12722,12 +13323,11 @@ func (future SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsCli // SecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SecurityGroupsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar autorest.Response, err error) { +func (future *SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12735,35 +13335,10 @@ func (future SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -12771,12 +13346,11 @@ func (future SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar // operation. type SecurityGroupsUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityGroupsUpdateTagsFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { +func (future *SecurityGroupsUpdateTagsFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12784,34 +13358,15 @@ func (future SecurityGroupsUpdateTagsFuture) Result(client SecurityGroupsClient) return } if !done { - return sg, azure.NewAsyncOpIncompleteError("network.SecurityGroupsUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sg, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(sg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", sg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - sg, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -13064,12 +13619,11 @@ type SecurityRulePropertiesFormat struct { // operation. type SecurityRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClient) (sr SecurityRule, err error) { +func (future *SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClient) (sr SecurityRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13077,34 +13631,15 @@ func (future SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClien return } if !done { - return sr, azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -13112,12 +13647,11 @@ func (future SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClien // SecurityRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SecurityRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityRulesDeleteFuture) Result(client SecurityRulesClient) (ar autorest.Response, err error) { +func (future *SecurityRulesDeleteFuture) Result(client SecurityRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13125,35 +13659,10 @@ func (future SecurityRulesDeleteFuture) Result(client SecurityRulesClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -13387,12 +13896,11 @@ type SubnetPropertiesFormat struct { // operation. type SubnetsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet, err error) { +func (future *SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13400,34 +13908,15 @@ func (future SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -13435,12 +13924,11 @@ func (future SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet // SubnetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SubnetsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SubnetsDeleteFuture) Result(client SubnetsClient) (ar autorest.Response, err error) { +func (future *SubnetsDeleteFuture) Result(client SubnetsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13448,35 +13936,10 @@ func (future SubnetsDeleteFuture) Result(client SubnetsClient) (ar autorest.Resp return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -13527,6 +13990,10 @@ type TopologyAssociation struct { type TopologyParameters struct { // TargetResourceGroupName - The name of the target resource group to perform topology on. TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` + // TargetVirtualNetwork - The reference of the Virtual Network resource. + TargetVirtualNetwork *SubResource `json:"targetVirtualNetwork,omitempty"` + // TargetSubnet - The reference of the Subnet resource. + TargetSubnet *SubResource `json:"targetSubnet,omitempty"` } // TopologyResource the network resource topology information for the given resource group. @@ -13541,6 +14008,23 @@ type TopologyResource struct { 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"` +} + +// TrafficAnalyticsProperties parameters that define the configuration of traffic analytics. +type TrafficAnalyticsProperties struct { + NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"` +} + // TroubleshootingDetails information gained from troubleshooting of specified resource. type TroubleshootingDetails struct { // ID - The id of the get troubleshoot operation. @@ -13784,8 +14268,8 @@ type VerificationIPFlowParameters struct { TargetResourceID *string `json:"targetResourceId,omitempty"` // Direction - The direction of the packet represented as a 5-tuple. Possible values include: 'Inbound', 'Outbound' Direction Direction `json:"direction,omitempty"` - // Protocol - Protocol to be verified on. Possible values include: 'ProtocolTCP', 'ProtocolUDP' - Protocol Protocol `json:"protocol,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. @@ -14492,12 +14976,11 @@ type VirtualNetworkGatewayConnectionPropertiesFormat struct { // a long-running operation. type VirtualNetworkGatewayConnectionsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { +func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -14505,34 +14988,15 @@ func (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client return } if !done { - return vngc, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vngc, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", vngc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vngc, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -14541,12 +15005,11 @@ func (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client // long-running operation. type VirtualNetworkGatewayConnectionsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsDeleteFuture) Result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { +func (future *VirtualNetworkGatewayConnectionsDeleteFuture) Result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -14554,35 +15017,10 @@ func (future VirtualNetworkGatewayConnectionsDeleteFuture) Result(client Virtual return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -14590,12 +15028,11 @@ func (future VirtualNetworkGatewayConnectionsDeleteFuture) Result(client Virtual // a long-running operation. type VirtualNetworkGatewayConnectionsResetSharedKeyFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { +func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -14603,34 +15040,15 @@ func (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client return } if !done { - return crsk, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") - } - if future.PollingMethod() == azure.PollingLocation { - crsk, err = client.ResetSharedKeyResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", crsk.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", resp, "Failure sending request") - return - } - crsk, err = client.ResetSharedKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", resp, "Failure responding to request") } return } @@ -14639,12 +15057,11 @@ func (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client // long-running operation. type VirtualNetworkGatewayConnectionsSetSharedKeyFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { +func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -14652,34 +15069,15 @@ func (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client V return } if !done { - return csk, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") - } - if future.PollingMethod() == azure.PollingLocation { - csk, err = client.SetSharedKeyResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", csk.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", resp, "Failure sending request") - return - } - csk, err = client.SetSharedKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", resp, "Failure responding to request") } return } @@ -14688,12 +15086,11 @@ func (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client V // long-running operation. type VirtualNetworkGatewayConnectionsUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsUpdateTagsFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngcle VirtualNetworkGatewayConnectionListEntity, err error) { +func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngcle VirtualNetworkGatewayConnectionListEntity, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -14701,34 +15098,15 @@ func (future VirtualNetworkGatewayConnectionsUpdateTagsFuture) Result(client Vir return } if !done { - return vngcle, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vngcle, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngcle.Response.Response, err = future.GetResult(sender); err == nil && vngcle.Response.Response.StatusCode != http.StatusNoContent { + vngcle, err = client.UpdateTagsResponder(vngcle.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", vngcle.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - vngcle, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -15063,47 +15441,27 @@ type VirtualNetworkGatewayPropertiesFormat struct { // long-running operation. type VirtualNetworkGatewaysCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysCreateOrUpdateFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { +func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } - if !done { - return vng, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vng, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + if !done { + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", vng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vng, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -15112,12 +15470,11 @@ func (future VirtualNetworkGatewaysCreateOrUpdateFuture) Result(client VirtualNe // operation. type VirtualNetworkGatewaysDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { +func (future *VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15125,35 +15482,10 @@ func (future VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGat return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -15161,12 +15493,11 @@ func (future VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGat // a long-running operation. type VirtualNetworkGatewaysGeneratevpnclientpackageFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { +func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15174,34 +15505,15 @@ func (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.GeneratevpnclientpackageResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.GeneratevpnclientpackageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", resp, "Failure responding to request") } return } @@ -15210,12 +15522,11 @@ func (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client // long-running operation. type VirtualNetworkGatewaysGenerateVpnProfileFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { +func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15223,34 +15534,15 @@ func (future VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client Virtu return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.GenerateVpnProfileResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.GenerateVpnProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", resp, "Failure responding to request") } return } @@ -15259,12 +15551,11 @@ func (future VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client Virtu // long-running operation. type VirtualNetworkGatewaysGetAdvertisedRoutesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { +func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15272,34 +15563,15 @@ func (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client Virt return } if !done { - return grlr, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - grlr, err = client.GetAdvertisedRoutesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", resp, "Failure sending request") - return - } - grlr, err = client.GetAdvertisedRoutesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", resp, "Failure responding to request") } return } @@ -15308,12 +15580,11 @@ func (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client Virt // long-running operation. type VirtualNetworkGatewaysGetBgpPeerStatusFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) { +func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15321,34 +15592,15 @@ func (future VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client Virtual return } if !done { - return bpslr, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture") - } - if future.PollingMethod() == azure.PollingLocation { - bpslr, err = client.GetBgpPeerStatusResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", bpslr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", resp, "Failure sending request") - return - } - bpslr, err = client.GetBgpPeerStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", resp, "Failure responding to request") } return } @@ -15357,12 +15609,11 @@ func (future VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client Virtual // long-running operation. type VirtualNetworkGatewaysGetLearnedRoutesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { +func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15370,34 +15621,44 @@ func (future VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client Virtual return } if !done { - return grlr, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - grlr, err = client.GetLearnedRoutesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return +} + +// VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture) Result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { + var done bool + done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") return } - grlr, err = client.GetLearnedRoutesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", resp, "Failure responding to request") + if !done { + 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 } @@ -15406,12 +15667,11 @@ func (future VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client Virtual // a long-running operation. type VirtualNetworkGatewaysGetVpnProfilePackageURLFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { +func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15419,43 +15679,24 @@ func (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) Result(client return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.GetVpnProfilePackageURLResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.GetVpnProfilePackageURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", resp, "Failure responding to request") } return } // VirtualNetworkGatewaySku virtualNetworkGatewaySku details type VirtualNetworkGatewaySku struct { - // Name - Gateway SKU name. Possible values include: 'VirtualNetworkGatewaySkuNameBasic', 'VirtualNetworkGatewaySkuNameHighPerformance', 'VirtualNetworkGatewaySkuNameStandard', 'VirtualNetworkGatewaySkuNameUltraPerformance', 'VirtualNetworkGatewaySkuNameVpnGw1', 'VirtualNetworkGatewaySkuNameVpnGw2', 'VirtualNetworkGatewaySkuNameVpnGw3' + // Name - Gateway SKU name. Possible values include: 'VirtualNetworkGatewaySkuNameBasic', 'VirtualNetworkGatewaySkuNameHighPerformance', 'VirtualNetworkGatewaySkuNameStandard', 'VirtualNetworkGatewaySkuNameUltraPerformance', 'VirtualNetworkGatewaySkuNameVpnGw1', 'VirtualNetworkGatewaySkuNameVpnGw2', 'VirtualNetworkGatewaySkuNameVpnGw3', 'VirtualNetworkGatewaySkuNameVpnGw1AZ', 'VirtualNetworkGatewaySkuNameVpnGw2AZ', 'VirtualNetworkGatewaySkuNameVpnGw3AZ', 'VirtualNetworkGatewaySkuNameErGw1AZ', 'VirtualNetworkGatewaySkuNameErGw2AZ', 'VirtualNetworkGatewaySkuNameErGw3AZ' Name VirtualNetworkGatewaySkuName `json:"name,omitempty"` - // Tier - Gateway SKU tier. Possible values include: 'VirtualNetworkGatewaySkuTierBasic', 'VirtualNetworkGatewaySkuTierHighPerformance', 'VirtualNetworkGatewaySkuTierStandard', 'VirtualNetworkGatewaySkuTierUltraPerformance', 'VirtualNetworkGatewaySkuTierVpnGw1', 'VirtualNetworkGatewaySkuTierVpnGw2', 'VirtualNetworkGatewaySkuTierVpnGw3' + // Tier - Gateway SKU tier. Possible values include: 'VirtualNetworkGatewaySkuTierBasic', 'VirtualNetworkGatewaySkuTierHighPerformance', 'VirtualNetworkGatewaySkuTierStandard', 'VirtualNetworkGatewaySkuTierUltraPerformance', 'VirtualNetworkGatewaySkuTierVpnGw1', 'VirtualNetworkGatewaySkuTierVpnGw2', 'VirtualNetworkGatewaySkuTierVpnGw3', 'VirtualNetworkGatewaySkuTierVpnGw1AZ', 'VirtualNetworkGatewaySkuTierVpnGw2AZ', 'VirtualNetworkGatewaySkuTierVpnGw3AZ', 'VirtualNetworkGatewaySkuTierErGw1AZ', 'VirtualNetworkGatewaySkuTierErGw2AZ', 'VirtualNetworkGatewaySkuTierErGw3AZ' Tier VirtualNetworkGatewaySkuTier `json:"tier,omitempty"` // Capacity - The capacity. Capacity *int32 `json:"capacity,omitempty"` @@ -15465,12 +15706,11 @@ type VirtualNetworkGatewaySku struct { // operation. type VirtualNetworkGatewaysResetFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { +func (future *VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15478,34 +15718,44 @@ func (future VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGate return } if !done { - return vng, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vng, err = client.ResetResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return +} + +// VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture) Result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { + var done bool + done, err = future.Done(client) if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") return } - vng, err = client.ResetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", resp, "Failure responding to request") + if !done { + 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 } @@ -15514,12 +15764,11 @@ func (future VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGate // long-running operation. type VirtualNetworkGatewaysUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysUpdateTagsFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { +func (future *VirtualNetworkGatewaysUpdateTagsFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15527,34 +15776,15 @@ func (future VirtualNetworkGatewaysUpdateTagsFuture) Result(client VirtualNetwor return } if !done { - return vng, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vng, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", vng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - vng, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -15962,7 +16192,7 @@ type VirtualNetworkPeeringPropertiesFormat struct { RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` // RemoteAddressSpace - The reference of the remote virtual network address space. RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` - // PeeringState - The status of the virtual network peering. Possible values are 'Initiated', 'Connected', and 'Disconnected'. Possible values include: 'Initiated', 'Connected', 'Disconnected' + // PeeringState - The status of the virtual network peering. Possible values are 'Initiated', 'Connected', and 'Disconnected'. Possible values include: 'VirtualNetworkPeeringStateInitiated', 'VirtualNetworkPeeringStateConnected', 'VirtualNetworkPeeringStateDisconnected' PeeringState VirtualNetworkPeeringState `json:"peeringState,omitempty"` // ProvisioningState - The provisioning state of the resource. ProvisioningState *string `json:"provisioningState,omitempty"` @@ -15972,12 +16202,11 @@ type VirtualNetworkPeeringPropertiesFormat struct { // long-running operation. type VirtualNetworkPeeringsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNetworkPeeringsClient) (vnp VirtualNetworkPeering, err error) { +func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNetworkPeeringsClient) (vnp VirtualNetworkPeering, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15985,34 +16214,15 @@ func (future VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNe return } if !done { - return vnp, azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vnp, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", vnp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vnp, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -16021,12 +16231,11 @@ func (future VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNe // operation. type VirtualNetworkPeeringsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkPeeringsDeleteFuture) Result(client VirtualNetworkPeeringsClient) (ar autorest.Response, err error) { +func (future *VirtualNetworkPeeringsDeleteFuture) Result(client VirtualNetworkPeeringsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16034,35 +16243,10 @@ func (future VirtualNetworkPeeringsDeleteFuture) Result(client VirtualNetworkPee return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -16080,22 +16264,23 @@ type VirtualNetworkPropertiesFormat struct { ResourceGUID *string `json:"resourceGuid,omitempty"` // ProvisioningState - The provisioning state of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. ProvisioningState *string `json:"provisioningState,omitempty"` - // EnableDdosProtection - Indicates if DDoS protection is enabled for all the protected resources in a Virtual Network. + // 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 a Virtual Network. + // 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"` } // VirtualNetworksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type VirtualNetworksCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { +func (future *VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16103,34 +16288,15 @@ func (future VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksC return } if !done { - return vn, azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vn, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vn, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -16139,12 +16305,11 @@ func (future VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksC // operation. type VirtualNetworksDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) (ar autorest.Response, err error) { +func (future *VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16152,35 +16317,10 @@ func (future VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) ( return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -16188,12 +16328,11 @@ func (future VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) ( // operation. type VirtualNetworksUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworksUpdateTagsFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { +func (future *VirtualNetworksUpdateTagsFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16201,34 +16340,15 @@ func (future VirtualNetworksUpdateTagsFuture) Result(client VirtualNetworksClien return } if !done { - return vn, azure.NewAsyncOpIncompleteError("network.VirtualNetworksUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vn, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(vn.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", vn.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - vn, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -16265,12 +16385,35 @@ type VpnClientConfiguration struct { VpnClientRevokedCertificates *[]VpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` // VpnClientProtocols - VpnClientProtocols for Virtual network gateway. VpnClientProtocols *[]VpnClientProtocol `json:"vpnClientProtocols,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"` } +// 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: 'DES', 'DES3', 'AES128', 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + 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 Groups used in IKE Phase 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + DhGroup DhGroup `json:"dhGroup,omitempty"` + // PfsGroup - The Pfs Groups 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 are: 'AMD64' and 'X86'. Possible values include: 'Amd64', 'X86' @@ -16603,7 +16746,7 @@ type WatcherListResult struct { // WatcherPropertiesFormat the network watcher properties. type WatcherPropertiesFormat struct { - // ProvisioningState - The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + // ProvisioningState - The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` } @@ -16611,12 +16754,11 @@ type WatcherPropertiesFormat struct { // operation. type WatchersCheckConnectivityFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci ConnectivityInformation, err error) { +func (future *WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci ConnectivityInformation, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16624,34 +16766,15 @@ func (future WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci return } if !done { - return ci, azure.NewAsyncOpIncompleteError("network.WatchersCheckConnectivityFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ci, err = client.CheckConnectivityResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersCheckConnectivityFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", ci.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", resp, "Failure sending request") - return - } - ci, err = client.CheckConnectivityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", resp, "Failure responding to request") } return } @@ -16659,12 +16782,11 @@ func (future WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci // WatchersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type WatchersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Response, err error) { +func (future *WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16672,35 +16794,10 @@ func (future WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Re return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.WatchersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -16708,12 +16805,11 @@ func (future WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Re // long-running operation. type WatchersGetAzureReachabilityReportFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetAzureReachabilityReportFuture) Result(client WatchersClient) (arr AzureReachabilityReport, err error) { +func (future *WatchersGetAzureReachabilityReportFuture) Result(client WatchersClient) (arr AzureReachabilityReport, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16721,34 +16817,15 @@ func (future WatchersGetAzureReachabilityReportFuture) Result(client WatchersCli return } if !done { - return arr, azure.NewAsyncOpIncompleteError("network.WatchersGetAzureReachabilityReportFuture") - } - if future.PollingMethod() == azure.PollingLocation { - arr, err = client.GetAzureReachabilityReportResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetAzureReachabilityReportFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", arr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", resp, "Failure sending request") - return - } - arr, err = client.GetAzureReachabilityReportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", resp, "Failure responding to request") } return } @@ -16757,12 +16834,11 @@ func (future WatchersGetAzureReachabilityReportFuture) Result(client WatchersCli // operation. type WatchersGetFlowLogStatusFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { +func (future *WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16770,34 +16846,15 @@ func (future WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli return } if !done { - return fli, azure.NewAsyncOpIncompleteError("network.WatchersGetFlowLogStatusFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fli, err = client.GetFlowLogStatusResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetFlowLogStatusFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", fli.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", resp, "Failure sending request") - return - } - fli, err = client.GetFlowLogStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", resp, "Failure responding to request") } return } @@ -16805,12 +16862,11 @@ func (future WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli // WatchersGetNextHopFuture an abstraction for monitoring and retrieving the results of a long-running operation. type WatchersGetNextHopFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHopResult, err error) { +func (future *WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHopResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16818,34 +16874,15 @@ func (future WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHo return } if !done { - return nhr, azure.NewAsyncOpIncompleteError("network.WatchersGetNextHopFuture") - } - if future.PollingMethod() == azure.PollingLocation { - nhr, err = client.GetNextHopResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetNextHopFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", nhr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", resp, "Failure sending request") - return - } - nhr, err = client.GetNextHopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", resp, "Failure responding to request") } return } @@ -16854,12 +16891,11 @@ func (future WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHo // operation. type WatchersGetTroubleshootingFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { +func (future *WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16867,34 +16903,15 @@ func (future WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr return } if !done { - return tr, azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingFuture") - } - if future.PollingMethod() == azure.PollingLocation { - tr, err = client.GetTroubleshootingResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", tr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", resp, "Failure sending request") - return - } - tr, err = client.GetTroubleshootingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", resp, "Failure responding to request") } return } @@ -16903,12 +16920,11 @@ func (future WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr // long-running operation. type WatchersGetTroubleshootingResultFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetTroubleshootingResultFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { +func (future *WatchersGetTroubleshootingResultFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16916,34 +16932,15 @@ func (future WatchersGetTroubleshootingResultFuture) Result(client WatchersClien return } if !done { - return tr, azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingResultFuture") - } - if future.PollingMethod() == azure.PollingLocation { - tr, err = client.GetTroubleshootingResultResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingResultFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", tr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", resp, "Failure sending request") - return - } - tr, err = client.GetTroubleshootingResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", resp, "Failure responding to request") } return } @@ -16952,12 +16949,11 @@ func (future WatchersGetTroubleshootingResultFuture) Result(client WatchersClien // operation. type WatchersGetVMSecurityRulesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sgvr SecurityGroupViewResult, err error) { +func (future *WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sgvr SecurityGroupViewResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16965,34 +16961,15 @@ func (future WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sg return } if !done { - return sgvr, azure.NewAsyncOpIncompleteError("network.WatchersGetVMSecurityRulesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sgvr, err = client.GetVMSecurityRulesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetVMSecurityRulesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", sgvr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", resp, "Failure sending request") - return - } - sgvr, err = client.GetVMSecurityRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", resp, "Failure responding to request") } return } @@ -17001,12 +16978,11 @@ func (future WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sg // operation. type WatchersListAvailableProvidersFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersListAvailableProvidersFuture) Result(client WatchersClient) (apl AvailableProvidersList, err error) { +func (future *WatchersListAvailableProvidersFuture) Result(client WatchersClient) (apl AvailableProvidersList, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17014,34 +16990,15 @@ func (future WatchersListAvailableProvidersFuture) Result(client WatchersClient) return } if !done { - return apl, azure.NewAsyncOpIncompleteError("network.WatchersListAvailableProvidersFuture") - } - if future.PollingMethod() == azure.PollingLocation { - apl, err = client.ListAvailableProvidersResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersListAvailableProvidersFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", apl.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", resp, "Failure sending request") - return - } - apl, err = client.ListAvailableProvidersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", resp, "Failure responding to request") } return } @@ -17050,12 +17007,11 @@ func (future WatchersListAvailableProvidersFuture) Result(client WatchersClient) // operation. type WatchersSetFlowLogConfigurationFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { +func (future *WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17063,34 +17019,15 @@ func (future WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient return } if !done { - return fli, azure.NewAsyncOpIncompleteError("network.WatchersSetFlowLogConfigurationFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fli, err = client.SetFlowLogConfigurationResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersSetFlowLogConfigurationFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", fli.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", resp, "Failure sending request") - return - } - fli, err = client.SetFlowLogConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", resp, "Failure responding to request") } return } @@ -17098,12 +17035,11 @@ func (future WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient // WatchersVerifyIPFlowFuture an abstraction for monitoring and retrieving the results of a long-running operation. type WatchersVerifyIPFlowFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersVerifyIPFlowFuture) Result(client WatchersClient) (vifr VerificationIPFlowResult, err error) { +func (future *WatchersVerifyIPFlowFuture) Result(client WatchersClient) (vifr VerificationIPFlowResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17111,34 +17047,15 @@ func (future WatchersVerifyIPFlowFuture) Result(client WatchersClient) (vifr Ver return } if !done { - return vifr, azure.NewAsyncOpIncompleteError("network.WatchersVerifyIPFlowFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vifr, err = client.VerifyIPFlowResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersVerifyIPFlowFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", vifr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", resp, "Failure sending request") - return - } - vifr, err = client.VerifyIPFlowResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/operations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/operations.go index 6b6c967dc5a21..ff6f760750fab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/operations.go @@ -65,7 +65,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/packetcaptures.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/packetcaptures.go similarity index 92% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/packetcaptures.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/packetcaptures.go index 36bf648925721..7422bf793d18a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/packetcaptures.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/packetcaptures.go @@ -80,7 +80,7 @@ func (client PacketCapturesClient) CreatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -98,15 +98,17 @@ func (client PacketCapturesClient) CreatePreparer(ctx context.Context, resourceG // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) CreateSender(req *http.Request) (future PacketCapturesCreateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -153,7 +155,7 @@ func (client PacketCapturesClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -169,15 +171,17 @@ func (client PacketCapturesClient) DeletePreparer(ctx context.Context, resourceG // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) DeleteSender(req *http.Request) (future PacketCapturesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -229,7 +233,7 @@ func (client PacketCapturesClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -292,7 +296,7 @@ func (client PacketCapturesClient) GetStatusPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -308,15 +312,17 @@ func (client PacketCapturesClient) GetStatusPreparer(ctx context.Context, resour // GetStatusSender sends the GetStatus request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) GetStatusSender(req *http.Request) (future PacketCapturesGetStatusFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -367,7 +373,7 @@ func (client PacketCapturesClient) ListPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -430,7 +436,7 @@ func (client PacketCapturesClient) StopPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -446,15 +452,17 @@ func (client PacketCapturesClient) StopPreparer(ctx context.Context, resourceGro // StopSender sends the Stop request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) StopSender(req *http.Request) (future PacketCapturesStopFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/publicipaddresses.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/publicipaddresses.go similarity index 97% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/publicipaddresses.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/publicipaddresses.go index 301b845971694..661b3de84e10e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/publicipaddresses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/publicipaddresses.go @@ -80,7 +80,7 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -98,15 +98,17 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(ctx context.Context // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (future PublicIPAddressesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -151,7 +153,7 @@ func (client PublicIPAddressesClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,15 +169,17 @@ func (client PublicIPAddressesClient) DeletePreparer(ctx context.Context, resour // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (future PublicIPAddressesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -226,7 +230,7 @@ func (client PublicIPAddressesClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -374,7 +378,7 @@ func (client PublicIPAddressesClient) ListPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -464,7 +468,7 @@ func (client PublicIPAddressesClient) ListAllPreparer(ctx context.Context) (*htt "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -751,7 +755,7 @@ func (client PublicIPAddressesClient) UpdateTagsPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -769,15 +773,17 @@ func (client PublicIPAddressesClient) UpdateTagsPreparer(ctx context.Context, re // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) UpdateTagsSender(req *http.Request) (future PublicIPAddressesUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routefilterrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routefilterrules.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routefilterrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routefilterrules.go index 152ac5e1dc522..f05bc5386f94c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routefilterrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routefilterrules.go @@ -80,7 +80,7 @@ func (client RouteFilterRulesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -98,15 +98,17 @@ func (client RouteFilterRulesClient) CreateOrUpdatePreparer(ctx context.Context, // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RouteFilterRulesClient) CreateOrUpdateSender(req *http.Request) (future RouteFilterRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -153,7 +155,7 @@ func (client RouteFilterRulesClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -169,15 +171,17 @@ func (client RouteFilterRulesClient) DeletePreparer(ctx context.Context, resourc // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RouteFilterRulesClient) DeleteSender(req *http.Request) (future RouteFilterRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -229,7 +233,7 @@ func (client RouteFilterRulesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -297,7 +301,7 @@ func (client RouteFilterRulesClient) ListByRouteFilterPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -388,7 +392,7 @@ func (client RouteFilterRulesClient) UpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -406,15 +410,17 @@ func (client RouteFilterRulesClient) UpdatePreparer(ctx context.Context, resourc // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client RouteFilterRulesClient) UpdateSender(req *http.Request) (future RouteFilterRulesUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routefilters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routefilters.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routefilters.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routefilters.go index db8f0ecc1c1a5..8dfbfb0522b80 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routefilters.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routefilters.go @@ -68,7 +68,7 @@ func (client RouteFiltersClient) CreateOrUpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,15 +86,17 @@ func (client RouteFiltersClient) CreateOrUpdatePreparer(ctx context.Context, res // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RouteFiltersClient) CreateOrUpdateSender(req *http.Request) (future RouteFiltersCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -139,7 +141,7 @@ func (client RouteFiltersClient) DeletePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,15 +157,17 @@ func (client RouteFiltersClient) DeletePreparer(ctx context.Context, resourceGro // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RouteFiltersClient) DeleteSender(req *http.Request) (future RouteFiltersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -214,7 +218,7 @@ func (client RouteFiltersClient) GetPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -280,7 +284,7 @@ func (client RouteFiltersClient) ListPreparer(ctx context.Context) (*http.Reques "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -373,7 +377,7 @@ func (client RouteFiltersClient) ListByResourceGroupPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -462,7 +466,7 @@ func (client RouteFiltersClient) UpdatePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -480,15 +484,17 @@ func (client RouteFiltersClient) UpdatePreparer(ctx context.Context, resourceGro // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client RouteFiltersClient) UpdateSender(req *http.Request) (future RouteFiltersUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routes.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routes.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routes.go index 8d4054bd57714..716e84126ea5f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routes.go @@ -70,7 +70,7 @@ func (client RoutesClient) CreateOrUpdatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +88,17 @@ func (client RoutesClient) CreateOrUpdatePreparer(ctx context.Context, resourceG // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (future RoutesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -143,7 +145,7 @@ func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,15 +161,17 @@ func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) DeleteSender(req *http.Request) (future RoutesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -219,7 +223,7 @@ func (client RoutesClient) GetPreparer(ctx context.Context, resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -287,7 +291,7 @@ func (client RoutesClient) ListPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routetables.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routetables.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routetables.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routetables.go index f953d9e822245..dca74ad7702d8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/routetables.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/routetables.go @@ -68,7 +68,7 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,15 +86,17 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, reso // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (future RouteTablesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -139,7 +141,7 @@ func (client RouteTablesClient) DeletePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,15 +157,17 @@ func (client RouteTablesClient) DeletePreparer(ctx context.Context, resourceGrou // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) DeleteSender(req *http.Request) (future RouteTablesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -214,7 +218,7 @@ func (client RouteTablesClient) GetPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -283,7 +287,7 @@ func (client RouteTablesClient) ListPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -373,7 +377,7 @@ func (client RouteTablesClient) ListAllPreparer(ctx context.Context) (*http.Requ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -462,7 +466,7 @@ func (client RouteTablesClient) UpdateTagsPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -480,15 +484,17 @@ func (client RouteTablesClient) UpdateTagsPreparer(ctx context.Context, resource // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) UpdateTagsSender(req *http.Request) (future RouteTablesUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/securitygroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/securitygroups.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/securitygroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/securitygroups.go index d8ab89df0dffc..60a23073ed677 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/securitygroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/securitygroups.go @@ -68,7 +68,7 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,15 +86,17 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, r // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future SecurityGroupsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -139,7 +141,7 @@ func (client SecurityGroupsClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,15 +157,17 @@ func (client SecurityGroupsClient) DeletePreparer(ctx context.Context, resourceG // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) DeleteSender(req *http.Request) (future SecurityGroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -214,7 +218,7 @@ func (client SecurityGroupsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -283,7 +287,7 @@ func (client SecurityGroupsClient) ListPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -373,7 +377,7 @@ func (client SecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.R "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -462,7 +466,7 @@ func (client SecurityGroupsClient) UpdateTagsPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -480,15 +484,17 @@ func (client SecurityGroupsClient) UpdateTagsPreparer(ctx context.Context, resou // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) UpdateTagsSender(req *http.Request) (future SecurityGroupsUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/securityrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/securityrules.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/securityrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/securityrules.go index d7489b3779735..b80d4de4108de 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/securityrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/securityrules.go @@ -70,7 +70,7 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +88,17 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(ctx context.Context, re // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (future SecurityRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -143,7 +145,7 @@ func (client SecurityRulesClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,15 +161,17 @@ func (client SecurityRulesClient) DeletePreparer(ctx context.Context, resourceGr // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) DeleteSender(req *http.Request) (future SecurityRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -219,7 +223,7 @@ func (client SecurityRulesClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -287,7 +291,7 @@ func (client SecurityRulesClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/subnets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/subnets.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/subnets.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/subnets.go index 16d25635463d0..9e84618cb41be 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/subnets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/subnets.go @@ -70,7 +70,7 @@ func (client SubnetsClient) CreateOrUpdatePreparer(ctx context.Context, resource "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +88,17 @@ func (client SubnetsClient) CreateOrUpdatePreparer(ctx context.Context, resource // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (future SubnetsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -143,7 +145,7 @@ func (client SubnetsClient) DeletePreparer(ctx context.Context, resourceGroupNam "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,15 +161,17 @@ func (client SubnetsClient) DeletePreparer(ctx context.Context, resourceGroupNam // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) DeleteSender(req *http.Request) (future SubnetsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -220,7 +224,7 @@ func (client SubnetsClient) GetPreparer(ctx context.Context, resourceGroupName s "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -291,7 +295,7 @@ func (client SubnetsClient) ListPreparer(ctx context.Context, resourceGroupName "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/usages.go similarity index 97% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/usages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/usages.go index 356764fdb2fb5..e61c2f427cb38 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/usages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/usages.go @@ -46,7 +46,7 @@ func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesCli func (client UsagesClient) List(ctx context.Context, location string) (result UsagesListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: location, - Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._ ]+$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { return result, validation.NewError("network.UsagesClient", "List", err.Error()) } @@ -79,7 +79,7 @@ func (client UsagesClient) ListPreparer(ctx context.Context, location string) (* "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/version.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/version.go index e1fe174ca4f67..532dfd965068b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " network/2017-09-01" + return "Azure-SDK-For-Go/" + version.Number + " network/2018-04-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkgatewayconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkgatewayconnections.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkgatewayconnections.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkgatewayconnections.go index 011f852f3abfd..047ad12328b91 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkgatewayconnections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkgatewayconnections.go @@ -83,7 +83,7 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -101,15 +101,17 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -154,7 +156,7 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context. "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -170,15 +172,17 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewayConnectionsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -228,7 +232,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(ctx context.Con "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -296,7 +300,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(ctx co "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -363,7 +367,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -464,7 +468,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -482,15 +486,17 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx // ResetSharedKeySender sends the ResetSharedKey request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -545,7 +551,7 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx co "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -563,15 +569,17 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx co // SetSharedKeySender sends the SetSharedKey request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -617,7 +625,7 @@ func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsPreparer(ctx cont "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -635,15 +643,17 @@ func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsPreparer(ctx cont // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkgateways.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkgateways.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkgateways.go index 5c027ce5df59c..f9035959c5a55 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkgateways.go @@ -75,7 +75,7 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Co "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -93,15 +93,17 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Co // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewaysCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -146,7 +148,7 @@ func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, r "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,15 +164,17 @@ func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, r // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewaysDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -216,7 +220,7 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -234,15 +238,17 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx // GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -289,7 +295,7 @@ func (client VirtualNetworkGatewaysClient) GenerateVpnProfilePreparer(ctx contex "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -307,15 +313,17 @@ func (client VirtualNetworkGatewaysClient) GenerateVpnProfilePreparer(ctx contex // GenerateVpnProfileSender sends the GenerateVpnProfile request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GenerateVpnProfileSender(req *http.Request) (future VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -366,7 +374,7 @@ func (client VirtualNetworkGatewaysClient) GetPreparer(ctx context.Context, reso "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -429,7 +437,7 @@ func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(ctx conte "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, "peer": autorest.Encode("query", peer), @@ -446,15 +454,17 @@ func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(ctx conte // GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -500,7 +510,7 @@ func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(ctx context. "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -519,15 +529,17 @@ func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(ctx context. // GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (future VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -573,7 +585,7 @@ func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(ctx context. "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -589,15 +601,17 @@ func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(ctx context. // GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -614,6 +628,79 @@ func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http. return } +// GetVpnclientIpsecParameters the Get VpnclientIpsecParameters operation retrieves information about the vpnclient +// ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource +// provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the virtual network gateway name. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) { + req, err := client.GetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", nil, "Failure preparing request") + return + } + + result, err = client.GetVpnclientIpsecParametersSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", result.Response(), "Failure sending request") + return + } + + return +} + +// GetVpnclientIpsecParametersPreparer prepares the GetVpnclientIpsecParameters request. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2018-04-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/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVpnclientIpsecParametersSender sends the GetVpnclientIpsecParameters request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// GetVpnclientIpsecParametersResponder handles the response to the GetVpnclientIpsecParameters request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // GetVpnProfilePackageURL gets pre-generated VPN profile for P2S client of the virtual network gateway in the // specified resource group. The profile needs to be generated first using generateVpnProfile. // Parameters: @@ -643,7 +730,7 @@ func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx c "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -659,15 +746,17 @@ func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx c // GetVpnProfilePackageURLSender sends the GetVpnProfilePackageURL request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -717,7 +806,7 @@ func (client VirtualNetworkGatewaysClient) ListPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -812,7 +901,7 @@ func (client VirtualNetworkGatewaysClient) ListConnectionsPreparer(ctx context.C "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -902,7 +991,7 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, re "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -921,15 +1010,17 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, re // ResetSender sends the Reset request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (future VirtualNetworkGatewaysResetFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -946,6 +1037,89 @@ func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) ( return } +// SetVpnclientIpsecParameters the Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S +// client of virtual network gateway in the specified resource group through Network resource provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// vpnclientIpsecParams - parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network +// Gateway P2S client operation through Network resource provider. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (result VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: vpnclientIpsecParams, + Constraints: []validation.Constraint{{Target: "vpnclientIpsecParams.SaLifeTimeSeconds", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "vpnclientIpsecParams.SaDataSizeKilobytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", err.Error()) + } + + req, err := client.SetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", nil, "Failure preparing request") + return + } + + result, err = client.SetVpnclientIpsecParametersSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", result.Response(), "Failure sending request") + return + } + + return +} + +// SetVpnclientIpsecParametersPreparer prepares the SetVpnclientIpsecParameters request. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2018-04-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/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters", pathParameters), + autorest.WithJSON(vpnclientIpsecParams), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetVpnclientIpsecParametersSender sends the SetVpnclientIpsecParameters request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// SetVpnclientIpsecParametersResponder handles the response to the SetVpnclientIpsecParameters request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // SupportedVpnDevices gets a xml format representation for supported vpn devices. // Parameters: // resourceGroupName - the name of the resource group. @@ -980,7 +1154,7 @@ func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesPreparer(ctx conte "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1042,7 +1216,7 @@ func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Contex "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1060,15 +1234,17 @@ func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Contex // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewaysUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1121,7 +1297,7 @@ func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptPreparer( "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkpeerings.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkpeerings.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkpeerings.go index 47c8df88da5e6..83bd94c09f5d4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworkpeerings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworkpeerings.go @@ -71,7 +71,7 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(ctx context.Co "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -89,15 +89,17 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(ctx context.Co // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkPeeringsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -144,7 +146,7 @@ func (client VirtualNetworkPeeringsClient) DeletePreparer(ctx context.Context, r "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,15 +162,17 @@ func (client VirtualNetworkPeeringsClient) DeletePreparer(ctx context.Context, r // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (future VirtualNetworkPeeringsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -220,7 +224,7 @@ func (client VirtualNetworkPeeringsClient) GetPreparer(ctx context.Context, reso "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -288,7 +292,7 @@ func (client VirtualNetworkPeeringsClient) ListPreparer(ctx context.Context, res "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworks.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworks.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworks.go index cdc9dbf334b54..4de0e606edbf3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/virtualnetworks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/virtualnetworks.go @@ -74,7 +74,7 @@ func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx conte "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -139,7 +139,7 @@ func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,15 +157,17 @@ func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -210,7 +212,7 @@ func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resource "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -226,15 +228,17 @@ func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resource // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -285,7 +289,7 @@ func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGro "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -354,7 +358,7 @@ func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -444,7 +448,7 @@ func (client VirtualNetworksClient) ListAllPreparer(ctx context.Context) (*http. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -539,7 +543,7 @@ func (client VirtualNetworksClient) ListUsagePreparer(ctx context.Context, resou "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -628,7 +632,7 @@ func (client VirtualNetworksClient) UpdateTagsPreparer(ctx context.Context, reso "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -646,15 +650,17 @@ func (client VirtualNetworksClient) UpdateTagsPreparer(ctx context.Context, reso // 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) (future VirtualNetworksUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/watchers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/watchers.go similarity index 91% rename from vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/watchers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/watchers.go index 25c50de7dd11b..0d9725f91d9d8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network/watchers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network/watchers.go @@ -78,7 +78,7 @@ func (client WatchersClient) CheckConnectivityPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -96,15 +96,17 @@ func (client WatchersClient) CheckConnectivityPreparer(ctx context.Context, reso // CheckConnectivitySender sends the CheckConnectivity request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) CheckConnectivitySender(req *http.Request) (future WatchersCheckConnectivityFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -156,7 +158,7 @@ func (client WatchersClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -219,7 +221,7 @@ func (client WatchersClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -235,15 +237,17 @@ func (client WatchersClient) DeletePreparer(ctx context.Context, resourceGroupNa // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) DeleteSender(req *http.Request) (future WatchersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -293,7 +297,7 @@ func (client WatchersClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -365,7 +369,7 @@ func (client WatchersClient) GetAzureReachabilityReportPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -383,15 +387,17 @@ func (client WatchersClient) GetAzureReachabilityReportPreparer(ctx context.Cont // GetAzureReachabilityReportSender sends the GetAzureReachabilityReport request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetAzureReachabilityReportSender(req *http.Request) (future WatchersGetAzureReachabilityReportFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -408,11 +414,11 @@ func (client WatchersClient) GetAzureReachabilityReportResponder(resp *http.Resp return } -// GetFlowLogStatus queries status of flow log on a specified resource. +// GetFlowLogStatus queries status of flow log and traffic analytics (optional) on a specified resource. // Parameters: // resourceGroupName - the name of the network watcher resource group. // networkWatcherName - the name of the network watcher resource. -// parameters - parameters that define a resource to query flow log status. +// parameters - parameters that define a resource to query flow log and traffic analytics (optional) status. func (client WatchersClient) GetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (result WatchersGetFlowLogStatusFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -443,7 +449,7 @@ func (client WatchersClient) GetFlowLogStatusPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -461,15 +467,17 @@ func (client WatchersClient) GetFlowLogStatusPreparer(ctx context.Context, resou // GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetFlowLogStatusSender(req *http.Request) (future WatchersGetFlowLogStatusFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -523,7 +531,7 @@ func (client WatchersClient) GetNextHopPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -541,15 +549,17 @@ func (client WatchersClient) GetNextHopPreparer(ctx context.Context, resourceGro // GetNextHopSender sends the GetNextHop request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetNextHopSender(req *http.Request) (future WatchersGetNextHopFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -572,12 +582,6 @@ func (client WatchersClient) GetNextHopResponder(resp *http.Response) (result Ne // networkWatcherName - the name of the network watcher. // parameters - parameters that define the representation of topology. func (client WatchersClient) GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceGroupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("network.WatchersClient", "GetTopology", err.Error()) - } - req, err := client.GetTopologyPreparer(ctx, resourceGroupName, networkWatcherName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", nil, "Failure preparing request") @@ -607,7 +611,7 @@ func (client WatchersClient) GetTopologyPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -681,7 +685,7 @@ func (client WatchersClient) GetTroubleshootingPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -699,15 +703,17 @@ func (client WatchersClient) GetTroubleshootingPreparer(ctx context.Context, res // GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetTroubleshootingSender(req *http.Request) (future WatchersGetTroubleshootingFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -759,7 +765,7 @@ func (client WatchersClient) GetTroubleshootingResultPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -777,15 +783,17 @@ func (client WatchersClient) GetTroubleshootingResultPreparer(ctx context.Contex // GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetTroubleshootingResultSender(req *http.Request) (future WatchersGetTroubleshootingResultFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -837,7 +845,7 @@ func (client WatchersClient) GetVMSecurityRulesPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -855,15 +863,17 @@ func (client WatchersClient) GetVMSecurityRulesPreparer(ctx context.Context, res // GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetVMSecurityRulesSender(req *http.Request) (future WatchersGetVMSecurityRulesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -912,7 +922,7 @@ func (client WatchersClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -974,7 +984,7 @@ func (client WatchersClient) ListAllPreparer(ctx context.Context) (*http.Request "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1036,7 +1046,7 @@ func (client WatchersClient) ListAvailableProvidersPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1054,15 +1064,17 @@ func (client WatchersClient) ListAvailableProvidersPreparer(ctx context.Context, // ListAvailableProvidersSender sends the ListAvailableProviders request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) ListAvailableProvidersSender(req *http.Request) (future WatchersListAvailableProvidersFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1079,7 +1091,7 @@ func (client WatchersClient) ListAvailableProvidersResponder(resp *http.Response return } -// SetFlowLogConfiguration configures flow log on a specified resource. +// SetFlowLogConfiguration configures flow log and traffic analytics (optional) on a specified resource. // Parameters: // resourceGroupName - the name of the network watcher resource group. // networkWatcherName - the name of the network watcher resource. @@ -1091,6 +1103,14 @@ func (client WatchersClient) SetFlowLogConfiguration(ctx context.Context, resour {Target: "parameters.FlowLogProperties", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.FlowAnalyticsConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceRegion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceResourceID", Name: validation.Null, Rule: true, Chain: nil}, + }}, }}}}}); err != nil { return result, validation.NewError("network.WatchersClient", "SetFlowLogConfiguration", err.Error()) } @@ -1118,7 +1138,7 @@ func (client WatchersClient) SetFlowLogConfigurationPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1136,15 +1156,17 @@ func (client WatchersClient) SetFlowLogConfigurationPreparer(ctx context.Context // SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) SetFlowLogConfigurationSender(req *http.Request) (future WatchersSetFlowLogConfigurationFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1196,7 +1218,7 @@ func (client WatchersClient) UpdateTagsPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1270,7 +1292,7 @@ func (client WatchersClient) VerifyIPFlowPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-04-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1288,15 +1310,17 @@ func (client WatchersClient) VerifyIPFlowPreparer(ctx context.Context, resourceG // VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) VerifyIPFlowSender(req *http.Request) (future WatchersVerifyIPFlowFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/version.go deleted file mode 100644 index 32430ea08157a..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/version.go +++ /dev/null @@ -1,31 +0,0 @@ -package operationalinsights - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " operationalinsights/2015-11-01-preview" -} - -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. -// 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/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/version.go deleted file mode 100644 index 714ccbcdda6a9..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/version.go +++ /dev/null @@ -1,31 +0,0 @@ -package operationsmanagement - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " operationsmanagement/2015-11-01-preview" -} - -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. -// 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/postgresql/mgmt/2017-04-30-preview/postgresql/performancetiers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/performancetiers.go deleted file mode 100644 index c55894d8af49c..0000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/performancetiers.go +++ /dev/null @@ -1,104 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// 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" - "net/http" -) - -// PerformanceTiersClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, log files and -// configurations. -type PerformanceTiersClient struct { - BaseClient -} - -// NewPerformanceTiersClient creates an instance of the PerformanceTiersClient client. -func NewPerformanceTiersClient(subscriptionID string) PerformanceTiersClient { - return NewPerformanceTiersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPerformanceTiersClientWithBaseURI creates an instance of the PerformanceTiersClient client. -func NewPerformanceTiersClientWithBaseURI(baseURI string, subscriptionID string) PerformanceTiersClient { - return PerformanceTiersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all the performance tiers in a given subscription. -func (client PerformanceTiersClient) List(ctx context.Context) (result PerformanceTierListResult, err error) { - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PerformanceTiersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.PerformanceTiersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PerformanceTiersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PerformanceTiersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/performanceTiers", 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 PerformanceTiersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PerformanceTiersClient) ListResponder(resp *http.Response) (result PerformanceTierListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - 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/postgresql/mgmt/2017-04-30-preview/postgresql/checknameavailability.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/checknameavailability.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/checknameavailability.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/checknameavailability.go index 970bbb8312182..ba3edddcfb202 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/checknameavailability.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/checknameavailability.go @@ -26,8 +26,8 @@ import ( ) // CheckNameAvailabilityClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, log files and -// configurations. +// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security +// alert policies, log files and configurations with new business model. type CheckNameAvailabilityClient struct { BaseClient } @@ -43,8 +43,8 @@ func NewCheckNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID st } // Execute check the availability of name for resource -// -// nameAvailabilityRequest is the required parameters for checking if resource name is available. +// Parameters: +// nameAvailabilityRequest - the required parameters for checking if resource name is available. func (client CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (result NameAvailability, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: nameAvailabilityRequest, @@ -79,7 +79,7 @@ func (client CheckNameAvailabilityClient) ExecutePreparer(ctx context.Context, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/client.go similarity index 90% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/client.go index 6c97a46756e59..13f6e3a49759d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/client.go @@ -1,7 +1,8 @@ -// Package postgresql implements the Azure ARM Postgresql service API version 2017-04-30-preview. +// Package postgresql implements the Azure ARM Postgresql service API version 2017-12-01. // // The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL -// resources including servers, databases, firewall rules, log files and configurations. +// resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and +// configurations with new business model. package postgresql // Copyright (c) Microsoft and contributors. All rights reserved. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/configurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/configurations.go similarity index 87% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/configurations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/configurations.go index 91008239bbdcd..62adef66e5d14 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/configurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/configurations.go @@ -25,8 +25,8 @@ import ( ) // ConfigurationsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, log files and -// configurations. +// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security +// alert policies, log files and configurations with new business model. type ConfigurationsClient struct { BaseClient } @@ -42,10 +42,12 @@ func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) C } // CreateOrUpdate updates a configuration of a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. configurationName is the -// name of the server configuration. parameters is the required parameters for updating a server configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// configurationName - the name of the server configuration. +// parameters - the required parameters for updating a server configuration. func (client ConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, configurationName, parameters) if err != nil { @@ -71,7 +73,7 @@ func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -89,15 +91,17 @@ func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, r // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -115,10 +119,11 @@ func (client ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) } // Get gets information about a configuration of server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. configurationName is the -// name of the server configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// configurationName - the name of the server configuration. func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, configurationName) if err != nil { @@ -150,7 +155,7 @@ func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -184,9 +189,10 @@ func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Con } // ListByServer list all the configurations in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ConfigurationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ConfigurationListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -217,7 +223,7 @@ func (client ConfigurationsClient) ListByServerPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/databases.go similarity index 85% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/databases.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/databases.go index 37933fe3a8c02..d069e2d9e73c8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/databases.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/databases.go @@ -25,7 +25,8 @@ import ( ) // DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, +// log files and configurations with new business model. type DatabasesClient struct { BaseClient } @@ -41,10 +42,12 @@ func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) Databa } // CreateOrUpdate creates a new database or updates an existing database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. parameters is the required parameters for creating or updating a database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// parameters - the required parameters for creating or updating a database. func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -70,7 +73,7 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -88,15 +91,17 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -114,10 +119,11 @@ func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (resu } // Delete deletes a database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -143,7 +149,7 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,15 +165,17 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -184,10 +192,11 @@ func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autor } // Get gets information about a database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -219,7 +228,7 @@ func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -253,9 +262,10 @@ func (client DatabasesClient) GetResponder(resp *http.Response) (result Database } // ListByServer list all the databases in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -286,7 +296,7 @@ func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/firewallrules.go similarity index 86% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/firewallrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/firewallrules.go index e7a72bee7cbbc..eacdf075f25d2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/firewallrules.go @@ -26,8 +26,8 @@ import ( ) // FirewallRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, log files and -// configurations. +// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security +// alert policies, log files and configurations with new business model. type FirewallRulesClient struct { BaseClient } @@ -43,10 +43,12 @@ func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) Fi } // CreateOrUpdate creates a new firewall rule or updates an existing firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the server firewall rule. parameters is the required parameters for creating or updating a firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the server firewall rule. +// parameters - the required parameters for creating or updating a firewall rule. func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRulesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -83,7 +85,7 @@ func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -101,15 +103,17 @@ func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, re // 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) (future FirewallRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -127,10 +131,11 @@ func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) ( } // Delete deletes a server firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the server firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the server firewall rule. func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRulesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) if err != nil { @@ -156,7 +161,7 @@ func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -172,15 +177,17 @@ func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGr // 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) (future FirewallRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -197,10 +204,11 @@ func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result a } // Get gets information about a server firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the server firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the server firewall rule. func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) if err != nil { @@ -232,7 +240,7 @@ func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -266,9 +274,10 @@ func (client FirewallRulesClient) GetResponder(resp *http.Response) (result Fire } // ListByServer list all the firewall rules in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -299,7 +308,7 @@ func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/locationbasedperformancetier.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/locationbasedperformancetier.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/locationbasedperformancetier.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/locationbasedperformancetier.go index 7e24e1ce81f8f..e67344f714bf6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/locationbasedperformancetier.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/locationbasedperformancetier.go @@ -25,8 +25,8 @@ import ( ) // LocationBasedPerformanceTierClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, log files and -// configurations. +// delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, +// security alert policies, log files and configurations with new business model. type LocationBasedPerformanceTierClient struct { BaseClient } @@ -43,8 +43,8 @@ func NewLocationBasedPerformanceTierClientWithBaseURI(baseURI string, subscripti } // List list all the performance tiers at specified location in a given subscription. -// -// locationName is the name of the location. +// Parameters: +// locationName - the name of the location. func (client LocationBasedPerformanceTierClient) List(ctx context.Context, locationName string) (result PerformanceTierListResult, err error) { req, err := client.ListPreparer(ctx, locationName) if err != nil { @@ -74,7 +74,7 @@ func (client LocationBasedPerformanceTierClient) ListPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/logfiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/logfiles.go similarity index 92% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/logfiles.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/logfiles.go index 9a9e22cc41c57..af9c90a140033 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/logfiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/logfiles.go @@ -25,7 +25,8 @@ import ( ) // LogFilesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +// Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log +// files and configurations with new business model. type LogFilesClient struct { BaseClient } @@ -41,9 +42,10 @@ func NewLogFilesClientWithBaseURI(baseURI string, subscriptionID string) LogFile } // ListByServer list all the log files in a given server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client LogFilesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result LogFileListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -74,7 +76,7 @@ func (client LogFilesClient) ListByServerPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/models.go similarity index 61% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/models.go index 5306cbd160bb9..9467e3fd8e529 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/models.go @@ -22,6 +22,7 @@ import ( "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" "net/http" ) @@ -31,6 +32,8 @@ type CreateMode string const ( // CreateModeDefault ... CreateModeDefault CreateMode = "Default" + // CreateModeGeoRestore ... + CreateModeGeoRestore CreateMode = "GeoRestore" // CreateModePointInTimeRestore ... CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" // CreateModeServerPropertiesForCreate ... @@ -39,7 +42,22 @@ const ( // PossibleCreateModeValues returns an array of possible values for the CreateMode const type. func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeDefault, CreateModePointInTimeRestore, CreateModeServerPropertiesForCreate} + return []CreateMode{CreateModeDefault, CreateModeGeoRestore, CreateModePointInTimeRestore, CreateModeServerPropertiesForCreate} +} + +// GeoRedundantBackup enumerates the values for geo redundant backup. +type GeoRedundantBackup string + +const ( + // Disabled ... + Disabled GeoRedundantBackup = "Disabled" + // Enabled ... + Enabled GeoRedundantBackup = "Enabled" +) + +// PossibleGeoRedundantBackupValues returns an array of possible values for the GeoRedundantBackup const type. +func PossibleGeoRedundantBackupValues() []GeoRedundantBackup { + return []GeoRedundantBackup{Disabled, Enabled} } // OperationOrigin enumerates the values for operation origin. @@ -59,21 +77,36 @@ func PossibleOperationOriginValues() []OperationOrigin { return []OperationOrigin{NotSpecified, System, User} } +// ServerSecurityAlertPolicyState enumerates the values for server security alert policy state. +type ServerSecurityAlertPolicyState string + +const ( + // ServerSecurityAlertPolicyStateDisabled ... + ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled" + // ServerSecurityAlertPolicyStateEnabled ... + ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" +) + +// PossibleServerSecurityAlertPolicyStateValues returns an array of possible values for the ServerSecurityAlertPolicyState const type. +func PossibleServerSecurityAlertPolicyStateValues() []ServerSecurityAlertPolicyState { + return []ServerSecurityAlertPolicyState{ServerSecurityAlertPolicyStateDisabled, ServerSecurityAlertPolicyStateEnabled} +} + // ServerState enumerates the values for server state. type ServerState string const ( - // Disabled ... - Disabled ServerState = "Disabled" - // Dropping ... - Dropping ServerState = "Dropping" - // Ready ... - Ready ServerState = "Ready" + // ServerStateDisabled ... + ServerStateDisabled ServerState = "Disabled" + // ServerStateDropping ... + ServerStateDropping ServerState = "Dropping" + // ServerStateReady ... + ServerStateReady ServerState = "Ready" ) // PossibleServerStateValues returns an array of possible values for the ServerState const type. func PossibleServerStateValues() []ServerState { - return []ServerState{Disabled, Dropping, Ready} + return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady} } // ServerVersion enumerates the values for server version. @@ -97,13 +130,15 @@ type SkuTier string const ( // Basic ... Basic SkuTier = "Basic" - // Standard ... - Standard SkuTier = "Standard" + // GeneralPurpose ... + GeneralPurpose SkuTier = "GeneralPurpose" + // MemoryOptimized ... + MemoryOptimized SkuTier = "MemoryOptimized" ) // PossibleSkuTierValues returns an array of possible values for the SkuTier const type. func PossibleSkuTierValues() []SkuTier { - return []SkuTier{Basic, Standard} + return []SkuTier{Basic, GeneralPurpose, MemoryOptimized} } // SslEnforcementEnum enumerates the values for ssl enforcement enum. @@ -121,6 +156,27 @@ func PossibleSslEnforcementEnumValues() []SslEnforcementEnum { return []SslEnforcementEnum{SslEnforcementEnumDisabled, SslEnforcementEnumEnabled} } +// VirtualNetworkRuleState enumerates the values for virtual network rule state. +type VirtualNetworkRuleState string + +const ( + // Deleting ... + Deleting VirtualNetworkRuleState = "Deleting" + // Initializing ... + Initializing VirtualNetworkRuleState = "Initializing" + // InProgress ... + InProgress VirtualNetworkRuleState = "InProgress" + // Ready ... + Ready VirtualNetworkRuleState = "Ready" + // Unknown ... + Unknown VirtualNetworkRuleState = "Unknown" +) + +// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. +func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { + return []VirtualNetworkRuleState{Deleting, Initializing, InProgress, Ready, Unknown} +} + // Configuration represents a Configuration. type Configuration struct { autorest.Response `json:"-"` @@ -230,12 +286,11 @@ type ConfigurationProperties struct { // operation. type ConfigurationsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ConfigurationsCreateOrUpdateFuture) Result(client ConfigurationsClient) (c Configuration, err error) { +func (future *ConfigurationsCreateOrUpdateFuture) Result(client ConfigurationsClient) (c Configuration, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -243,34 +298,15 @@ func (future ConfigurationsCreateOrUpdateFuture) Result(client ConfigurationsCli return } if !done { - return c, azure.NewAsyncOpIncompleteError("postgresql.ConfigurationsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - c, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("postgresql.ConfigurationsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - c, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -376,12 +412,11 @@ type DatabaseProperties struct { // operation. type DatabasesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -389,34 +424,15 @@ func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Da return } if !done { - return d, azure.NewAsyncOpIncompleteError("postgresql.DatabasesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - d, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("postgresql.DatabasesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - d, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -424,12 +440,11 @@ func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Da // DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DatabasesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { +func (future *DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -437,35 +452,10 @@ func (future DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest. return } if !done { - return ar, azure.NewAsyncOpIncompleteError("postgresql.DatabasesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("postgresql.DatabasesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -570,12 +560,11 @@ type FirewallRuleProperties struct { // operation. type FirewallRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClient) (fr FirewallRule, err error) { +func (future *FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClient) (fr FirewallRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -583,34 +572,15 @@ func (future FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClien return } if !done { - return fr, azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { + fr, err = client.CreateOrUpdateResponder(fr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - fr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -618,12 +588,11 @@ func (future FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClien // FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type FirewallRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FirewallRulesDeleteFuture) Result(client FirewallRulesClient) (ar autorest.Response, err error) { +func (future *FirewallRulesDeleteFuture) Result(client FirewallRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -631,35 +600,10 @@ func (future FirewallRulesDeleteFuture) Result(client FirewallRulesClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -753,8 +697,6 @@ type LogFileListResult struct { // LogFileProperties the properties of a log file. type LogFileProperties struct { - // Name - Log file name. - Name *string `json:"name,omitempty"` // SizeInKB - Size of the log file. SizeInKB *int64 `json:"sizeInKB,omitempty"` // CreatedTime - Creation timestamp of the log file. @@ -846,8 +788,6 @@ type PerformanceTierListResult struct { type PerformanceTierProperties struct { // ID - ID of the performance tier. ID *string `json:"id,omitempty"` - // BackupRetentionDays - Backup retention in days for the performance tier edition - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` // ServiceLevelObjectives - Service level objectives associated with the performance tier ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` } @@ -858,10 +798,18 @@ type PerformanceTierServiceLevelObjectives struct { ID *string `json:"id,omitempty"` // Edition - Edition of the performance tier. Edition *string `json:"edition,omitempty"` - // Dtu - Database throughput unit associated with the service level objective - Dtu *int32 `json:"dtu,omitempty"` - // StorageMB - Maximum storage in MB associated with the service level objective - StorageMB *int32 `json:"storageMB,omitempty"` + // VCore - vCore associated with the service level objective + VCore *int32 `json:"vCore,omitempty"` + // HardwareGeneration - Hardware generation associated with the service level objective + HardwareGeneration *string `json:"hardwareGeneration,omitempty"` + // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition + MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` + // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition + MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` + // MaxStorageMB - Max storage allowed for a server. + MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` + // MinStorageMB - Max storage allowed for a server. + MinStorageMB *int32 `json:"minStorageMB,omitempty"` } // ProxyResource resource properties. @@ -874,6 +822,24 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } +// SecurityAlertPolicyProperties properties of a security alert policy. +type SecurityAlertPolicyProperties struct { + // State - Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'ServerSecurityAlertPolicyStateEnabled', 'ServerSecurityAlertPolicyStateDisabled' + State ServerSecurityAlertPolicyState `json:"state,omitempty"` + // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly + DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` + // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. + EmailAddresses *[]string `json:"emailAddresses,omitempty"` + // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. + EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` + // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + StorageEndpoint *string `json:"storageEndpoint,omitempty"` + // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. + RetentionDays *int32 `json:"retentionDays,omitempty"` +} + // Server represents a server. type Server struct { autorest.Response `json:"-"` @@ -1087,34 +1053,37 @@ type ServerListResult struct { type ServerProperties struct { // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). AdministratorLogin *string `json:"administratorLogin,omitempty"` - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // UserVisibleState - A state of a server that is visible to user. Possible values include: 'Ready', 'Dropping', 'Disabled' + // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled' UserVisibleState ServerState `json:"userVisibleState,omitempty"` // FullyQualifiedDomainName - The fully qualified domain name of a server. FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + // EarliestRestoreDate - Earliest restore point creation time (ISO8601 format) + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` } // BasicServerPropertiesForCreate the properties used to create a new server. type BasicServerPropertiesForCreate interface { AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) + AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) } // ServerPropertiesForCreate the properties used to create a new server. type ServerPropertiesForCreate struct { - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore' + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' CreateMode CreateMode `json:"createMode,omitempty"` } @@ -1134,6 +1103,10 @@ func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerProperties var spfr ServerPropertiesForRestore err := json.Unmarshal(body, &spfr) return spfr, err + case string(CreateModeGeoRestore): + var spfgr ServerPropertiesForGeoRestore + err := json.Unmarshal(body, &spfgr) + return spfgr, err default: var spfc ServerPropertiesForCreate err := json.Unmarshal(body, &spfc) @@ -1163,15 +1136,15 @@ func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPro func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { spfc.CreateMode = CreateModeServerPropertiesForCreate objectMap := make(map[string]interface{}) - if spfc.StorageMB != nil { - objectMap["storageMB"] = spfc.StorageMB - } if spfc.Version != "" { objectMap["version"] = spfc.Version } if spfc.SslEnforcement != "" { objectMap["sslEnforcement"] = spfc.SslEnforcement } + if spfc.StorageProfile != nil { + objectMap["storageProfile"] = spfc.StorageProfile + } if spfc.CreateMode != "" { objectMap["createMode"] = spfc.CreateMode } @@ -1188,6 +1161,11 @@ func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPro return nil, false } +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. +func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return nil, false +} + // AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { return &spfc, true @@ -1204,13 +1182,13 @@ type ServerPropertiesForDefaultCreate struct { AdministratorLogin *string `json:"administratorLogin,omitempty"` // AdministratorLoginPassword - The password of the administrator login. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore' + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' CreateMode CreateMode `json:"createMode,omitempty"` } @@ -1224,15 +1202,15 @@ func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { if spfdc.AdministratorLoginPassword != nil { objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword } - if spfdc.StorageMB != nil { - objectMap["storageMB"] = spfdc.StorageMB - } if spfdc.Version != "" { objectMap["version"] = spfdc.Version } if spfdc.SslEnforcement != "" { objectMap["sslEnforcement"] = spfdc.SslEnforcement } + if spfdc.StorageProfile != nil { + objectMap["storageProfile"] = spfdc.StorageProfile + } if spfdc.CreateMode != "" { objectMap["createMode"] = spfdc.CreateMode } @@ -1249,6 +1227,11 @@ func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*S return nil, false } +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. +func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return nil, false +} + // AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { return nil, false @@ -1259,19 +1242,81 @@ func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() return &spfdc, true } -// ServerPropertiesForRestore the properties to a new server by restoring from a backup. +// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different region from +// a geo replicated backup. +type ServerPropertiesForGeoRestore struct { + // SourceServerID - The source server id to restore from. + SourceServerID *string `json:"sourceServerId,omitempty"` + // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix' + Version ServerVersion `json:"version,omitempty"` + // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' + SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' + CreateMode CreateMode `json:"createMode,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { + spfgr.CreateMode = CreateModeGeoRestore + objectMap := make(map[string]interface{}) + if spfgr.SourceServerID != nil { + objectMap["sourceServerId"] = spfgr.SourceServerID + } + if spfgr.Version != "" { + objectMap["version"] = spfgr.Version + } + if spfgr.SslEnforcement != "" { + objectMap["sslEnforcement"] = spfgr.SslEnforcement + } + if spfgr.StorageProfile != nil { + objectMap["storageProfile"] = spfgr.StorageProfile + } + if spfgr.CreateMode != "" { + objectMap["createMode"] = spfgr.CreateMode + } + return json.Marshal(objectMap) +} + +// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { + return nil, false +} + +// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { + return nil, false +} + +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return &spfgr, true +} + +// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { + return nil, false +} + +// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. +func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { + return &spfgr, true +} + +// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup. type ServerPropertiesForRestore struct { // SourceServerID - The source server id to restore from. SourceServerID *string `json:"sourceServerId,omitempty"` // RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from. RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // StorageMB - The maximum storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix' Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore' + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore' CreateMode CreateMode `json:"createMode,omitempty"` } @@ -1285,15 +1330,15 @@ func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { if spfr.RestorePointInTime != nil { objectMap["restorePointInTime"] = spfr.RestorePointInTime } - if spfr.StorageMB != nil { - objectMap["storageMB"] = spfr.StorageMB - } if spfr.Version != "" { objectMap["version"] = spfr.Version } if spfr.SslEnforcement != "" { objectMap["sslEnforcement"] = spfr.SslEnforcement } + if spfr.StorageProfile != nil { + objectMap["storageProfile"] = spfr.StorageProfile + } if spfr.CreateMode != "" { objectMap["createMode"] = spfr.CreateMode } @@ -1310,6 +1355,11 @@ func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPr return &spfr, true } +// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. +func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { + return nil, false +} + // AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { return nil, false @@ -1323,12 +1373,11 @@ func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (Basic // ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersCreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersCreateFuture) Result(client ServersClient) (s Server, err error) { +func (future *ServersCreateFuture) Result(client ServersClient) (s Server, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1336,34 +1385,15 @@ func (future ServersCreateFuture) Result(client ServersClient) (s Server, err er return } if !done { - return s, azure.NewAsyncOpIncompleteError("postgresql.ServersCreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("postgresql.ServersCreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.CreateResponder(s.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", resp, "Failure responding to request") } return } @@ -1371,12 +1401,11 @@ func (future ServersCreateFuture) Result(client ServersClient) (s Server, err er // ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) { +func (future *ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1384,47 +1413,132 @@ func (future ServersDeleteFuture) Result(client ServersClient) (ar autorest.Resp return } if !done { - return ar, azure.NewAsyncOpIncompleteError("postgresql.ServersDeleteFuture") + err = azure.NewAsyncOpIncompleteError("postgresql.ServersDeleteFuture") + return } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + ar.Response = future.Response() + return +} + +// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) Result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { + ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersDeleteFuture", "Result", resp, "Failure sending request") - return + return +} + +// ServerSecurityAlertPolicy a server security alert policy. +type ServerSecurityAlertPolicy struct { + autorest.Response `json:"-"` + // SecurityAlertPolicyProperties - Resource properties. + *SecurityAlertPolicyProperties `json:"properties,omitempty"` + // ID - Resource ID + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. +func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssap.SecurityAlertPolicyProperties != nil { + objectMap["properties"] = ssap.SecurityAlertPolicyProperties + } + if ssap.ID != nil { + objectMap["id"] = ssap.ID + } + if ssap.Name != nil { + objectMap["name"] = ssap.Name } - ar, err = client.DeleteResponder(resp) + if ssap.Type != nil { + objectMap["type"] = ssap.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. +func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersDeleteFuture", "Result", resp, "Failure responding to request") + return err } - return + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityAlertPolicyProperties SecurityAlertPolicyProperties + err = json.Unmarshal(*v, &securityAlertPolicyProperties) + if err != nil { + return err + } + ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssap.Type = &typeVar + } + } + } + + return nil } // ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersUpdateFuture) Result(client ServersClient) (s Server, err error) { +func (future *ServersUpdateFuture) Result(client ServersClient) (s Server, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1432,34 +1546,15 @@ func (future ServersUpdateFuture) Result(client ServersClient) (s Server, err er return } if !done { - return s, azure.NewAsyncOpIncompleteError("postgresql.ServersUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("postgresql.ServersUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1533,8 +1628,8 @@ func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { // ServerUpdateParametersProperties the properties that can be updated for a server. type ServerUpdateParametersProperties struct { - // StorageMB - The max storage allowed for a server. - StorageMB *int64 `json:"storageMB,omitempty"` + // StorageProfile - Storage profile of a server. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // AdministratorLoginPassword - The password of the administrator login. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` // Version - The version of a server. Possible values include: 'NineFullStopFive', 'NineFullStopSix' @@ -1545,9 +1640,9 @@ type ServerUpdateParametersProperties struct { // Sku billing information related properties of a server. type Sku struct { - // Name - The name of the sku, typically, a letter + Number code, e.g. P3. + // Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'Standard' + // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' Tier SkuTier `json:"tier,omitempty"` // Capacity - The scale up/out capacity, representing server's compute units. Capacity *int32 `json:"capacity,omitempty"` @@ -1557,6 +1652,16 @@ type Sku struct { Family *string `json:"family,omitempty"` } +// StorageProfile storage Profile properties of a server +type StorageProfile struct { + // BackupRetentionDays - Backup retention days for the server. + BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` + // GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled' + GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` + // StorageMB - Max storage allowed for a server. + StorageMB *int32 `json:"storageMB,omitempty"` +} + // TrackedResource resource properties including location and tags for track resources. type TrackedResource struct { // Location - The location the resource resides in. @@ -1591,3 +1696,249 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { } return json.Marshal(objectMap) } + +// VirtualNetworkRule a virtual network rule. +type VirtualNetworkRule struct { + autorest.Response `json:"-"` + // VirtualNetworkRuleProperties - Resource properties. + *VirtualNetworkRuleProperties `json:"properties,omitempty"` + // ID - Resource ID + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkRule. +func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnr.VirtualNetworkRuleProperties != nil { + objectMap["properties"] = vnr.VirtualNetworkRuleProperties + } + if vnr.ID != nil { + objectMap["id"] = vnr.ID + } + if vnr.Name != nil { + objectMap["name"] = vnr.Name + } + if vnr.Type != nil { + objectMap["type"] = vnr.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. +func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkRuleProperties VirtualNetworkRuleProperties + err = json.Unmarshal(*v, &virtualNetworkRuleProperties) + if err != nil { + return err + } + vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnr.Type = &typeVar + } + } + } + + return nil +} + +// VirtualNetworkRuleListResult a list of virtual network rules. +type VirtualNetworkRuleListResult struct { + autorest.Response `json:"-"` + // Value - Array of results. + Value *[]VirtualNetworkRule `json:"value,omitempty"` + // NextLink - Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. +type VirtualNetworkRuleListResultIterator struct { + i int + page VirtualNetworkRuleListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkRuleListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { + if !iter.page.NotDone() { + return VirtualNetworkRule{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { + return vnrlr.Value == nil || len(*vnrlr.Value) == 0 +} + +// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer() (*http.Request, error) { + if vnrlr.NextLink == nil || len(to.String(vnrlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnrlr.NextLink))) +} + +// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. +type VirtualNetworkRuleListResultPage struct { + fn func(VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) + vnrlr VirtualNetworkRuleListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkRuleListResultPage) Next() error { + next, err := page.fn(page.vnrlr) + if err != nil { + return err + } + page.vnrlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkRuleListResultPage) NotDone() bool { + return !page.vnrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { + return page.vnrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { + if page.vnrlr.IsEmpty() { + return nil + } + return *page.vnrlr.Value +} + +// VirtualNetworkRuleProperties properties of a virtual network rule. +type VirtualNetworkRuleProperties struct { + // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. + VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` + // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + // State - Virtual Network Rule State. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + State VirtualNetworkRuleState `json:"state,omitempty"` +} + +// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkRulesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualNetworkRulesCreateOrUpdateFuture) Result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("postgresql.VirtualNetworkRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { + vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualNetworkRulesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualNetworkRulesDeleteFuture) Result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("postgresql.VirtualNetworkRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/operations.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/operations.go index b9e3b4c755912..76e4b8e7bdd92 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/operations.go @@ -25,7 +25,8 @@ import ( ) // OperationsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, +// log files and configurations with new business model. type OperationsClient struct { BaseClient } @@ -65,7 +66,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/servers.go similarity index 86% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/servers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/servers.go index f49618a34d72c..aaae22bbb618c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/servers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/servers.go @@ -26,7 +26,8 @@ import ( ) // ServersClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure PostgreSQL resources including servers, databases, firewall rules, log files and configurations. +// Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log +// files and configurations with new business model. type ServersClient struct { BaseClient } @@ -42,10 +43,11 @@ func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersC } // Create creates a new server, or will overwrite an existing server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the required -// parameters for creating or updating a server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for creating or updating a server. func (client ServersClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (result ServersCreateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -53,10 +55,7 @@ func (client ServersClient) Create(ctx context.Context, resourceGroupName string Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, }}, - {Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.StorageMB", Name: validation.InclusiveMinimum, Rule: 1024, Chain: nil}}}, - }}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresql.ServersClient", "Create", err.Error()) } @@ -84,7 +83,7 @@ func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -102,15 +101,17 @@ func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupNam // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) CreateSender(req *http.Request) (future ServersCreateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -128,9 +129,10 @@ func (client ServersClient) CreateResponder(resp *http.Response) (result Server, } // Delete deletes a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -155,7 +157,7 @@ func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -171,15 +173,17 @@ func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupNam // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -196,9 +200,10 @@ func (client ServersClient) DeleteResponder(resp *http.Response) (result autores } // Get gets information about a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -229,7 +234,7 @@ func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -291,7 +296,7 @@ func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, er "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,9 +330,9 @@ func (client ServersClient) ListResponder(resp *http.Response) (result ServerLis } // ListByResourceGroup list all the servers in a given resource group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResult, err error) { req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -357,7 +362,7 @@ func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -392,10 +397,11 @@ func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (r // Update updates an existing server. The request body can contain one to many of the properties present in the normal // server definition. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the required -// parameters for updating a server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for updating a server. func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (result ServersUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { @@ -420,7 +426,7 @@ func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-04-30-preview" + const APIVersion = "2017-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -438,15 +444,17 @@ func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupNam // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/serversecurityalertpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/serversecurityalertpolicies.go new file mode 100644 index 0000000000000..002c2755d1655 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/serversecurityalertpolicies.go @@ -0,0 +1,187 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ServerSecurityAlertPoliciesClient is the the Microsoft Azure management API provides create, read, update, and +// delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, +// security alert policies, log files and configurations with new business model. +type ServerSecurityAlertPoliciesClient struct { + BaseClient +} + +// NewServerSecurityAlertPoliciesClient creates an instance of the ServerSecurityAlertPoliciesClient client. +func NewServerSecurityAlertPoliciesClient(subscriptionID string) ServerSecurityAlertPoliciesClient { + return NewServerSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerSecurityAlertPoliciesClientWithBaseURI creates an instance of the ServerSecurityAlertPoliciesClient client. +func NewServerSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerSecurityAlertPoliciesClient { + return ServerSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a threat detection policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the server security alert policy. +func (client ServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (result ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityAlertPolicyName": autorest.Encode("path", "Default"), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ServerSecurityAlertPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServerSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get a server's security alert policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicy, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityAlertPolicyName": autorest.Encode("path", "Default"), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ServerSecurityAlertPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/postgresql/mgmt/2017-04-30-preview/postgresql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/version.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/version.go index 66c6f027168bb..87ed23008f038 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " postgresql/2017-04-30-preview" + return "Azure-SDK-For-Go/" + version.Number + " postgresql/2017-12-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/virtualnetworkrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/virtualnetworkrules.go new file mode 100644 index 0000000000000..19aa5bde5fd70 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql/virtualnetworkrules.go @@ -0,0 +1,366 @@ +package postgresql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// VirtualNetworkRulesClient is the the Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security +// alert policies, log files and configurations with new business model. +type VirtualNetworkRulesClient struct { + BaseClient +} + +// NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. +func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { + return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient client. +func NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { + return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an existing virtual network rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. +// parameters - the requested virtual Network Rule Resource state. +func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("postgresql.VirtualNetworkRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the virtual network rule with the given name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. +func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a virtual network rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. +func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of virtual network rules in a server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { + result.fn = client.listByServerNextResults + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.vnrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure sending request") + return + } + + result.vnrlr, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-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.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByServerNextResults retrieves the next set of results, if any. +func (client VirtualNetworkRulesClient) listByServerNextResults(lastResults VirtualNetworkRuleListResult) (result VirtualNetworkRuleListResult, err error) { + req, err := lastResults.virtualNetworkRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { + result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go index ef906747c7c69..5e46de7a5bf13 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go @@ -72,7 +72,7 @@ func (client ClassicAdministratorsClient) ListPreparer(ctx context.Context) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-07-01" + const APIVersion = "2015-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/client.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/client.go index cdce45f422026..6b6f6de95ef06 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/client.go @@ -1,4 +1,4 @@ -// Package authorization implements the Azure ARM Authorization service API version 2015-07-01. +// Package authorization implements the Azure ARM Authorization service API version . // // Role based access control provides you a way to apply granular level policy administration down to individual // resources or resource groups. These operations enable you to manage role definitions and role assignments. A role diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go index 47061d681ea9a..4f279ec7f00de 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go @@ -18,6 +18,7 @@ package authorization // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( + "encoding/json" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/to" "net/http" @@ -31,8 +32,77 @@ type ClassicAdministrator struct { Name *string `json:"name,omitempty"` // Type - The type of the administrator. Type *string `json:"type,omitempty"` - // Properties - Properties for the classic administrator. - Properties *ClassicAdministratorProperties `json:"properties,omitempty"` + // ClassicAdministratorProperties - Properties for the classic administrator. + *ClassicAdministratorProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClassicAdministrator. +func (ca ClassicAdministrator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ca.ID != nil { + objectMap["id"] = ca.ID + } + if ca.Name != nil { + objectMap["name"] = ca.Name + } + if ca.Type != nil { + objectMap["type"] = ca.Type + } + if ca.ClassicAdministratorProperties != nil { + objectMap["properties"] = ca.ClassicAdministratorProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClassicAdministrator struct. +func (ca *ClassicAdministrator) UnmarshalJSON(body []byte) error { + 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 + } + 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 "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ca.Type = &typeVar + } + case "properties": + if v != nil { + var classicAdministratorProperties ClassicAdministratorProperties + err = json.Unmarshal(*v, &classicAdministratorProperties) + if err != nil { + return err + } + ca.ClassicAdministratorProperties = &classicAdministratorProperties + } + } + } + + return nil } // ClassicAdministratorListResult classicAdministrator list result information. @@ -151,6 +221,10 @@ type Permission struct { Actions *[]string `json:"actions,omitempty"` // NotActions - Denied actions. NotActions *[]string `json:"notActions,omitempty"` + // DataActions - Allowed Data actions. + DataActions *[]string `json:"dataActions,omitempty"` + // NotDataActions - Denied Data actions. + NotDataActions *[]string `json:"notDataActions,omitempty"` } // PermissionGetResult permissions information. @@ -267,6 +341,8 @@ type ProviderOperation struct { Origin *string `json:"origin,omitempty"` // Properties - The operation properties. Properties interface{} `json:"properties,omitempty"` + // IsDataAction - The dataAction flag to specify the operation type. + IsDataAction *bool `json:"isDataAction,omitempty"` } // ProviderOperationsMetadata provider Operations metadata @@ -408,20 +484,124 @@ type RoleAssignment struct { Name *string `json:"name,omitempty"` // Type - The role assignment type. Type *string `json:"type,omitempty"` - // Properties - Role assignment properties. - Properties *RoleAssignmentPropertiesWithScope `json:"properties,omitempty"` + // RoleAssignmentPropertiesWithScope - Role assignment properties. + *RoleAssignmentPropertiesWithScope `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignment. +func (ra RoleAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ra.ID != nil { + objectMap["id"] = ra.ID + } + if ra.Name != nil { + objectMap["name"] = ra.Name + } + if ra.Type != nil { + objectMap["type"] = ra.Type + } + if ra.RoleAssignmentPropertiesWithScope != nil { + objectMap["properties"] = ra.RoleAssignmentPropertiesWithScope + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleAssignment struct. +func (ra *RoleAssignment) UnmarshalJSON(body []byte) error { + 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 + } + ra.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ra.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ra.Type = &typeVar + } + case "properties": + if v != nil { + var roleAssignmentPropertiesWithScope RoleAssignmentPropertiesWithScope + err = json.Unmarshal(*v, &roleAssignmentPropertiesWithScope) + if err != nil { + return err + } + ra.RoleAssignmentPropertiesWithScope = &roleAssignmentPropertiesWithScope + } + } + } + + return nil } // RoleAssignmentCreateParameters role assignment create parameters. type RoleAssignmentCreateParameters struct { - // Properties - Role assignment properties. - Properties *RoleAssignmentProperties `json:"properties,omitempty"` + // RoleAssignmentProperties - Role assignment properties. + *RoleAssignmentProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentCreateParameters. +func (racp RoleAssignmentCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if racp.RoleAssignmentProperties != nil { + objectMap["properties"] = racp.RoleAssignmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleAssignmentCreateParameters struct. +func (racp *RoleAssignmentCreateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var roleAssignmentProperties RoleAssignmentProperties + err = json.Unmarshal(*v, &roleAssignmentProperties) + if err != nil { + return err + } + racp.RoleAssignmentProperties = &roleAssignmentProperties + } + } + } + + return nil } // RoleAssignmentFilter role Assignments filter type RoleAssignmentFilter struct { // PrincipalID - Returns role assignment of the specific principal. PrincipalID *string `json:"principalId,omitempty"` + // CanDelegate - The Delegation flag for the roleassignment + CanDelegate *bool `json:"canDelegate,omitempty"` } // RoleAssignmentListResult role assignment list operation result. @@ -532,6 +712,8 @@ type RoleAssignmentProperties struct { RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` // PrincipalID - The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. PrincipalID *string `json:"principalId,omitempty"` + // CanDelegate - The delgation flag used for creating a role assignment + CanDelegate *bool `json:"canDelegate,omitempty"` } // RoleAssignmentPropertiesWithScope role assignment properties with scope. @@ -542,6 +724,8 @@ type RoleAssignmentPropertiesWithScope struct { RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` // PrincipalID - The principal ID. PrincipalID *string `json:"principalId,omitempty"` + // CanDelegate - The Delegation flag for the roleassignment + CanDelegate *bool `json:"canDelegate,omitempty"` } // RoleDefinition role definition. @@ -553,14 +737,85 @@ type RoleDefinition struct { Name *string `json:"name,omitempty"` // Type - The role definition type. Type *string `json:"type,omitempty"` - // Properties - Role definition properties. - Properties *RoleDefinitionProperties `json:"properties,omitempty"` + // RoleDefinitionProperties - Role definition properties. + *RoleDefinitionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleDefinition. +func (rd RoleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rd.ID != nil { + objectMap["id"] = rd.ID + } + if rd.Name != nil { + objectMap["name"] = rd.Name + } + if rd.Type != nil { + objectMap["type"] = rd.Type + } + if rd.RoleDefinitionProperties != nil { + objectMap["properties"] = rd.RoleDefinitionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleDefinition struct. +func (rd *RoleDefinition) UnmarshalJSON(body []byte) error { + 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 + } + rd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rd.Type = &typeVar + } + case "properties": + if v != nil { + var roleDefinitionProperties RoleDefinitionProperties + err = json.Unmarshal(*v, &roleDefinitionProperties) + if err != nil { + return err + } + rd.RoleDefinitionProperties = &roleDefinitionProperties + } + } + } + + return nil } // RoleDefinitionFilter role Definitions filter type RoleDefinitionFilter struct { // RoleName - Returns role definition with the specific name. RoleName *string `json:"roleName,omitempty"` + // Type - Returns role definition with the specific type. + Type *string `json:"type,omitempty"` } // RoleDefinitionListResult role definition list operation result. @@ -671,8 +926,8 @@ type RoleDefinitionProperties struct { RoleName *string `json:"roleName,omitempty"` // Description - The role definition description. Description *string `json:"description,omitempty"` - // Type - The role type. - Type *string `json:"type,omitempty"` + // RoleType - The role type. + RoleType *string `json:"type,omitempty"` // Permissions - Role definition permissions. Permissions *[]Permission `json:"permissions,omitempty"` // AssignableScopes - Role definition assignable scopes. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/permissions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go similarity index 97% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/permissions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go index 75e37dac79ee0..9c97551b1eb94 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/permissions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go @@ -44,7 +44,7 @@ func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) Perm // ListForResource gets all permissions the caller has for a resource. // Parameters: -// resourceGroupName - the name of the resource group containing the resource. The name is case insensitive. +// resourceGroupName - the name of the resource group. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -83,7 +83,7 @@ func (client PermissionsClient) ListForResourcePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -145,7 +145,7 @@ func (client PermissionsClient) ListForResourceComplete(ctx context.Context, res // ListForResourceGroup gets all permissions the caller has for a resource group. // Parameters: -// resourceGroupName - the name of the resource group to get the permissions for. The name is case insensitive. +// resourceGroupName - the name of the resource group. func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) @@ -176,7 +176,7 @@ func (client PermissionsClient) ListForResourceGroupPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/provideroperationsmetadata.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/provideroperationsmetadata.go index d8f0df2a99c2d..939049ef037bc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/provideroperationsmetadata.go @@ -74,7 +74,7 @@ func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -140,7 +140,7 @@ func (client ProviderOperationsMetadataClient) List(ctx context.Context, expand // ListPreparer prepares the List request. func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, expand string) (*http.Request, error) { - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go similarity index 93% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go index 5a842663c4771..0be885b475dfd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go @@ -80,7 +80,7 @@ func (client RoleAssignmentsClient) CreatePreparer(ctx context.Context, scope st "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -117,13 +117,10 @@ func (client RoleAssignmentsClient) CreateResponder(resp *http.Response) (result // CreateByID creates a role assignment by ID. // Parameters: -// roleAssignmentID - the fully qualified ID of the role assignment, including the scope, resource name and -// resource type. Use the format, -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. +// roleID - the ID of the role assignment to create. // parameters - parameters for the role assignment. -func (client RoleAssignmentsClient) CreateByID(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { - req, err := client.CreateByIDPreparer(ctx, roleAssignmentID, parameters) +func (client RoleAssignmentsClient) CreateByID(ctx context.Context, roleID string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { + req, err := client.CreateByIDPreparer(ctx, roleID, parameters) if err != nil { err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", nil, "Failure preparing request") return @@ -145,12 +142,12 @@ func (client RoleAssignmentsClient) CreateByID(ctx context.Context, roleAssignme } // CreateByIDPreparer prepares the CreateByID request. -func (client RoleAssignmentsClient) CreateByIDPreparer(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { +func (client RoleAssignmentsClient) CreateByIDPreparer(ctx context.Context, roleID string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ - "roleAssignmentId": roleAssignmentID, + "roleId": roleID, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,7 +156,7 @@ func (client RoleAssignmentsClient) CreateByIDPreparer(ctx context.Context, role autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithPathParameters("/{roleId}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -218,7 +215,7 @@ func (client RoleAssignmentsClient) DeletePreparer(ctx context.Context, scope st "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -253,12 +250,9 @@ func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result // DeleteByID deletes a role assignment. // Parameters: -// roleAssignmentID - the fully qualified ID of the role assignment, including the scope, resource name and -// resource type. Use the format, -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. -func (client RoleAssignmentsClient) DeleteByID(ctx context.Context, roleAssignmentID string) (result RoleAssignment, err error) { - req, err := client.DeleteByIDPreparer(ctx, roleAssignmentID) +// roleID - the ID of the role assignment to delete. +func (client RoleAssignmentsClient) DeleteByID(ctx context.Context, roleID string) (result RoleAssignment, err error) { + req, err := client.DeleteByIDPreparer(ctx, roleID) if err != nil { err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", nil, "Failure preparing request") return @@ -280,12 +274,12 @@ func (client RoleAssignmentsClient) DeleteByID(ctx context.Context, roleAssignme } // DeleteByIDPreparer prepares the DeleteByID request. -func (client RoleAssignmentsClient) DeleteByIDPreparer(ctx context.Context, roleAssignmentID string) (*http.Request, error) { +func (client RoleAssignmentsClient) DeleteByIDPreparer(ctx context.Context, roleID string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "roleAssignmentId": roleAssignmentID, + "roleId": roleID, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -293,7 +287,7 @@ func (client RoleAssignmentsClient) DeleteByIDPreparer(ctx context.Context, role preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithPathParameters("/{roleId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -351,7 +345,7 @@ func (client RoleAssignmentsClient) GetPreparer(ctx context.Context, scope strin "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -386,12 +380,9 @@ func (client RoleAssignmentsClient) GetResponder(resp *http.Response) (result Ro // GetByID gets a role assignment by ID. // Parameters: -// roleAssignmentID - the fully qualified ID of the role assignment, including the scope, resource name and -// resource type. Use the format, -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. -func (client RoleAssignmentsClient) GetByID(ctx context.Context, roleAssignmentID string) (result RoleAssignment, err error) { - req, err := client.GetByIDPreparer(ctx, roleAssignmentID) +// roleID - the ID of the role assignment to get. +func (client RoleAssignmentsClient) GetByID(ctx context.Context, roleID string) (result RoleAssignment, err error) { + req, err := client.GetByIDPreparer(ctx, roleID) if err != nil { err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", nil, "Failure preparing request") return @@ -413,12 +404,12 @@ func (client RoleAssignmentsClient) GetByID(ctx context.Context, roleAssignmentI } // GetByIDPreparer prepares the GetByID request. -func (client RoleAssignmentsClient) GetByIDPreparer(ctx context.Context, roleAssignmentID string) (*http.Request, error) { +func (client RoleAssignmentsClient) GetByIDPreparer(ctx context.Context, roleID string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "roleAssignmentId": roleAssignmentID, + "roleId": roleID, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -426,7 +417,7 @@ func (client RoleAssignmentsClient) GetByIDPreparer(ctx context.Context, roleAss preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithPathParameters("/{roleId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -485,7 +476,7 @@ func (client RoleAssignmentsClient) ListPreparer(ctx context.Context, filter str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -592,7 +583,7 @@ func (client RoleAssignmentsClient) ListForResourcePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -691,7 +682,7 @@ func (client RoleAssignmentsClient) ListForResourceGroupPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -789,7 +780,7 @@ func (client RoleAssignmentsClient) ListForScopePreparer(ctx context.Context, sc "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go index a5e5afd5a7218..6c1d3b537e490 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go @@ -76,7 +76,7 @@ func (client RoleDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -144,7 +144,7 @@ func (client RoleDefinitionsClient) DeletePreparer(ctx context.Context, scope st "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -210,7 +210,7 @@ func (client RoleDefinitionsClient) GetPreparer(ctx context.Context, scope strin "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,12 +245,12 @@ func (client RoleDefinitionsClient) GetResponder(resp *http.Response) (result Ro // GetByID gets a role definition by ID. // Parameters: -// roleDefinitionID - the fully qualified role definition ID. Use the format, +// roleID - the fully qualified role definition ID. Use the format, // /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription // level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant // level role definitions. -func (client RoleDefinitionsClient) GetByID(ctx context.Context, roleDefinitionID string) (result RoleDefinition, err error) { - req, err := client.GetByIDPreparer(ctx, roleDefinitionID) +func (client RoleDefinitionsClient) GetByID(ctx context.Context, roleID string) (result RoleDefinition, err error) { + req, err := client.GetByIDPreparer(ctx, roleID) if err != nil { err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", nil, "Failure preparing request") return @@ -272,12 +272,12 @@ func (client RoleDefinitionsClient) GetByID(ctx context.Context, roleDefinitionI } // GetByIDPreparer prepares the GetByID request. -func (client RoleDefinitionsClient) GetByIDPreparer(ctx context.Context, roleDefinitionID string) (*http.Request, error) { +func (client RoleDefinitionsClient) GetByIDPreparer(ctx context.Context, roleID string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "roleDefinitionId": roleDefinitionID, + "roleId": roleID, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -285,7 +285,7 @@ func (client RoleDefinitionsClient) GetByIDPreparer(ctx context.Context, roleDef preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleDefinitionId}", pathParameters), + autorest.WithPathParameters("/{roleId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -344,7 +344,7 @@ func (client RoleDefinitionsClient) ListPreparer(ctx context.Context, scope stri "scope": scope, } - const APIVersion = "2015-07-01" + const APIVersion = "2018-01-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/version.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/version.go index 77a9c4f0562f5..2833e0b210003 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " authorization/2015-07-01" + return "Azure-SDK-For-Go/" + version.Number + " authorization/2018-01-01-preview" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/client.go new file mode 100644 index 0000000000000..7b653b49a40b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/client.go @@ -0,0 +1,51 @@ +// Package dns implements the Azure ARM Dns service API version 2018-03-01-preview. +// +// The DNS Management Client. +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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 Dns + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Dns. +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. +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/dns/mgmt/2018-03-01-preview/dns/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/models.go new file mode 100644 index 0000000000000..b032a20f1888a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/models.go @@ -0,0 +1,799 @@ +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// RecordType enumerates the values for record type. +type RecordType string + +const ( + // A ... + A RecordType = "A" + // AAAA ... + AAAA RecordType = "AAAA" + // CAA ... + CAA RecordType = "CAA" + // CNAME ... + CNAME RecordType = "CNAME" + // MX ... + MX RecordType = "MX" + // NS ... + NS RecordType = "NS" + // PTR ... + PTR RecordType = "PTR" + // SOA ... + SOA RecordType = "SOA" + // SRV ... + SRV RecordType = "SRV" + // TXT ... + TXT RecordType = "TXT" +) + +// PossibleRecordTypeValues returns an array of possible values for the RecordType const type. +func PossibleRecordTypeValues() []RecordType { + return []RecordType{A, AAAA, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT} +} + +// ZoneType enumerates the values for zone type. +type ZoneType string + +const ( + // Private ... + Private ZoneType = "Private" + // Public ... + Public ZoneType = "Public" +) + +// PossibleZoneTypeValues returns an array of possible values for the ZoneType const type. +func PossibleZoneTypeValues() []ZoneType { + return []ZoneType{Private, Public} +} + +// AaaaRecord an AAAA record. +type AaaaRecord struct { + // Ipv6Address - The IPv6 address of this AAAA record. + Ipv6Address *string `json:"ipv6Address,omitempty"` +} + +// ARecord an A record. +type ARecord struct { + // Ipv4Address - The IPv4 address of this A record. + Ipv4Address *string `json:"ipv4Address,omitempty"` +} + +// CaaRecord a CAA record. +type CaaRecord struct { + // Flags - The flags for this CAA record as an integer between 0 and 255. + Flags *int32 `json:"flags,omitempty"` + // Tag - The tag for this CAA record. + Tag *string `json:"tag,omitempty"` + // Value - The value for this CAA record. + Value *string `json:"value,omitempty"` +} + +// CloudError an error message +type CloudError struct { + // Error - The error message body + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody the body of an error message +type CloudErrorBody struct { + // Code - The error code + Code *string `json:"code,omitempty"` + // Message - A description of what caused the error + Message *string `json:"message,omitempty"` + // Target - The target resource of the error message + Target *string `json:"target,omitempty"` + // Details - Extra error information + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CnameRecord a CNAME record. +type CnameRecord struct { + // Cname - The canonical name for this CNAME record. + Cname *string `json:"cname,omitempty"` +} + +// MxRecord an MX record. +type MxRecord struct { + // Preference - The preference value for this MX record. + Preference *int32 `json:"preference,omitempty"` + // Exchange - The domain name of the mail host for this MX record. + Exchange *string `json:"exchange,omitempty"` +} + +// NsRecord an NS record. +type NsRecord struct { + // Nsdname - The name server name for this NS record. + Nsdname *string `json:"nsdname,omitempty"` +} + +// PtrRecord a PTR record. +type PtrRecord struct { + // Ptrdname - The PTR target domain name for this PTR record. + Ptrdname *string `json:"ptrdname,omitempty"` +} + +// RecordSet describes a DNS record set (a collection of DNS records with the same name and type). +type RecordSet struct { + autorest.Response `json:"-"` + // ID - The ID of the record set. + ID *string `json:"id,omitempty"` + // Name - The name of the record set. + Name *string `json:"name,omitempty"` + // Type - The type of the record set. + Type *string `json:"type,omitempty"` + // Etag - The etag of the record set. + Etag *string `json:"etag,omitempty"` + // RecordSetProperties - The properties of the record set. + *RecordSetProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecordSet. +func (rs RecordSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.ID != nil { + objectMap["id"] = rs.ID + } + if rs.Name != nil { + objectMap["name"] = rs.Name + } + if rs.Type != nil { + objectMap["type"] = rs.Type + } + if rs.Etag != nil { + objectMap["etag"] = rs.Etag + } + if rs.RecordSetProperties != nil { + objectMap["properties"] = rs.RecordSetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RecordSet struct. +func (rs *RecordSet) UnmarshalJSON(body []byte) error { + 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 + } + rs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rs.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rs.Etag = &etag + } + case "properties": + if v != nil { + var recordSetProperties RecordSetProperties + err = json.Unmarshal(*v, &recordSetProperties) + if err != nil { + return err + } + rs.RecordSetProperties = &recordSetProperties + } + } + } + + return nil +} + +// RecordSetListResult the response to a record set List operation. +type RecordSetListResult struct { + autorest.Response `json:"-"` + // Value - Information about the record sets in the response. + Value *[]RecordSet `json:"value,omitempty"` + // NextLink - The continuation token for the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RecordSetListResultIterator provides access to a complete listing of RecordSet values. +type RecordSetListResultIterator struct { + i int + page RecordSetListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RecordSetListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RecordSetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RecordSetListResultIterator) Response() RecordSetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RecordSetListResultIterator) Value() RecordSet { + if !iter.page.NotDone() { + return RecordSet{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rslr RecordSetListResult) IsEmpty() bool { + return rslr.Value == nil || len(*rslr.Value) == 0 +} + +// recordSetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rslr RecordSetListResult) recordSetListResultPreparer() (*http.Request, error) { + if rslr.NextLink == nil || len(to.String(rslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rslr.NextLink))) +} + +// RecordSetListResultPage contains a page of RecordSet values. +type RecordSetListResultPage struct { + fn func(RecordSetListResult) (RecordSetListResult, error) + rslr RecordSetListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RecordSetListResultPage) Next() error { + next, err := page.fn(page.rslr) + if err != nil { + return err + } + page.rslr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RecordSetListResultPage) NotDone() bool { + return !page.rslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RecordSetListResultPage) Response() RecordSetListResult { + return page.rslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RecordSetListResultPage) Values() []RecordSet { + if page.rslr.IsEmpty() { + return nil + } + return *page.rslr.Value +} + +// RecordSetProperties represents the properties of the records in the record set. +type RecordSetProperties struct { + // Metadata - The metadata attached to the record set. + Metadata map[string]*string `json:"metadata"` + // TTL - The TTL (time-to-live) of the records in the record set. + TTL *int64 `json:"TTL,omitempty"` + // Fqdn - Fully qualified domain name of the record set. + Fqdn *string `json:"fqdn,omitempty"` + // ARecords - The list of A records in the record set. + ARecords *[]ARecord `json:"ARecords,omitempty"` + // AaaaRecords - The list of AAAA records in the record set. + AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"` + // MxRecords - The list of MX records in the record set. + MxRecords *[]MxRecord `json:"MXRecords,omitempty"` + // NsRecords - The list of NS records in the record set. + NsRecords *[]NsRecord `json:"NSRecords,omitempty"` + // PtrRecords - The list of PTR records in the record set. + PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"` + // SrvRecords - The list of SRV records in the record set. + SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"` + // TxtRecords - The list of TXT records in the record set. + TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"` + // CnameRecord - The CNAME record in the record set. + CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"` + // SoaRecord - The SOA record in the record set. + SoaRecord *SoaRecord `json:"SOARecord,omitempty"` + // CaaRecords - The list of CAA records in the record set. + CaaRecords *[]CaaRecord `json:"caaRecords,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecordSetProperties. +func (rsp RecordSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rsp.Metadata != nil { + objectMap["metadata"] = rsp.Metadata + } + if rsp.TTL != nil { + objectMap["TTL"] = rsp.TTL + } + if rsp.Fqdn != nil { + objectMap["fqdn"] = rsp.Fqdn + } + if rsp.ARecords != nil { + objectMap["ARecords"] = rsp.ARecords + } + if rsp.AaaaRecords != nil { + objectMap["AAAARecords"] = rsp.AaaaRecords + } + if rsp.MxRecords != nil { + objectMap["MXRecords"] = rsp.MxRecords + } + if rsp.NsRecords != nil { + objectMap["NSRecords"] = rsp.NsRecords + } + if rsp.PtrRecords != nil { + objectMap["PTRRecords"] = rsp.PtrRecords + } + if rsp.SrvRecords != nil { + objectMap["SRVRecords"] = rsp.SrvRecords + } + if rsp.TxtRecords != nil { + objectMap["TXTRecords"] = rsp.TxtRecords + } + if rsp.CnameRecord != nil { + objectMap["CNAMERecord"] = rsp.CnameRecord + } + if rsp.SoaRecord != nil { + objectMap["SOARecord"] = rsp.SoaRecord + } + if rsp.CaaRecords != nil { + objectMap["caaRecords"] = rsp.CaaRecords + } + return json.Marshal(objectMap) +} + +// RecordSetUpdateParameters parameters supplied to update a record set. +type RecordSetUpdateParameters struct { + // RecordSet - Specifies information about the record set being updated. + RecordSet *RecordSet `json:"RecordSet,omitempty"` +} + +// Resource common properties of an Azure Resource Manager resource +type Resource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - 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.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// SoaRecord an SOA record. +type SoaRecord struct { + // Host - The domain name of the authoritative name server for this SOA record. + Host *string `json:"host,omitempty"` + // Email - The email contact for this SOA record. + Email *string `json:"email,omitempty"` + // SerialNumber - The serial number for this SOA record. + SerialNumber *int64 `json:"serialNumber,omitempty"` + // RefreshTime - The refresh value for this SOA record. + RefreshTime *int64 `json:"refreshTime,omitempty"` + // RetryTime - The retry time for this SOA record. + RetryTime *int64 `json:"retryTime,omitempty"` + // ExpireTime - The expire time for this SOA record. + ExpireTime *int64 `json:"expireTime,omitempty"` + // MinimumTTL - The minimum value for this SOA record. By convention this is used to determine the negative caching duration. + MinimumTTL *int64 `json:"minimumTTL,omitempty"` +} + +// SrvRecord an SRV record. +type SrvRecord struct { + // Priority - The priority value for this SRV record. + Priority *int32 `json:"priority,omitempty"` + // Weight - The weight value for this SRV record. + Weight *int32 `json:"weight,omitempty"` + // Port - The port value for this SRV record. + Port *int32 `json:"port,omitempty"` + // Target - The target domain name for this SRV record. + Target *string `json:"target,omitempty"` +} + +// SubResource a reference to a another resource +type SubResource struct { + // ID - Resource Id. + ID *string `json:"id,omitempty"` +} + +// TxtRecord a TXT record. +type TxtRecord struct { + // Value - The text value of this TXT record. + Value *[]string `json:"value,omitempty"` +} + +// Zone describes a DNS zone. +type Zone struct { + autorest.Response `json:"-"` + // Etag - The etag of the zone. + Etag *string `json:"etag,omitempty"` + // ZoneProperties - The properties of the zone. + *ZoneProperties `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - 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 Zone. +func (z Zone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if z.Etag != nil { + objectMap["etag"] = z.Etag + } + if z.ZoneProperties != nil { + objectMap["properties"] = z.ZoneProperties + } + if z.ID != nil { + objectMap["id"] = z.ID + } + if z.Name != nil { + objectMap["name"] = z.Name + } + if z.Type != nil { + objectMap["type"] = z.Type + } + if z.Location != nil { + objectMap["location"] = z.Location + } + if z.Tags != nil { + objectMap["tags"] = z.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Zone struct. +func (z *Zone) UnmarshalJSON(body []byte) error { + 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 + } + z.Etag = &etag + } + case "properties": + if v != nil { + var zoneProperties ZoneProperties + err = json.Unmarshal(*v, &zoneProperties) + if err != nil { + return err + } + z.ZoneProperties = &zoneProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + z.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + z.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + z.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + z.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + z.Tags = tags + } + } + } + + return nil +} + +// ZoneListResult the response to a Zone List or ListAll operation. +type ZoneListResult struct { + autorest.Response `json:"-"` + // Value - Information about the DNS zones. + Value *[]Zone `json:"value,omitempty"` + // NextLink - The continuation token for the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ZoneListResultIterator provides access to a complete listing of Zone values. +type ZoneListResultIterator struct { + i int + page ZoneListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ZoneListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ZoneListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ZoneListResultIterator) Response() ZoneListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ZoneListResultIterator) Value() Zone { + if !iter.page.NotDone() { + return Zone{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (zlr ZoneListResult) IsEmpty() bool { + return zlr.Value == nil || len(*zlr.Value) == 0 +} + +// zoneListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (zlr ZoneListResult) zoneListResultPreparer() (*http.Request, error) { + if zlr.NextLink == nil || len(to.String(zlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(zlr.NextLink))) +} + +// ZoneListResultPage contains a page of Zone values. +type ZoneListResultPage struct { + fn func(ZoneListResult) (ZoneListResult, error) + zlr ZoneListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ZoneListResultPage) Next() error { + next, err := page.fn(page.zlr) + if err != nil { + return err + } + page.zlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ZoneListResultPage) NotDone() bool { + return !page.zlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ZoneListResultPage) Response() ZoneListResult { + return page.zlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ZoneListResultPage) Values() []Zone { + if page.zlr.IsEmpty() { + return nil + } + return *page.zlr.Value +} + +// ZoneProperties represents the properties of the zone. +type ZoneProperties struct { + // MaxNumberOfRecordSets - The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` + // NumberOfRecordSets - The current number of record sets in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` + // NameServers - The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + NameServers *[]string `json:"nameServers,omitempty"` + // ZoneType - The type of this DNS zone (Public or Private). Possible values include: 'Public', 'Private' + ZoneType ZoneType `json:"zoneType,omitempty"` + // RegistrationVirtualNetworks - A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private. + RegistrationVirtualNetworks *[]SubResource `json:"registrationVirtualNetworks,omitempty"` + // ResolutionVirtualNetworks - A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private. + ResolutionVirtualNetworks *[]SubResource `json:"resolutionVirtualNetworks,omitempty"` +} + +// ZonesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ZonesDeleteFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future ZonesDeleteFuture) Result(client ZonesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("dns.ZonesDeleteFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.DeleteResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", resp, "Failure responding to request") + } + return +} + +// ZoneUpdate describes a request to update a DNS zone. +type ZoneUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ZoneUpdate. +func (zu ZoneUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if zu.Tags != nil { + objectMap["tags"] = zu.Tags + } + return json.Marshal(objectMap) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/recordsets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/recordsets.go new file mode 100644 index 0000000000000..0f8233dbc6962 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/recordsets.go @@ -0,0 +1,672 @@ +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// RecordSetsClient is the the DNS Management Client. +type RecordSetsClient struct { + BaseClient +} + +// NewRecordSetsClient creates an instance of the RecordSetsClient client. +func NewRecordSetsClient(subscriptionID string) RecordSetsClient { + return NewRecordSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecordSetsClientWithBaseURI creates an instance of the RecordSetsClient client. +func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) RecordSetsClient { + return RecordSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a record set within a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. Record sets of type SOA can be updated but not +// created (they are created when the DNS zone is created). +// parameters - parameters supplied to the CreateOrUpdate operation. +// ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify +// the last-seen etag value to prevent accidentally overwritting any concurrent changes. +// ifNoneMatch - set to '*' to allow a new record set to be created, but to prevent updating an existing record +// set. Other values will be ignored. +func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RecordSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", 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)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a record set from a DNS zone. This operation cannot be undone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are +// deleted when the DNS zone is deleted). +// ifMatch - the etag of the record set. Omit this value to always delete the current record set. Specify the +// last-seen etag value to prevent accidentally deleting any concurrent changes. +func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RecordSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), + 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)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a record set. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. +func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecordSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", 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 RecordSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllByDNSZone lists all record sets in a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +// recordSetNameSuffix - the suffix label of the record set name that has to be used to filter the record set +// enumerations. If this parameter is specified, Enumeration will return only records that end with +// . +func (client RecordSetsClient) ListAllByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (result RecordSetListResultPage, err error) { + result.fn = client.listAllByDNSZoneNextResults + req, err := client.ListAllByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordSetNameSuffix) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllByDNSZoneSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListAllByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", resp, "Failure responding to request") + } + + return +} + +// ListAllByDNSZonePreparer prepares the ListAllByDNSZone request. +func (client RecordSetsClient) ListAllByDNSZonePreparer(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(recordSetNameSuffix) > 0 { + queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordSetNameSuffix) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/all", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllByDNSZoneSender sends the ListAllByDNSZone request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListAllByDNSZoneSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllByDNSZoneResponder handles the response to the ListAllByDNSZone request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListAllByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllByDNSZoneNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) listAllByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllByDNSZoneSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecordSetsClient) ListAllByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (result RecordSetListResultIterator, err error) { + result.page, err = client.ListAllByDNSZone(ctx, resourceGroupName, zoneName, top, recordSetNameSuffix) + return +} + +// ListByDNSZone lists all record sets in a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +// recordsetnamesuffix - the suffix label of the record set name that has to be used to filter the record set +// enumerations. If this parameter is specified, Enumeration will return only records that end with +// . +func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + result.fn = client.listByDNSZoneNextResults + req, err := client.ListByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDNSZoneSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to request") + } + + return +} + +// ListByDNSZonePreparer prepares the ListByDNSZone request. +func (client RecordSetsClient) ListByDNSZonePreparer(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(recordsetnamesuffix) > 0 { + queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordsetnamesuffix) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDNSZoneSender sends the ListByDNSZone request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListByDNSZoneSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDNSZoneResponder handles the response to the ListByDNSZone request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDNSZoneNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) listByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDNSZoneSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { + result.page, err = client.ListByDNSZone(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) + return +} + +// ListByType lists the record sets of a specified type in a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// recordType - the type of record sets to enumerate. +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +// recordsetnamesuffix - the suffix label of the record set name that has to be used to filter the record set +// enumerations. If this parameter is specified, Enumeration will return only records that end with +// . +func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + result.fn = client.listByTypeNextResults + req, err := client.ListByTypePreparer(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing request") + return + } + + resp, err := client.ListByTypeSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to request") + } + + return +} + +// ListByTypePreparer prepares the ListByType request. +func (client RecordSetsClient) ListByTypePreparer(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(recordsetnamesuffix) > 0 { + queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordsetnamesuffix) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByTypeSender sends the ListByType request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByTypeResponder handles the response to the ListByType request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListByTypeResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByTypeNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) listByTypeNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByTypeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { + result.page, err = client.ListByType(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) + return +} + +// Update updates a record set within a DNS zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// relativeRecordSetName - the name of the record set, relative to the name of the zone. +// recordType - the type of DNS record in this record set. +// parameters - parameters supplied to the Update operation. +// ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify +// the last-seen etag value to prevent accidentally overwritting concurrent changes. +func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RecordSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", 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 RecordSetsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) UpdateResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/dns/mgmt/2018-03-01-preview/dns/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/version.go new file mode 100644 index 0000000000000..0275c857cae2b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/version.go @@ -0,0 +1,30 @@ +package dns + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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.Number + " dns/2018-03-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/preview/dns/mgmt/2018-03-01-preview/dns/zones.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/zones.go new file mode 100644 index 0000000000000..5e728426c451f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns/zones.go @@ -0,0 +1,532 @@ +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ZonesClient is the the DNS Management Client. +type ZonesClient struct { + BaseClient +} + +// NewZonesClient creates an instance of the ZonesClient client. +func NewZonesClient(subscriptionID string) ZonesClient { + return NewZonesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewZonesClientWithBaseURI creates an instance of the ZonesClient client. +func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClient { + return ZonesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records within the zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// parameters - parameters supplied to the CreateOrUpdate operation. +// ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the +// last-seen etag value to prevent accidentally overwritting any concurrent changes. +// ifNoneMatch - set to '*' to allow a new DNS zone to be created, but to prevent updating an existing zone. +// Other values will be ignored. +func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ZonesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}", 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)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be +// undone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// ifMatch - the etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen +// etag value to prevent accidentally deleting any concurrent changes. +func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (result ZonesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ZonesClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}", pathParameters), + 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)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) DeleteSender(req *http.Request) (future ZonesDeleteFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ZonesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string) (result Zone, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, zoneName) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ZonesClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}", 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 ZonesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ZonesClient) GetResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the DNS zones in all resource groups in a subscription. +// Parameters: +// top - the maximum number of DNS zones to return. If not specified, returns up to 100 zones. +func (client ZonesClient) List(ctx context.Context, top *int32) (result ZoneListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.zlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending request") + return + } + + result.zlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ZonesClient) ListPreparer(ctx context.Context, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01-preview" + 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.Network/dnszones", 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 ZonesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ZonesClient) ListResponder(resp *http.Response) (result ZoneListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ZonesClient) listNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.zoneListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "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, "dns.ZonesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ZonesClient) ListComplete(ctx context.Context, top *int32) (result ZoneListResultIterator, err error) { + result.page, err = client.List(ctx, top) + return +} + +// ListByResourceGroup lists the DNS zones within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. +func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.zlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.zlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ZonesClient) 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 = "2018-03-01-preview" + 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.Network/dnsZones", 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 ZonesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ZonesClient) ListByResourceGroupResponder(resp *http.Response) (result ZoneListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ZonesClient) listByResourceGroupNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.zoneListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "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, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ZonesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) + return +} + +// Update updates a DNS zone. Does not modify DNS records within the zone. +// Parameters: +// resourceGroupName - the name of the resource group. +// zoneName - the name of the DNS zone (without a terminating dot). +// parameters - parameters supplied to the Update operation. +// ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the +// last-seen etag value to prevent accidentally overwritting any concurrent changes. +func (client ZonesClient) Update(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, ifMatch string) (result Zone, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ZonesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2018-03-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.Network/dnsZones/{zoneName}", 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 ZonesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ZonesClient) UpdateResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/msi/mgmt/2015-08-31-preview/msi/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/client.go new file mode 100644 index 0000000000000..a4e7c71d55b9f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/client.go @@ -0,0 +1,51 @@ +// Package msi implements the Azure ARM Msi service API version 2015-08-31-preview. +// +// The Managed Service Identity Client. +package msi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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 Msi + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Msi. +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. +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/msi/mgmt/2015-08-31-preview/msi/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/models.go new file mode 100644 index 0000000000000..c72acd231b012 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/models.go @@ -0,0 +1,403 @@ +package msi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/go.uuid" + "net/http" +) + +// UserAssignedIdentities enumerates the values for user assigned identities. +type UserAssignedIdentities string + +const ( + // MicrosoftManagedIdentityuserAssignedIdentities ... + MicrosoftManagedIdentityuserAssignedIdentities UserAssignedIdentities = "Microsoft.ManagedIdentity/userAssignedIdentities" +) + +// PossibleUserAssignedIdentitiesValues returns an array of possible values for the UserAssignedIdentities const type. +func PossibleUserAssignedIdentitiesValues() []UserAssignedIdentities { + return []UserAssignedIdentities{MicrosoftManagedIdentityuserAssignedIdentities} +} + +// CloudError an error response from the ManagedServiceIdentity service. +type CloudError struct { + // Error - A list of additional details about the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the ManagedServiceIdentity service. +type CloudErrorBody struct { + // Code - An identifier for the error. + 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"` +} + +// Identity describes an identity resource. +type Identity struct { + autorest.Response `json:"-"` + // ID - The id of the created identity. + ID *string `json:"id,omitempty"` + // Name - The name of the created identity. + Name *string `json:"name,omitempty"` + // Location - The Azure region where the identity lives. + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // IdentityProperties - The properties associated with the identity. + *IdentityProperties `json:"properties,omitempty"` + // Type - The type of resource i.e. Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: 'MicrosoftManagedIdentityuserAssignedIdentities' + Type UserAssignedIdentities `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.ID != nil { + objectMap["id"] = i.ID + } + if i.Name != nil { + objectMap["name"] = i.Name + } + if i.Location != nil { + objectMap["location"] = i.Location + } + if i.Tags != nil { + objectMap["tags"] = i.Tags + } + if i.IdentityProperties != nil { + objectMap["properties"] = i.IdentityProperties + } + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Identity struct. +func (i *Identity) UnmarshalJSON(body []byte) error { + 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 + } + 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 "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 + } + case "properties": + if v != nil { + var identityProperties IdentityProperties + err = json.Unmarshal(*v, &identityProperties) + if err != nil { + return err + } + i.IdentityProperties = &identityProperties + } + case "type": + if v != nil { + var typeVar UserAssignedIdentities + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = typeVar + } + } + } + + return nil +} + +// IdentityProperties the properties associated with the identity. +type IdentityProperties struct { + // TenantID - The id of the tenant which the identity belongs to. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // PrincipalID - The id of the service principal object associated with the created identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // ClientID - The id of the app associated with the identity. This is a random generated UUID by MSI. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ClientSecretURL - The ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity credentials. + ClientSecretURL *string `json:"clientSecretUrl,omitempty"` +} + +// Operation operation supported by the Microsoft.ManagedIdentity REST API. +type Operation struct { + // Name - The name of the REST Operation. This is of the format {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 - The type of operation. For example: read, write, delete. + Operation *string `json:"operation,omitempty"` + // Resource - The resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Description - A description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult a list of operations supported by Microsoft.ManagedIdentity Resource Provider. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - A list of operations supported by Microsoft.ManagedIdentity Resource Provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The url to get the next page of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// Next advances 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { + if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// Next advances to the 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) Next() error { + next, err := page.fn(page.olr) + if err != nil { + return err + } + page.olr = next + return nil +} + +// 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 +} + +// UserAssignedIdentitiesListResult values returned by the List operation. +type UserAssignedIdentitiesListResult struct { + autorest.Response `json:"-"` + // Value - The collection of userAssignedIdentities returned by the listing operation. + Value *[]Identity `json:"value,omitempty"` + // NextLink - The url to get the next page of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// UserAssignedIdentitiesListResultIterator provides access to a complete listing of Identity values. +type UserAssignedIdentitiesListResultIterator struct { + i int + page UserAssignedIdentitiesListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UserAssignedIdentitiesListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UserAssignedIdentitiesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UserAssignedIdentitiesListResultIterator) Response() UserAssignedIdentitiesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UserAssignedIdentitiesListResultIterator) Value() Identity { + if !iter.page.NotDone() { + return Identity{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (uailr UserAssignedIdentitiesListResult) IsEmpty() bool { + return uailr.Value == nil || len(*uailr.Value) == 0 +} + +// userAssignedIdentitiesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (uailr UserAssignedIdentitiesListResult) userAssignedIdentitiesListResultPreparer() (*http.Request, error) { + if uailr.NextLink == nil || len(to.String(uailr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(uailr.NextLink))) +} + +// UserAssignedIdentitiesListResultPage contains a page of Identity values. +type UserAssignedIdentitiesListResultPage struct { + fn func(UserAssignedIdentitiesListResult) (UserAssignedIdentitiesListResult, error) + uailr UserAssignedIdentitiesListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UserAssignedIdentitiesListResultPage) Next() error { + next, err := page.fn(page.uailr) + if err != nil { + return err + } + page.uailr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UserAssignedIdentitiesListResultPage) NotDone() bool { + return !page.uailr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UserAssignedIdentitiesListResultPage) Response() UserAssignedIdentitiesListResult { + return page.uailr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UserAssignedIdentitiesListResultPage) Values() []Identity { + if page.uailr.IsEmpty() { + return nil + } + return *page.uailr.Value +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/operations.go new file mode 100644 index 0000000000000..aff0090736204 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/operations.go @@ -0,0 +1,126 @@ +package msi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// OperationsClient is the the Managed Service Identity 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. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists available operations for the Microsoft.ManagedIdentity provider +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.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, "msi.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-08-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ManagedIdentity/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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "msi.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, "msi.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.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) { + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/userassignedidentities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/userassignedidentities.go new file mode 100644 index 0000000000000..06c7a49452d24 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/userassignedidentities.go @@ -0,0 +1,496 @@ +package msi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// UserAssignedIdentitiesClient is the the Managed Service Identity Client. +type UserAssignedIdentitiesClient struct { + BaseClient +} + +// NewUserAssignedIdentitiesClient creates an instance of the UserAssignedIdentitiesClient client. +func NewUserAssignedIdentitiesClient(subscriptionID string) UserAssignedIdentitiesClient { + return NewUserAssignedIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUserAssignedIdentitiesClientWithBaseURI creates an instance of the UserAssignedIdentitiesClient client. +func NewUserAssignedIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) UserAssignedIdentitiesClient { + return UserAssignedIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an identity in the specified subscription and resource group. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +// parameters - parameters to create or update the identity +func (client UserAssignedIdentitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Identity) (result Identity, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UserAssignedIdentitiesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Identity) (*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 = "2015-08-31-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.ManagedIdentity/userAssignedIdentities/{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 UserAssignedIdentitiesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) CreateOrUpdateResponder(resp *http.Response) (result Identity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the identity. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +func (client UserAssignedIdentitiesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UserAssignedIdentitiesClient) 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 = "2015-08-31-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.ManagedIdentity/userAssignedIdentities/{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 UserAssignedIdentitiesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the identity. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +func (client UserAssignedIdentitiesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Identity, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client UserAssignedIdentitiesClient) 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 = "2015-08-31-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.ManagedIdentity/userAssignedIdentities/{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 UserAssignedIdentitiesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) GetResponder(resp *http.Response) (result Identity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all the userAssignedIdentities available under the specified ResourceGroup. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +func (client UserAssignedIdentitiesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result UserAssignedIdentitiesListResultPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.uailr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.uailr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client UserAssignedIdentitiesClient) 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 = "2015-08-31-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.ManagedIdentity/userAssignedIdentities", 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 UserAssignedIdentitiesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) ListByResourceGroupResponder(resp *http.Response) (result UserAssignedIdentitiesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 UserAssignedIdentitiesClient) listByResourceGroupNextResults(lastResults UserAssignedIdentitiesListResult) (result UserAssignedIdentitiesListResult, err error) { + req, err := lastResults.userAssignedIdentitiesListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "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, "msi.UserAssignedIdentitiesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client UserAssignedIdentitiesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result UserAssignedIdentitiesListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription lists all the userAssignedIdentities available under the specified subscription. +func (client UserAssignedIdentitiesClient) ListBySubscription(ctx context.Context) (result UserAssignedIdentitiesListResultPage, err error) { + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.uailr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.uailr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client UserAssignedIdentitiesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities", 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 UserAssignedIdentitiesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) ListBySubscriptionResponder(resp *http.Response) (result UserAssignedIdentitiesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 UserAssignedIdentitiesClient) listBySubscriptionNextResults(lastResults UserAssignedIdentitiesListResult) (result UserAssignedIdentitiesListResult, err error) { + req, err := lastResults.userAssignedIdentitiesListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "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, "msi.UserAssignedIdentitiesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client UserAssignedIdentitiesClient) ListBySubscriptionComplete(ctx context.Context) (result UserAssignedIdentitiesListResultIterator, err error) { + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update update an identity in the specified subscription and resource group. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +// parameters - parameters to update the identity +func (client UserAssignedIdentitiesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, parameters Identity) (result Identity, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client UserAssignedIdentitiesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Identity) (*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 = "2015-08-31-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.ManagedIdentity/userAssignedIdentities/{resourceName}", 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 UserAssignedIdentitiesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) UpdateResponder(resp *http.Response) (result Identity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/msi/mgmt/2015-08-31-preview/msi/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/version.go new file mode 100644 index 0000000000000..7d3f9ab50203d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/version.go @@ -0,0 +1,30 @@ +package msi + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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.Number + " msi/2015-08-31-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/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/client.go similarity index 78% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/client.go index c771ab0751500..2cbc44bf46863 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/client.go @@ -29,7 +29,6 @@ const ( DefaultBaseURI = "https://management.azure.com" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // BaseClient is the base client for Operationalinsights. type BaseClient struct { autorest.Client @@ -37,13 +36,11 @@ type BaseClient struct { SubscriptionID string } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // New creates an instance of the BaseClient client. func New(subscriptionID string) BaseClient { return NewWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewWithBaseURI creates an instance of the BaseClient client. func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/datasources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/datasources.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/datasources.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/datasources.go index 342b185e2e81b..346cc10d73a91 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/datasources.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/datasources.go @@ -25,30 +25,27 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DataSourcesClient is the operational Insights Client type DataSourcesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewDataSourcesClient creates an instance of the DataSourcesClient client. func NewDataSourcesClient(subscriptionID string) DataSourcesClient { return NewDataSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewDataSourcesClientWithBaseURI creates an instance of the DataSourcesClient client. func NewDataSourcesClientWithBaseURI(baseURI string, subscriptionID string) DataSourcesClient { return DataSourcesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdate create or update a data source. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace that will contain the datasource dataSourceName is the name of the datasource -// resource. parameters is the parameters required to create or update a datasource. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that will contain the datasource +// dataSourceName - the name of the datasource resource. +// parameters - the parameters required to create or update a datasource. func (client DataSourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (result DataSource, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -81,7 +78,6 @@ func (client DataSourcesClient) CreateOrUpdate(ctx context.Context, resourceGrou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client DataSourcesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -106,7 +102,6 @@ func (client DataSourcesClient) CreateOrUpdatePreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DataSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -114,7 +109,6 @@ func (client DataSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.R azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client DataSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result DataSource, err error) { @@ -128,11 +122,11 @@ func (client DataSourcesClient) CreateOrUpdateResponder(resp *http.Response) (re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Delete deletes a data source instance. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace that contains the datasource. dataSourceName is name of the datasource. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the datasource. +// dataSourceName - name of the datasource. func (client DataSourcesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -163,7 +157,6 @@ func (client DataSourcesClient) Delete(ctx context.Context, resourceGroupName st return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeletePreparer prepares the Delete request. func (client DataSourcesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -186,7 +179,6 @@ func (client DataSourcesClient) DeletePreparer(ctx context.Context, resourceGrou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client DataSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -194,7 +186,6 @@ func (client DataSourcesClient) DeleteSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client DataSourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -207,11 +198,11 @@ func (client DataSourcesClient) DeleteResponder(resp *http.Response) (result aut return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Get gets a datasource instance. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace that contains the datasource. dataSourceName is name of the datasource +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the datasource. +// dataSourceName - name of the datasource func (client DataSourcesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceName string) (result DataSource, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -242,7 +233,6 @@ func (client DataSourcesClient) Get(ctx context.Context, resourceGroupName strin return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetPreparer prepares the Get request. func (client DataSourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -265,7 +255,6 @@ func (client DataSourcesClient) GetPreparer(ctx context.Context, resourceGroupNa return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client DataSourcesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -273,7 +262,6 @@ func (client DataSourcesClient) GetSender(req *http.Request) (*http.Response, er azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client DataSourcesClient) GetResponder(resp *http.Response) (result DataSource, err error) { @@ -287,12 +275,12 @@ func (client DataSourcesClient) GetResponder(resp *http.Response) (result DataSo return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspace gets the first page of data source instances in a workspace with the link to the next page. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is the -// workspace that contains the data sources. filter is the filter to apply on the operation. skiptoken is starting -// point of the collection of data source instances. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - the workspace that contains the data sources. +// filter - the filter to apply on the operation. +// skiptoken - starting point of the collection of data source instances. func (client DataSourcesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, filter string, skiptoken string) (result DataSourceListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -324,7 +312,6 @@ func (client DataSourcesClient) ListByWorkspace(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspacePreparer prepares the ListByWorkspace request. func (client DataSourcesClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, filter string, skiptoken string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -350,7 +337,6 @@ func (client DataSourcesClient) ListByWorkspacePreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspaceSender sends the ListByWorkspace request. The method will close the // http.Response Body if it receives an error. func (client DataSourcesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { @@ -358,7 +344,6 @@ func (client DataSourcesClient) ListByWorkspaceSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always // closes the http.Response Body. func (client DataSourcesClient) ListByWorkspaceResponder(resp *http.Response) (result DataSourceListResult, err error) { @@ -393,7 +378,6 @@ func (client DataSourcesClient) listByWorkspaceNextResults(lastResults DataSourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. func (client DataSourcesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string, filter string, skiptoken string) (result DataSourceListResultIterator, err error) { result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName, filter, skiptoken) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/linkedservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/linkedservices.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/linkedservices.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/linkedservices.go index fbf8bfcf81717..ea3417d519a8d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/linkedservices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/linkedservices.go @@ -25,30 +25,27 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // LinkedServicesClient is the operational Insights Client type LinkedServicesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewLinkedServicesClient creates an instance of the LinkedServicesClient client. func NewLinkedServicesClient(subscriptionID string) LinkedServicesClient { return NewLinkedServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewLinkedServicesClientWithBaseURI creates an instance of the LinkedServicesClient client. func NewLinkedServicesClientWithBaseURI(baseURI string, subscriptionID string) LinkedServicesClient { return LinkedServicesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdate create or update a linked service. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace that will contain the linkedServices resource linkedServiceName is name of the -// linkedServices resource parameters is the parameters required to create or update a linked service. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that will contain the linkedServices resource +// linkedServiceName - name of the linkedServices resource +// parameters - the parameters required to create or update a linked service. func (client LinkedServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (result LinkedService, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -82,7 +79,6 @@ func (client LinkedServicesClient) CreateOrUpdate(ctx context.Context, resourceG return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client LinkedServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -107,7 +103,6 @@ func (client LinkedServicesClient) CreateOrUpdatePreparer(ctx context.Context, r return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LinkedServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -115,7 +110,6 @@ func (client LinkedServicesClient) CreateOrUpdateSender(req *http.Request) (*htt azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client LinkedServicesClient) CreateOrUpdateResponder(resp *http.Response) (result LinkedService, err error) { @@ -129,12 +123,11 @@ func (client LinkedServicesClient) CreateOrUpdateResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Delete deletes a linked service instance. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace that contains the linkedServices resource linkedServiceName is name of the linked -// service. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the linkedServices resource +// linkedServiceName - name of the linked service. func (client LinkedServicesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -165,7 +158,6 @@ func (client LinkedServicesClient) Delete(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeletePreparer prepares the Delete request. func (client LinkedServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -188,7 +180,6 @@ func (client LinkedServicesClient) DeletePreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LinkedServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -196,7 +187,6 @@ func (client LinkedServicesClient) DeleteSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client LinkedServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -209,12 +199,11 @@ func (client LinkedServicesClient) DeleteResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Get gets a linked service instance. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace that contains the linkedServices resource linkedServiceName is name of the linked -// service. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the linkedServices resource +// linkedServiceName - name of the linked service. func (client LinkedServicesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (result LinkedService, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -245,7 +234,6 @@ func (client LinkedServicesClient) Get(ctx context.Context, resourceGroupName st return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetPreparer prepares the Get request. func (client LinkedServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -268,7 +256,6 @@ func (client LinkedServicesClient) GetPreparer(ctx context.Context, resourceGrou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client LinkedServicesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -276,7 +263,6 @@ func (client LinkedServicesClient) GetSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client LinkedServicesClient) GetResponder(resp *http.Response) (result LinkedService, err error) { @@ -290,11 +276,10 @@ func (client LinkedServicesClient) GetResponder(resp *http.Response) (result Lin return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspace gets the linked services instances in a workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace that contains the linked services. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the linked services. func (client LinkedServicesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result LinkedServiceListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -325,7 +310,6 @@ func (client LinkedServicesClient) ListByWorkspace(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspacePreparer prepares the ListByWorkspace request. func (client LinkedServicesClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -347,7 +331,6 @@ func (client LinkedServicesClient) ListByWorkspacePreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspaceSender sends the ListByWorkspace request. The method will close the // http.Response Body if it receives an error. func (client LinkedServicesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { @@ -355,7 +338,6 @@ func (client LinkedServicesClient) ListByWorkspaceSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always // closes the http.Response Body. func (client LinkedServicesClient) ListByWorkspaceResponder(resp *http.Response) (result LinkedServiceListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/models.go similarity index 71% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/models.go index 2b1707a29313e..6041417caef39 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/models.go @@ -26,7 +26,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DataSourceKind enumerates the values for data source kind. type DataSourceKind string @@ -63,13 +62,11 @@ const ( WindowsPerformanceCounter DataSourceKind = "WindowsPerformanceCounter" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // PossibleDataSourceKindValues returns an array of possible values for the DataSourceKind const type. func PossibleDataSourceKindValues() []DataSourceKind { return []DataSourceKind{AzureActivityLog, ChangeTrackingCustomRegistry, ChangeTrackingDefaultPath, ChangeTrackingDefaultRegistry, ChangeTrackingPath, CustomLog, CustomLogCollection, GenericDataSource, IISLogs, LinuxPerformanceCollection, LinuxPerformanceObject, LinuxSyslog, LinuxSyslogCollection, WindowsEvent, WindowsPerformanceCounter} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // EntityStatus enumerates the values for entity status. type EntityStatus string @@ -88,13 +85,11 @@ const ( Succeeded EntityStatus = "Succeeded" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // PossibleEntityStatusValues returns an array of possible values for the EntityStatus const type. func PossibleEntityStatusValues() []EntityStatus { return []EntityStatus{Canceled, Creating, Deleting, Failed, ProvisioningAccount, Succeeded} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // SkuNameEnum enumerates the values for sku name enum. type SkuNameEnum string @@ -115,13 +110,11 @@ const ( Unlimited SkuNameEnum = "Unlimited" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // PossibleSkuNameEnumValues returns an array of possible values for the SkuNameEnum const type. func PossibleSkuNameEnumValues() []SkuNameEnum { return []SkuNameEnum{Free, PerGB2018, PerNode, Premium, Standalone, Standard, Unlimited} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DataSource datasources under OMS Workspace. type DataSource struct { autorest.Response `json:"-"` @@ -141,7 +134,6 @@ type DataSource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // MarshalJSON is the custom marshaler for DataSource. func (ds DataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -167,14 +159,12 @@ func (ds DataSource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DataSourceFilter dataSource filter. Right now, only filter by kind is supported. type DataSourceFilter struct { // Kind - Possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter' Kind DataSourceKind `json:"kind,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DataSourceListResult the list data source by workspace operation response. type DataSourceListResult struct { autorest.Response `json:"-"` @@ -184,14 +174,12 @@ type DataSourceListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DataSourceListResultIterator provides access to a complete listing of DataSource values. type DataSourceListResultIterator struct { i int page DataSourceListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *DataSourceListResultIterator) Next() error { @@ -208,19 +196,16 @@ func (iter *DataSourceListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter DataSourceListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Response returns the raw server response from the last page request. func (iter DataSourceListResultIterator) Response() DataSourceListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter DataSourceListResultIterator) Value() DataSource { @@ -230,7 +215,6 @@ func (iter DataSourceListResultIterator) Value() DataSource { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // IsEmpty returns true if the ListResult contains no values. func (dslr DataSourceListResult) IsEmpty() bool { return dslr.Value == nil || len(*dslr.Value) == 0 @@ -248,14 +232,12 @@ func (dslr DataSourceListResult) dataSourceListResultPreparer() (*http.Request, autorest.WithBaseURL(to.String(dslr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DataSourceListResultPage contains a page of DataSource values. type DataSourceListResultPage struct { fn func(DataSourceListResult) (DataSourceListResult, error) dslr DataSourceListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *DataSourceListResultPage) Next() error { @@ -267,19 +249,16 @@ func (page *DataSourceListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page DataSourceListResultPage) NotDone() bool { return !page.dslr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Response returns the raw server response from the last page request. func (page DataSourceListResultPage) Response() DataSourceListResult { return page.dslr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Values returns the slice of values for the current page or nil if there are no values. func (page DataSourceListResultPage) Values() []DataSource { if page.dslr.IsEmpty() { @@ -288,7 +267,6 @@ func (page DataSourceListResultPage) Values() []DataSource { return *page.dslr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // IntelligencePack intelligence Pack containing a string name and boolean indicating if it's enabled. type IntelligencePack struct { // Name - The name of the intelligence pack. @@ -299,7 +277,6 @@ type IntelligencePack struct { DisplayName *string `json:"displayName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // LinkedService the top level Linked service resource container. type LinkedService struct { autorest.Response `json:"-"` @@ -315,7 +292,6 @@ type LinkedService struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // MarshalJSON is the custom marshaler for LinkedService. func (ls LinkedService) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -337,7 +313,6 @@ func (ls LinkedService) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // UnmarshalJSON is the custom unmarshaler for LinkedService struct. func (ls *LinkedService) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -398,7 +373,6 @@ func (ls *LinkedService) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // LinkedServiceListResult the list linked service operation response. type LinkedServiceListResult struct { autorest.Response `json:"-"` @@ -406,28 +380,24 @@ type LinkedServiceListResult struct { Value *[]LinkedService `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // LinkedServiceProperties linked service properties. type LinkedServiceProperties struct { // ResourceID - The resource id of the resource that will be linked to the workspace. ResourceID *string `json:"resourceId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListIntelligencePack ... type ListIntelligencePack struct { autorest.Response `json:"-"` Value *[]IntelligencePack `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ManagementGroup a management group that is connected to a workspace type ManagementGroup struct { // ManagementGroupProperties - The properties of the management group. *ManagementGroupProperties `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // MarshalJSON is the custom marshaler for ManagementGroup. func (mg ManagementGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -437,7 +407,6 @@ func (mg ManagementGroup) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // UnmarshalJSON is the custom unmarshaler for ManagementGroup struct. func (mg *ManagementGroup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -462,7 +431,6 @@ func (mg *ManagementGroup) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ManagementGroupProperties management group properties. type ManagementGroupProperties struct { // ServerCount - The number of servers connected to the management group. @@ -483,7 +451,6 @@ type ManagementGroupProperties struct { Sku *string `json:"sku,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // MetricName the name of a metric. type MetricName struct { // Value - The system name of the metric. @@ -492,7 +459,6 @@ type MetricName struct { LocalizedValue *string `json:"localizedValue,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Operation supported operation of OperationalInsights resource provider. type Operation struct { // Name - Operation name: {provider}/{resource}/{operation} @@ -501,7 +467,6 @@ type Operation struct { Display *OperationDisplay `json:"display,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // OperationDisplay display metadata associated with the operation. type OperationDisplay struct { // Provider - Service provider: Microsoft OperationsManagement. @@ -512,7 +477,6 @@ type OperationDisplay struct { Operation *string `json:"operation,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // OperationListResult result of the request to list solution operations. type OperationListResult struct { autorest.Response `json:"-"` @@ -522,14 +486,12 @@ type OperationListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // OperationListResultIterator provides access to a complete listing of Operation values. type OperationListResultIterator struct { i int page OperationListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Next advances 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) Next() error { @@ -546,19 +508,16 @@ func (iter *OperationListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // 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()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Response returns the raw server response from the last page request. func (iter OperationListResultIterator) Response() OperationListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // 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 { @@ -568,7 +527,6 @@ func (iter OperationListResultIterator) Value() Operation { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // IsEmpty returns true if the ListResult contains no values. func (olr OperationListResult) IsEmpty() bool { return olr.Value == nil || len(*olr.Value) == 0 @@ -586,14 +544,12 @@ func (olr OperationListResult) operationListResultPreparer() (*http.Request, err autorest.WithBaseURL(to.String(olr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // OperationListResultPage contains a page of Operation values. type OperationListResultPage struct { fn func(OperationListResult) (OperationListResult, error) olr OperationListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Next advances to the 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) Next() error { @@ -605,19 +561,16 @@ func (page *OperationListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page OperationListResultPage) NotDone() bool { return !page.olr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Response returns the raw server response from the last page request. func (page OperationListResultPage) Response() OperationListResult { return page.olr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // 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() { @@ -626,7 +579,6 @@ func (page OperationListResultPage) Values() []Operation { return *page.olr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ProxyResource common properties of proxy resource. type ProxyResource struct { // ID - Resource ID. @@ -639,7 +591,6 @@ type ProxyResource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // MarshalJSON is the custom marshaler for ProxyResource. func (pr ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -658,7 +609,6 @@ func (pr ProxyResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Resource the resource definition. type Resource struct { // ID - Resource Id @@ -673,7 +623,6 @@ type Resource struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // MarshalJSON is the custom marshaler for Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -695,7 +644,6 @@ func (r Resource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // SharedKeys the shared keys for a workspace. type SharedKeys struct { autorest.Response `json:"-"` @@ -705,14 +653,12 @@ type SharedKeys struct { SecondarySharedKey *string `json:"secondarySharedKey,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Sku the SKU (tier) of a workspace. type Sku struct { // Name - The name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'Unlimited', 'PerNode', 'PerGB2018', 'Standalone' Name SkuNameEnum `json:"name,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // UsageMetric a metric describing the usage of a resource. type UsageMetric struct { // Name - The name of the metric. @@ -729,7 +675,6 @@ type UsageMetric struct { QuotaPeriod *string `json:"quotaPeriod,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Workspace the top level Workspace resource container. type Workspace struct { autorest.Response `json:"-"` @@ -749,7 +694,6 @@ type Workspace struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // MarshalJSON is the custom marshaler for Workspace. func (w Workspace) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -777,7 +721,6 @@ func (w Workspace) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // UnmarshalJSON is the custom unmarshaler for Workspace struct. func (w *Workspace) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -856,7 +799,6 @@ func (w *Workspace) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // WorkspaceListManagementGroupsResult the list workspace managmement groups operation response. type WorkspaceListManagementGroupsResult struct { autorest.Response `json:"-"` @@ -864,7 +806,6 @@ type WorkspaceListManagementGroupsResult struct { Value *[]ManagementGroup `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // WorkspaceListResult the list workspaces operation response. type WorkspaceListResult struct { autorest.Response `json:"-"` @@ -872,7 +813,6 @@ type WorkspaceListResult struct { Value *[]Workspace `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // WorkspaceListUsagesResult the list workspace usages operation response. type WorkspaceListUsagesResult struct { autorest.Response `json:"-"` @@ -880,7 +820,6 @@ type WorkspaceListUsagesResult struct { Value *[]UsageMetric `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // WorkspaceProperties workspace properties. type WorkspaceProperties struct { // ProvisioningState - The provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount' @@ -897,18 +836,15 @@ type WorkspaceProperties struct { RetentionInDays *int32 `json:"retentionInDays,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type WorkspacesCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WorkspacesCreateOrUpdateFuture) Result(client WorkspacesClient) (w Workspace, err error) { +func (future *WorkspacesCreateOrUpdateFuture) Result(client WorkspacesClient) (w Workspace, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -916,34 +852,15 @@ func (future WorkspacesCreateOrUpdateFuture) Result(client WorkspacesClient) (w return } if !done { - return w, azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - w, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { + w, err = client.CreateOrUpdateResponder(w.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - w, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/operations.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/operations.go index acbf0e1e8146c..3df445e34f5fc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/operations.go @@ -24,25 +24,21 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // OperationsClient is the operational Insights Client type OperationsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewOperationsClient creates an instance of the OperationsClient client. func NewOperationsClient(subscriptionID string) OperationsClient { return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // List lists all of the available OperationalInsights Rest API operations. func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { result.fn = client.listNextResults @@ -67,7 +63,6 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { const APIVersion = "2015-11-01-preview" @@ -83,7 +78,6 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // 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) { @@ -91,7 +85,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // 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) { @@ -126,7 +119,6 @@ func (client OperationsClient) listNextResults(lastResults OperationListResult) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListComplete enumerates all values, automatically crossing page boundaries as required. func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { result.page, err = client.List(ctx) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/version.go new file mode 100644 index 0000000000000..d15046da501be --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/version.go @@ -0,0 +1,30 @@ +package operationalinsights + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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.Number + " operationalinsights/2015-11-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/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/workspaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/workspaces.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/workspaces.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/workspaces.go index 5a1ac4043a4d7..f047c6afc6f29 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/workspaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights/workspaces.go @@ -25,29 +25,26 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // WorkspacesClient is the operational Insights Client type WorkspacesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewWorkspacesClient creates an instance of the WorkspacesClient client. func NewWorkspacesClient(subscriptionID string) WorkspacesClient { return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient client. func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdate create or update a workspace. -// -// resourceGroupName is the resource group name of the workspace. workspaceName is the name of the workspace. -// parameters is the parameters required to create or update a workspace. +// Parameters: +// resourceGroupName - the resource group name of the workspace. +// workspaceName - the name of the workspace. +// parameters - the parameters required to create or update a workspace. func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (result WorkspacesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: workspaceName, @@ -79,7 +76,6 @@ func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -103,23 +99,23 @@ func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (future WorkspacesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) { @@ -133,11 +129,10 @@ func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Delete deletes a workspace instance. -// -// resourceGroupName is the resource group name of the workspace. workspaceName is name of the Log Analytics -// Workspace. +// Parameters: +// resourceGroupName - the resource group name of the workspace. +// workspaceName - name of the Log Analytics Workspace. func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) if err != nil { @@ -160,7 +155,6 @@ func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeletePreparer prepares the Delete request. func (client WorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -182,7 +176,6 @@ func (client WorkspacesClient) DeletePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -190,7 +183,6 @@ func (client WorkspacesClient) DeleteSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -203,11 +195,11 @@ func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result auto return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DisableIntelligencePack disables an intelligence pack for a given workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace. intelligencePackName is the name of the intelligence pack to be disabled. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace. +// intelligencePackName - the name of the intelligence pack to be disabled. func (client WorkspacesClient) DisableIntelligencePack(ctx context.Context, resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -238,7 +230,6 @@ func (client WorkspacesClient) DisableIntelligencePack(ctx context.Context, reso return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DisableIntelligencePackPreparer prepares the DisableIntelligencePack request. func (client WorkspacesClient) DisableIntelligencePackPreparer(ctx context.Context, resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -261,7 +252,6 @@ func (client WorkspacesClient) DisableIntelligencePackPreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DisableIntelligencePackSender sends the DisableIntelligencePack request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) DisableIntelligencePackSender(req *http.Request) (*http.Response, error) { @@ -269,7 +259,6 @@ func (client WorkspacesClient) DisableIntelligencePackSender(req *http.Request) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // DisableIntelligencePackResponder handles the response to the DisableIntelligencePack request. The method always // closes the http.Response Body. func (client WorkspacesClient) DisableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) { @@ -282,11 +271,11 @@ func (client WorkspacesClient) DisableIntelligencePackResponder(resp *http.Respo return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // EnableIntelligencePack enables an intelligence pack for a given workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace. intelligencePackName is the name of the intelligence pack to be enabled. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace. +// intelligencePackName - the name of the intelligence pack to be enabled. func (client WorkspacesClient) EnableIntelligencePack(ctx context.Context, resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -317,7 +306,6 @@ func (client WorkspacesClient) EnableIntelligencePack(ctx context.Context, resou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // EnableIntelligencePackPreparer prepares the EnableIntelligencePack request. func (client WorkspacesClient) EnableIntelligencePackPreparer(ctx context.Context, resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -340,7 +328,6 @@ func (client WorkspacesClient) EnableIntelligencePackPreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // EnableIntelligencePackSender sends the EnableIntelligencePack request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) EnableIntelligencePackSender(req *http.Request) (*http.Response, error) { @@ -348,7 +335,6 @@ func (client WorkspacesClient) EnableIntelligencePackSender(req *http.Request) ( azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // EnableIntelligencePackResponder handles the response to the EnableIntelligencePack request. The method always // closes the http.Response Body. func (client WorkspacesClient) EnableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) { @@ -361,11 +347,10 @@ func (client WorkspacesClient) EnableIntelligencePackResponder(resp *http.Respon return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Get gets a workspace instance. -// -// resourceGroupName is the resource group name of the workspace. workspaceName is name of the Log Analytics -// Workspace. +// Parameters: +// resourceGroupName - the resource group name of the workspace. +// workspaceName - name of the Log Analytics Workspace. func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) if err != nil { @@ -388,7 +373,6 @@ func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetPreparer prepares the Get request. func (client WorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -410,7 +394,6 @@ func (client WorkspacesClient) GetPreparer(ctx context.Context, resourceGroupNam return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -418,7 +401,6 @@ func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, err azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { @@ -432,11 +414,10 @@ func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetSharedKeys gets the shared keys for a workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace. func (client WorkspacesClient) GetSharedKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result SharedKeys, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -467,7 +448,6 @@ func (client WorkspacesClient) GetSharedKeys(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetSharedKeysPreparer prepares the GetSharedKeys request. func (client WorkspacesClient) GetSharedKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -489,7 +469,6 @@ func (client WorkspacesClient) GetSharedKeysPreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetSharedKeysSender sends the GetSharedKeys request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) GetSharedKeysSender(req *http.Request) (*http.Response, error) { @@ -497,7 +476,6 @@ func (client WorkspacesClient) GetSharedKeysSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // GetSharedKeysResponder handles the response to the GetSharedKeys request. The method always // closes the http.Response Body. func (client WorkspacesClient) GetSharedKeysResponder(resp *http.Response) (result SharedKeys, err error) { @@ -511,7 +489,6 @@ func (client WorkspacesClient) GetSharedKeysResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // List gets the workspaces in a subscription. func (client WorkspacesClient) List(ctx context.Context) (result WorkspaceListResult, err error) { req, err := client.ListPreparer(ctx) @@ -535,7 +512,6 @@ func (client WorkspacesClient) List(ctx context.Context) (result WorkspaceListRe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListPreparer prepares the List request. func (client WorkspacesClient) ListPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -555,7 +531,6 @@ func (client WorkspacesClient) ListPreparer(ctx context.Context) (*http.Request, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, error) { @@ -563,7 +538,6 @@ func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, er azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceListResult, err error) { @@ -577,10 +551,9 @@ func (client WorkspacesClient) ListResponder(resp *http.Response) (result Worksp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByResourceGroup gets workspaces in a resource group. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkspaceListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -611,7 +584,6 @@ func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client WorkspacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -632,7 +604,6 @@ func (client WorkspacesClient) ListByResourceGroupPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -640,7 +611,6 @@ func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceListResult, err error) { @@ -654,12 +624,11 @@ func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListIntelligencePacks lists all the intelligence packs possible and whether they are enabled or disabled for a given // workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is name -// of the Log Analytics Workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace. func (client WorkspacesClient) ListIntelligencePacks(ctx context.Context, resourceGroupName string, workspaceName string) (result ListIntelligencePack, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -690,7 +659,6 @@ func (client WorkspacesClient) ListIntelligencePacks(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListIntelligencePacksPreparer prepares the ListIntelligencePacks request. func (client WorkspacesClient) ListIntelligencePacksPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -712,7 +680,6 @@ func (client WorkspacesClient) ListIntelligencePacksPreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListIntelligencePacksSender sends the ListIntelligencePacks request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) ListIntelligencePacksSender(req *http.Request) (*http.Response, error) { @@ -720,7 +687,6 @@ func (client WorkspacesClient) ListIntelligencePacksSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListIntelligencePacksResponder handles the response to the ListIntelligencePacks request. The method always // closes the http.Response Body. func (client WorkspacesClient) ListIntelligencePacksResponder(resp *http.Response) (result ListIntelligencePack, err error) { @@ -734,11 +700,10 @@ func (client WorkspacesClient) ListIntelligencePacksResponder(resp *http.Respons return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListManagementGroups gets a list of management groups connected to a workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is the -// name of the workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - the name of the workspace. func (client WorkspacesClient) ListManagementGroups(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceListManagementGroupsResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -769,7 +734,6 @@ func (client WorkspacesClient) ListManagementGroups(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListManagementGroupsPreparer prepares the ListManagementGroups request. func (client WorkspacesClient) ListManagementGroupsPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -791,7 +755,6 @@ func (client WorkspacesClient) ListManagementGroupsPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListManagementGroupsSender sends the ListManagementGroups request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) ListManagementGroupsSender(req *http.Request) (*http.Response, error) { @@ -799,7 +762,6 @@ func (client WorkspacesClient) ListManagementGroupsSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListManagementGroupsResponder handles the response to the ListManagementGroups request. The method always // closes the http.Response Body. func (client WorkspacesClient) ListManagementGroupsResponder(resp *http.Response) (result WorkspaceListManagementGroupsResult, err error) { @@ -813,11 +775,10 @@ func (client WorkspacesClient) ListManagementGroupsResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListUsages gets a list of usage metrics for a workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. workspaceName is the -// name of the workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - the name of the workspace. func (client WorkspacesClient) ListUsages(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceListUsagesResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -848,7 +809,6 @@ func (client WorkspacesClient) ListUsages(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListUsagesPreparer prepares the ListUsages request. func (client WorkspacesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -870,7 +830,6 @@ func (client WorkspacesClient) ListUsagesPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListUsagesSender sends the ListUsages request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { @@ -878,7 +837,6 @@ func (client WorkspacesClient) ListUsagesSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // ListUsagesResponder handles the response to the ListUsages request. The method always // closes the http.Response Body. func (client WorkspacesClient) ListUsagesResponder(resp *http.Response) (result WorkspaceListUsagesResult, err error) { @@ -892,11 +850,11 @@ func (client WorkspacesClient) ListUsagesResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // Update updates a workspace. -// -// resourceGroupName is the resource group name of the workspace. workspaceName is the name of the workspace. -// parameters is the parameters required to patch a workspace. +// Parameters: +// resourceGroupName - the resource group name of the workspace. +// workspaceName - the name of the workspace. +// parameters - the parameters required to patch a workspace. func (client WorkspacesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (result Workspace, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: workspaceName, @@ -927,7 +885,6 @@ func (client WorkspacesClient) Update(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // UpdatePreparer prepares the Update request. func (client WorkspacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -951,7 +908,6 @@ func (client WorkspacesClient) UpdatePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) UpdateSender(req *http.Request) (*http.Response, error) { @@ -959,7 +915,6 @@ func (client WorkspacesClient) UpdateSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/client.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/client.go index a8ab93f0c720c..819be16528c85 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/client.go @@ -29,7 +29,6 @@ const ( DefaultBaseURI = "https://management.azure.com" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // BaseClient is the base client for Operationsmanagement. type BaseClient struct { autorest.Client @@ -40,13 +39,11 @@ type BaseClient struct { ResourceName string } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // New creates an instance of the BaseClient client. func New(subscriptionID string, providerName string, resourceType string, resourceName string) BaseClient { return NewWithBaseURI(DefaultBaseURI, subscriptionID, providerName, resourceType, resourceName) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewWithBaseURI creates an instance of the BaseClient client. func NewWithBaseURI(baseURI string, subscriptionID string, providerName string, resourceType string, resourceName string) BaseClient { return BaseClient{ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementassociations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementassociations.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementassociations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementassociations.go index 209e0a50691f7..74c4f0a3b1125 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementassociations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementassociations.go @@ -25,30 +25,26 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementAssociationsClient is the operations Management Client type ManagementAssociationsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewManagementAssociationsClient creates an instance of the ManagementAssociationsClient client. func NewManagementAssociationsClient(subscriptionID string, providerName string, resourceType string, resourceName string) ManagementAssociationsClient { return NewManagementAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID, providerName, resourceType, resourceName) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewManagementAssociationsClientWithBaseURI creates an instance of the ManagementAssociationsClient client. func NewManagementAssociationsClientWithBaseURI(baseURI string, subscriptionID string, providerName string, resourceType string, resourceName string) ManagementAssociationsClient { return ManagementAssociationsClient{NewWithBaseURI(baseURI, subscriptionID, providerName, resourceType, resourceName)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdate creates or updates the ManagementAssociation. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. -// managementAssociationName is user ManagementAssociation Name. parameters is the parameters required to create -// ManagementAssociation extension. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// managementAssociationName - user ManagementAssociation Name. +// parameters - the parameters required to create ManagementAssociation extension. func (client ManagementAssociationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managementAssociationName string, parameters ManagementAssociation) (result ManagementAssociation, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -82,7 +78,6 @@ func (client ManagementAssociationsClient) CreateOrUpdate(ctx context.Context, r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ManagementAssociationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managementAssociationName string, parameters ManagementAssociation) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -109,7 +104,6 @@ func (client ManagementAssociationsClient) CreateOrUpdatePreparer(ctx context.Co return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ManagementAssociationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -117,7 +111,6 @@ func (client ManagementAssociationsClient) CreateOrUpdateSender(req *http.Reques azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ManagementAssociationsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagementAssociation, err error) { @@ -131,11 +124,10 @@ func (client ManagementAssociationsClient) CreateOrUpdateResponder(resp *http.Re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Delete deletes the ManagementAssociation in the subscription. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. -// managementAssociationName is user ManagementAssociation Name. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// managementAssociationName - user ManagementAssociation Name. func (client ManagementAssociationsClient) Delete(ctx context.Context, resourceGroupName string, managementAssociationName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -166,7 +158,6 @@ func (client ManagementAssociationsClient) Delete(ctx context.Context, resourceG return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeletePreparer prepares the Delete request. func (client ManagementAssociationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managementAssociationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -191,7 +182,6 @@ func (client ManagementAssociationsClient) DeletePreparer(ctx context.Context, r return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ManagementAssociationsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -199,7 +189,6 @@ func (client ManagementAssociationsClient) DeleteSender(req *http.Request) (*htt azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ManagementAssociationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -212,11 +201,10 @@ func (client ManagementAssociationsClient) DeleteResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Get retrieves the user ManagementAssociation. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. -// managementAssociationName is user ManagementAssociation Name. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// managementAssociationName - user ManagementAssociation Name. func (client ManagementAssociationsClient) Get(ctx context.Context, resourceGroupName string, managementAssociationName string) (result ManagementAssociation, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -247,7 +235,6 @@ func (client ManagementAssociationsClient) Get(ctx context.Context, resourceGrou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetPreparer prepares the Get request. func (client ManagementAssociationsClient) GetPreparer(ctx context.Context, resourceGroupName string, managementAssociationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -272,7 +259,6 @@ func (client ManagementAssociationsClient) GetPreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ManagementAssociationsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -280,7 +266,6 @@ func (client ManagementAssociationsClient) GetSender(req *http.Request) (*http.R azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ManagementAssociationsClient) GetResponder(resp *http.Response) (result ManagementAssociation, err error) { @@ -294,7 +279,6 @@ func (client ManagementAssociationsClient) GetResponder(resp *http.Response) (re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscription retrieves the ManagementAssociatons list. func (client ManagementAssociationsClient) ListBySubscription(ctx context.Context) (result ManagementAssociationPropertiesList, err error) { req, err := client.ListBySubscriptionPreparer(ctx) @@ -318,7 +302,6 @@ func (client ManagementAssociationsClient) ListBySubscription(ctx context.Contex return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionPreparer prepares the ListBySubscription request. func (client ManagementAssociationsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -338,7 +321,6 @@ func (client ManagementAssociationsClient) ListBySubscriptionPreparer(ctx contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. func (client ManagementAssociationsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { @@ -346,7 +328,6 @@ func (client ManagementAssociationsClient) ListBySubscriptionSender(req *http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. func (client ManagementAssociationsClient) ListBySubscriptionResponder(resp *http.Response) (result ManagementAssociationPropertiesList, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementconfigurations.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementconfigurations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementconfigurations.go index cbeb266e4e84d..e6f3d1edd137f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementconfigurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/managementconfigurations.go @@ -25,30 +25,26 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementConfigurationsClient is the operations Management Client type ManagementConfigurationsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewManagementConfigurationsClient creates an instance of the ManagementConfigurationsClient client. func NewManagementConfigurationsClient(subscriptionID string, providerName string, resourceType string, resourceName string) ManagementConfigurationsClient { return NewManagementConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID, providerName, resourceType, resourceName) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewManagementConfigurationsClientWithBaseURI creates an instance of the ManagementConfigurationsClient client. func NewManagementConfigurationsClientWithBaseURI(baseURI string, subscriptionID string, providerName string, resourceType string, resourceName string) ManagementConfigurationsClient { return ManagementConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID, providerName, resourceType, resourceName)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdate creates or updates the ManagementConfiguration. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. -// managementConfigurationName is user Management Configuration Name. parameters is the parameters required to -// create OMS Solution. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// managementConfigurationName - user Management Configuration Name. +// parameters - the parameters required to create OMS Solution. func (client ManagementConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managementConfigurationName string, parameters ManagementConfiguration) (result ManagementConfiguration, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -85,7 +81,6 @@ func (client ManagementConfigurationsClient) CreateOrUpdate(ctx context.Context, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ManagementConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managementConfigurationName string, parameters ManagementConfiguration) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -109,7 +104,6 @@ func (client ManagementConfigurationsClient) CreateOrUpdatePreparer(ctx context. return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ManagementConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -117,7 +111,6 @@ func (client ManagementConfigurationsClient) CreateOrUpdateSender(req *http.Requ azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ManagementConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagementConfiguration, err error) { @@ -131,11 +124,10 @@ func (client ManagementConfigurationsClient) CreateOrUpdateResponder(resp *http. return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Delete deletes the ManagementConfiguration in the subscription. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. -// managementConfigurationName is user Management Configuration Name. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// managementConfigurationName - user Management Configuration Name. func (client ManagementConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, managementConfigurationName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -166,7 +158,6 @@ func (client ManagementConfigurationsClient) Delete(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeletePreparer prepares the Delete request. func (client ManagementConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managementConfigurationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -188,7 +179,6 @@ func (client ManagementConfigurationsClient) DeletePreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ManagementConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -196,7 +186,6 @@ func (client ManagementConfigurationsClient) DeleteSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ManagementConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -209,11 +198,10 @@ func (client ManagementConfigurationsClient) DeleteResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Get retrieves the user ManagementConfiguration. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. -// managementConfigurationName is user Management Configuration Name. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// managementConfigurationName - user Management Configuration Name. func (client ManagementConfigurationsClient) Get(ctx context.Context, resourceGroupName string, managementConfigurationName string) (result ManagementConfiguration, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -244,7 +232,6 @@ func (client ManagementConfigurationsClient) Get(ctx context.Context, resourceGr return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetPreparer prepares the Get request. func (client ManagementConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, managementConfigurationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -266,7 +253,6 @@ func (client ManagementConfigurationsClient) GetPreparer(ctx context.Context, re return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ManagementConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -274,7 +260,6 @@ func (client ManagementConfigurationsClient) GetSender(req *http.Request) (*http azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ManagementConfigurationsClient) GetResponder(resp *http.Response) (result ManagementConfiguration, err error) { @@ -288,7 +273,6 @@ func (client ManagementConfigurationsClient) GetResponder(resp *http.Response) ( return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscription retrieves the ManagementConfigurations list. func (client ManagementConfigurationsClient) ListBySubscription(ctx context.Context) (result ManagementConfigurationPropertiesList, err error) { req, err := client.ListBySubscriptionPreparer(ctx) @@ -312,7 +296,6 @@ func (client ManagementConfigurationsClient) ListBySubscription(ctx context.Cont return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionPreparer prepares the ListBySubscription request. func (client ManagementConfigurationsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -332,7 +315,6 @@ func (client ManagementConfigurationsClient) ListBySubscriptionPreparer(ctx cont return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. func (client ManagementConfigurationsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { @@ -340,7 +322,6 @@ func (client ManagementConfigurationsClient) ListBySubscriptionSender(req *http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. func (client ManagementConfigurationsClient) ListBySubscriptionResponder(resp *http.Response) (result ManagementConfigurationPropertiesList, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/models.go similarity index 76% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/models.go index e55b77ea52dab..34fc539c9135c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/models.go @@ -21,7 +21,6 @@ import ( "github.com/Azure/go-autorest/autorest" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ArmTemplateParameter parameter to pass to ARM template type ArmTemplateParameter struct { // Name - name of the parameter. @@ -30,14 +29,12 @@ type ArmTemplateParameter struct { Value *string `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CodeMessageError the error body contract. type CodeMessageError struct { // Error - The error details for a failed request. Error *CodeMessageErrorError `json:"error,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CodeMessageErrorError the error details for a failed request. type CodeMessageErrorError struct { // Code - The error type. @@ -46,7 +43,6 @@ type CodeMessageErrorError struct { Message *string `json:"message,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementAssociation the container for solution. type ManagementAssociation struct { autorest.Response `json:"-"` @@ -62,7 +58,6 @@ type ManagementAssociation struct { Properties *ManagementAssociationProperties `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementAssociationProperties managementAssociation properties supported by the OperationsManagement resource // provider. type ManagementAssociationProperties struct { @@ -70,7 +65,6 @@ type ManagementAssociationProperties struct { ApplicationID *string `json:"applicationId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementAssociationPropertiesList the list of ManagementAssociation response type ManagementAssociationPropertiesList struct { autorest.Response `json:"-"` @@ -78,7 +72,6 @@ type ManagementAssociationPropertiesList struct { Value *[]ManagementAssociation `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementConfiguration the container for solution. type ManagementConfiguration struct { autorest.Response `json:"-"` @@ -94,7 +87,6 @@ type ManagementConfiguration struct { Properties *ManagementConfigurationProperties `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementConfigurationProperties managementConfiguration properties supported by the OperationsManagement // resource provider. type ManagementConfigurationProperties struct { @@ -110,7 +102,6 @@ type ManagementConfigurationProperties struct { Template interface{} `json:"template,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ManagementConfigurationPropertiesList the list of ManagementConfiguration response type ManagementConfigurationPropertiesList struct { autorest.Response `json:"-"` @@ -118,7 +109,6 @@ type ManagementConfigurationPropertiesList struct { Value *[]ManagementConfiguration `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Operation supported operation of OperationsManagement resource provider. type Operation struct { // Name - Operation name: {provider}/{resource}/{operation} @@ -127,7 +117,6 @@ type Operation struct { Display *OperationDisplay `json:"display,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // OperationDisplay display metadata associated with the operation. type OperationDisplay struct { // Provider - Service provider: Microsoft OperationsManagement. @@ -138,7 +127,6 @@ type OperationDisplay struct { Operation *string `json:"operation,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // OperationListResult result of the request to list solution operations. type OperationListResult struct { autorest.Response `json:"-"` @@ -146,7 +134,6 @@ type OperationListResult struct { Value *[]Operation `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Solution the container for solution. type Solution struct { autorest.Response `json:"-"` @@ -164,7 +151,6 @@ type Solution struct { Properties *SolutionProperties `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // SolutionPlan plan for solution object supported by the OperationsManagement resource provider. type SolutionPlan struct { // Name - name of the solution to be created. For Microsoft published solution it should be in the format of solutionType(workspaceName). SolutionType part is case sensitive. For third party solution, it can be anything. @@ -177,7 +163,6 @@ type SolutionPlan struct { Product *string `json:"product,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // SolutionProperties solution properties supported by the OperationsManagement resource provider. type SolutionProperties struct { // WorkspaceResourceID - The azure resourceId for the workspace where the solution will be deployed/enabled. @@ -190,7 +175,6 @@ type SolutionProperties struct { ReferencedResources *[]string `json:"referencedResources,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // SolutionPropertiesList the list of solution response type SolutionPropertiesList struct { autorest.Response `json:"-"` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/operations.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/operations.go index dd78b1cb4f1f4..f64d685b2d26f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/operations.go @@ -24,25 +24,21 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // OperationsClient is the operations Management Client type OperationsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewOperationsClient creates an instance of the OperationsClient client. func NewOperationsClient(subscriptionID string, providerName string, resourceType string, resourceName string) OperationsClient { return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, providerName, resourceType, resourceName) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, providerName string, resourceType string, resourceName string) OperationsClient { return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, providerName, resourceType, resourceName)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // List lists all of the available OperationsManagement Rest API operations. func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { req, err := client.ListPreparer(ctx) @@ -66,7 +62,6 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { const APIVersion = "2015-11-01-preview" @@ -82,7 +77,6 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // 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) { @@ -90,7 +84,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // 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) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/solutions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/solutions.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/solutions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/solutions.go index 3389e157f9c17..91c0b6a4c3ffe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/solutions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/solutions.go @@ -25,29 +25,26 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // SolutionsClient is the operations Management Client type SolutionsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewSolutionsClient creates an instance of the SolutionsClient client. func NewSolutionsClient(subscriptionID string, providerName string, resourceType string, resourceName string) SolutionsClient { return NewSolutionsClientWithBaseURI(DefaultBaseURI, subscriptionID, providerName, resourceType, resourceName) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // NewSolutionsClientWithBaseURI creates an instance of the SolutionsClient client. func NewSolutionsClientWithBaseURI(baseURI string, subscriptionID string, providerName string, resourceType string, resourceName string) SolutionsClient { return SolutionsClient{NewWithBaseURI(baseURI, subscriptionID, providerName, resourceType, resourceName)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdate creates or updates the Solution. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. solutionName is user -// Solution Name. parameters is the parameters required to create OMS Solution. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// solutionName - user Solution Name. +// parameters - the parameters required to create OMS Solution. func (client SolutionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, solutionName string, parameters Solution) (result Solution, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -81,7 +78,6 @@ func (client SolutionsClient) CreateOrUpdate(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client SolutionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, solutionName string, parameters Solution) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -105,7 +101,6 @@ func (client SolutionsClient) CreateOrUpdatePreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SolutionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -113,7 +108,6 @@ func (client SolutionsClient) CreateOrUpdateSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client SolutionsClient) CreateOrUpdateResponder(resp *http.Response) (result Solution, err error) { @@ -127,11 +121,10 @@ func (client SolutionsClient) CreateOrUpdateResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Delete deletes the solution in the subscription. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. solutionName is user -// Solution Name. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// solutionName - user Solution Name. func (client SolutionsClient) Delete(ctx context.Context, resourceGroupName string, solutionName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -162,7 +155,6 @@ func (client SolutionsClient) Delete(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeletePreparer prepares the Delete request. func (client SolutionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -184,7 +176,6 @@ func (client SolutionsClient) DeletePreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SolutionsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -192,7 +183,6 @@ func (client SolutionsClient) DeleteSender(req *http.Request) (*http.Response, e azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client SolutionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -205,11 +195,10 @@ func (client SolutionsClient) DeleteResponder(resp *http.Response) (result autor return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // Get retrieves the user solution. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. solutionName is user -// Solution Name. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// solutionName - user Solution Name. func (client SolutionsClient) Get(ctx context.Context, resourceGroupName string, solutionName string) (result Solution, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -240,7 +229,6 @@ func (client SolutionsClient) Get(ctx context.Context, resourceGroupName string, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetPreparer prepares the Get request. func (client SolutionsClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -262,7 +250,6 @@ func (client SolutionsClient) GetPreparer(ctx context.Context, resourceGroupName return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SolutionsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -270,7 +257,6 @@ func (client SolutionsClient) GetSender(req *http.Request) (*http.Response, erro azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client SolutionsClient) GetResponder(resp *http.Response) (result Solution, err error) { @@ -284,10 +270,9 @@ func (client SolutionsClient) GetResponder(resp *http.Response) (result Solution return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListByResourceGroup retrieves the solution list. It will retrieve both first party and third party solutions -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. func (client SolutionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SolutionPropertiesList, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -318,7 +303,6 @@ func (client SolutionsClient) ListByResourceGroup(ctx context.Context, resourceG return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client SolutionsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -339,7 +323,6 @@ func (client SolutionsClient) ListByResourceGroupPreparer(ctx context.Context, r return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client SolutionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -347,7 +330,6 @@ func (client SolutionsClient) ListByResourceGroupSender(req *http.Request) (*htt azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client SolutionsClient) ListByResourceGroupResponder(resp *http.Response) (result SolutionPropertiesList, err error) { @@ -361,7 +343,6 @@ func (client SolutionsClient) ListByResourceGroupResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscription retrieves the solution list. It will retrieve both first party and third party solutions func (client SolutionsClient) ListBySubscription(ctx context.Context) (result SolutionPropertiesList, err error) { req, err := client.ListBySubscriptionPreparer(ctx) @@ -385,7 +366,6 @@ func (client SolutionsClient) ListBySubscription(ctx context.Context) (result So return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionPreparer prepares the ListBySubscription request. func (client SolutionsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -405,7 +385,6 @@ func (client SolutionsClient) ListBySubscriptionPreparer(ctx context.Context) (* return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. func (client SolutionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { @@ -413,7 +392,6 @@ func (client SolutionsClient) ListBySubscriptionSender(req *http.Request) (*http azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement instead. // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. func (client SolutionsClient) ListBySubscriptionResponder(resp *http.Response) (result SolutionPropertiesList, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/version.go new file mode 100644 index 0000000000000..f33e0e91aa511 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement/version.go @@ -0,0 +1,30 @@ +package operationsmanagement + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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.Number + " operationsmanagement/2015-11-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/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionpolicies.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionpolicies.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionpolicies.go index 31557e2a2a526..4434c8d8829b3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionpolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionpolicies.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web // services that interact with Azure SQL Database services to manage your databases. The API enables you to create, // retrieve, update, and delete databases. @@ -33,25 +32,24 @@ type BackupLongTermRetentionPoliciesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewBackupLongTermRetentionPoliciesClient creates an instance of the BackupLongTermRetentionPoliciesClient client. func NewBackupLongTermRetentionPoliciesClient(subscriptionID string) BackupLongTermRetentionPoliciesClient { return NewBackupLongTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewBackupLongTermRetentionPoliciesClientWithBaseURI creates an instance of the BackupLongTermRetentionPoliciesClient // client. func NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionPoliciesClient { return BackupLongTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a database backup long term retention policy -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database parameters is the required parameters to update a backup long term retention policy +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database +// parameters - the required parameters to update a backup long term retention policy func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (result BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -75,7 +73,6 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.C return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -101,23 +98,23 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx c return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { @@ -131,12 +128,12 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get returns a database backup long term retention policy -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client BackupLongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicy, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -159,7 +156,6 @@ func (client BackupLongTermRetentionPoliciesClient) Get(ctx context.Context, res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client BackupLongTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -183,7 +179,6 @@ func (client BackupLongTermRetentionPoliciesClient) GetPreparer(ctx context.Cont return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client BackupLongTermRetentionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -191,7 +186,6 @@ func (client BackupLongTermRetentionPoliciesClient) GetSender(req *http.Request) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client BackupLongTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { @@ -205,12 +199,12 @@ func (client BackupLongTermRetentionPoliciesClient) GetResponder(resp *http.Resp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase returns a database backup long term retention policy -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client BackupLongTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicyListResult, err error) { req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -233,7 +227,6 @@ func (client BackupLongTermRetentionPoliciesClient) ListByDatabase(ctx context.C return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client BackupLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -256,7 +249,6 @@ func (client BackupLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx c return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -264,7 +256,6 @@ func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseSender(req *ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result BackupLongTermRetentionPolicyListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionvaults.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionvaults.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionvaults.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionvaults.go index 0f79b0981d15f..81316d00023a0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionvaults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/backuplongtermretentionvaults.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionVaultsClient is the the Azure SQL Database management API provides a RESTful set of web // services that interact with Azure SQL Database services to manage your databases. The API enables you to create, // retrieve, update, and delete databases. @@ -33,25 +32,23 @@ type BackupLongTermRetentionVaultsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewBackupLongTermRetentionVaultsClient creates an instance of the BackupLongTermRetentionVaultsClient client. func NewBackupLongTermRetentionVaultsClient(subscriptionID string) BackupLongTermRetentionVaultsClient { return NewBackupLongTermRetentionVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewBackupLongTermRetentionVaultsClientWithBaseURI creates an instance of the BackupLongTermRetentionVaultsClient // client. func NewBackupLongTermRetentionVaultsClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionVaultsClient { return BackupLongTermRetentionVaultsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate updates a server backup long term retention vault -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the required -// parameters to update a backup long term retention vault +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters to update a backup long term retention vault func (client BackupLongTermRetentionVaultsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters BackupLongTermRetentionVault) (result BackupLongTermRetentionVaultsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -75,7 +72,6 @@ func (client BackupLongTermRetentionVaultsClient) CreateOrUpdate(ctx context.Con return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client BackupLongTermRetentionVaultsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters BackupLongTermRetentionVault) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -100,23 +96,23 @@ func (client BackupLongTermRetentionVaultsClient) CreateOrUpdatePreparer(ctx con return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client BackupLongTermRetentionVaultsClient) CreateOrUpdateSender(req *http.Request) (future BackupLongTermRetentionVaultsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client BackupLongTermRetentionVaultsClient) CreateOrUpdateResponder(resp *http.Response) (result BackupLongTermRetentionVault, err error) { @@ -130,11 +126,11 @@ func (client BackupLongTermRetentionVaultsClient) CreateOrUpdateResponder(resp * return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a server backup long term retention vault -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client BackupLongTermRetentionVaultsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result BackupLongTermRetentionVault, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -157,7 +153,6 @@ func (client BackupLongTermRetentionVaultsClient) Get(ctx context.Context, resou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client BackupLongTermRetentionVaultsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -180,7 +175,6 @@ func (client BackupLongTermRetentionVaultsClient) GetPreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client BackupLongTermRetentionVaultsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -188,7 +182,6 @@ func (client BackupLongTermRetentionVaultsClient) GetSender(req *http.Request) ( azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client BackupLongTermRetentionVaultsClient) GetResponder(resp *http.Response) (result BackupLongTermRetentionVault, err error) { @@ -202,11 +195,11 @@ func (client BackupLongTermRetentionVaultsClient) GetResponder(resp *http.Respon return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer gets server backup long term retention vaults in a server -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client BackupLongTermRetentionVaultsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result BackupLongTermRetentionVaultListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -229,7 +222,6 @@ func (client BackupLongTermRetentionVaultsClient) ListByServer(ctx context.Conte return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client BackupLongTermRetentionVaultsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -251,7 +243,6 @@ func (client BackupLongTermRetentionVaultsClient) ListByServerPreparer(ctx conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client BackupLongTermRetentionVaultsClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -259,7 +250,6 @@ func (client BackupLongTermRetentionVaultsClient) ListByServerSender(req *http.R azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client BackupLongTermRetentionVaultsClient) ListByServerResponder(resp *http.Response) (result BackupLongTermRetentionVaultListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/capabilities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/capabilities.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/capabilities.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/capabilities.go index 9e478bec88d5f..eacb96270f4f9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/capabilities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/capabilities.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CapabilitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,22 +31,19 @@ type CapabilitiesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewCapabilitiesClient creates an instance of the CapabilitiesClient client. func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { return NewCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewCapabilitiesClientWithBaseURI creates an instance of the CapabilitiesClient client. func NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { return CapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocation gets the subscription capabilities available for the specified location. -// -// locationName is the location name whose capabilities are retrieved. +// Parameters: +// locationName - the location name whose capabilities are retrieved. func (client CapabilitiesClient) ListByLocation(ctx context.Context, locationName string) (result LocationCapabilities, err error) { req, err := client.ListByLocationPreparer(ctx, locationName) if err != nil { @@ -70,7 +66,6 @@ func (client CapabilitiesClient) ListByLocation(ctx context.Context, locationNam return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocationPreparer prepares the ListByLocation request. func (client CapabilitiesClient) ListByLocationPreparer(ctx context.Context, locationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -91,7 +86,6 @@ func (client CapabilitiesClient) ListByLocationPreparer(ctx context.Context, loc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocationSender sends the ListByLocation request. The method will close the // http.Response Body if it receives an error. func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { @@ -99,7 +93,6 @@ func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocationResponder handles the response to the ListByLocation request. The method always // closes the http.Response Body. func (client CapabilitiesClient) ListByLocationResponder(resp *http.Response) (result LocationCapabilities, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/client.go similarity index 82% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/client.go index 3bb66c3c5b2a7..40ec57b36babe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/client.go @@ -30,7 +30,6 @@ const ( DefaultBaseURI = "https://management.azure.com" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BaseClient is the base client for Sql. type BaseClient struct { autorest.Client @@ -38,13 +37,11 @@ type BaseClient struct { SubscriptionID string } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // New creates an instance of the BaseClient client. func New(subscriptionID string) BaseClient { return NewWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewWithBaseURI creates an instance of the BaseClient client. func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go index 9202465200b91..0633f3963616d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseBlobAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web // services that interact with Azure SQL Database services to manage your databases. The API enables you to create, // retrieve, update, and delete databases. @@ -32,26 +31,24 @@ type DatabaseBlobAuditingPoliciesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabaseBlobAuditingPoliciesClient creates an instance of the DatabaseBlobAuditingPoliciesClient client. func NewDatabaseBlobAuditingPoliciesClient(subscriptionID string) DatabaseBlobAuditingPoliciesClient { return NewDatabaseBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabaseBlobAuditingPoliciesClientWithBaseURI creates an instance of the DatabaseBlobAuditingPoliciesClient // client. func NewDatabaseBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseBlobAuditingPoliciesClient { return DatabaseBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a database's blob auditing policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database for which the blob auditing policy will be defined. parameters is the database blob auditing -// policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// parameters - the database blob auditing policy. func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (result DatabaseBlobAuditingPolicy, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -74,7 +71,6 @@ func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Cont return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -100,7 +96,6 @@ func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx cont return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -108,7 +103,6 @@ func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { @@ -122,12 +116,12 @@ func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *h return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a database's blob auditing policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database for which the blob audit policy is defined. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DatabaseBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicy, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -150,7 +144,6 @@ func (client DatabaseBlobAuditingPoliciesClient) Get(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client DatabaseBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -174,7 +167,6 @@ func (client DatabaseBlobAuditingPoliciesClient) GetPreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client DatabaseBlobAuditingPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -182,7 +174,6 @@ func (client DatabaseBlobAuditingPoliciesClient) GetSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client DatabaseBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databases.go similarity index 75% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databases.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databases.go index 06581bab7ca98..8417ebc15b759 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databases.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databases.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -33,25 +32,24 @@ type DatabasesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabasesClient creates an instance of the DatabasesClient client. func NewDatabasesClient(subscriptionID string) DatabasesClient { return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client. func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateImportOperation creates an import operation that imports a bacpac into an existing database. The existing // database must be empty. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to import into parameters is the required parameters for importing a Bacpac into a database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to import into +// parameters - the required parameters for importing a Bacpac into a database. func (client DatabasesClient) CreateImportOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest) (result DatabasesCreateImportOperationFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -75,7 +73,6 @@ func (client DatabasesClient) CreateImportOperation(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateImportOperationPreparer prepares the CreateImportOperation request. func (client DatabasesClient) CreateImportOperationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -101,23 +98,23 @@ func (client DatabasesClient) CreateImportOperationPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateImportOperationSender sends the CreateImportOperation request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) CreateImportOperationSender(req *http.Request) (future DatabasesCreateImportOperationFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateImportOperationResponder handles the response to the CreateImportOperation request. The method always // closes the http.Response Body. func (client DatabasesClient) CreateImportOperationResponder(resp *http.Response) (result ImportExportResponse, err error) { @@ -131,13 +128,13 @@ func (client DatabasesClient) CreateImportOperationResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates a new database or updates an existing database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to be operated on (updated or created). parameters is the required parameters for creating or -// updating a database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to be operated on (updated or created). +// parameters - the required parameters for creating or updating a database. func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -154,7 +151,6 @@ func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -179,23 +175,23 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { @@ -209,12 +205,12 @@ func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to be deleted. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to be deleted. func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -237,7 +233,6 @@ func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -260,7 +255,6 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) (*http.Response, error) { @@ -268,7 +262,6 @@ func (client DatabasesClient) DeleteSender(req *http.Request) (*http.Response, e azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -281,12 +274,13 @@ func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autor return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Export exports a database to a bacpac. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to be exported. parameters is the required parameters for exporting a database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to be exported. +// parameters - the required parameters for exporting a database. func (client DatabasesClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportRequest) (result DatabasesExportFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -312,7 +306,6 @@ func (client DatabasesClient) Export(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ExportPreparer prepares the Export request. func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -337,23 +330,23 @@ func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ExportResponder handles the response to the Export request. The method always // closes the http.Response Body. func (client DatabasesClient) ExportResponder(resp *http.Response) (result ImportExportResponse, err error) { @@ -367,13 +360,14 @@ func (client DatabasesClient) ExportResponder(resp *http.Response) (result Impor return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to be retrieved. expand is a comma separated list of child objects to expand in the response. -// Possible properties: serviceTierAdvisors, transparentDataEncryption. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to be retrieved. +// expand - a comma separated list of child objects to expand in the response. Possible properties: +// serviceTierAdvisors, transparentDataEncryption. func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, expand string) (result Database, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, expand) if err != nil { @@ -396,7 +390,6 @@ func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -422,7 +415,6 @@ func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -430,7 +422,6 @@ func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, erro azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -444,12 +435,13 @@ func (client DatabasesClient) GetResponder(resp *http.Response) (result Database return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByElasticPool gets a database inside of an elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool to be retrieved. databaseName is the name of the database to be retrieved. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool to be retrieved. +// databaseName - the name of the database to be retrieved. func (client DatabasesClient) GetByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (result Database, err error) { req, err := client.GetByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName, databaseName) if err != nil { @@ -472,7 +464,6 @@ func (client DatabasesClient) GetByElasticPool(ctx context.Context, resourceGrou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByElasticPoolPreparer prepares the GetByElasticPool request. func (client DatabasesClient) GetByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -496,7 +487,6 @@ func (client DatabasesClient) GetByElasticPoolPreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByElasticPoolSender sends the GetByElasticPool request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) GetByElasticPoolSender(req *http.Request) (*http.Response, error) { @@ -504,7 +494,6 @@ func (client DatabasesClient) GetByElasticPoolSender(req *http.Request) (*http.R azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByElasticPoolResponder handles the response to the GetByElasticPool request. The method always // closes the http.Response Body. func (client DatabasesClient) GetByElasticPoolResponder(resp *http.Response) (result Database, err error) { @@ -518,12 +507,13 @@ func (client DatabasesClient) GetByElasticPoolResponder(resp *http.Response) (re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByRecommendedElasticPool gets a database inside of a recommented elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. recommendedElasticPoolName -// is the name of the elastic pool to be retrieved. databaseName is the name of the database to be retrieved. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// recommendedElasticPoolName - the name of the elastic pool to be retrieved. +// databaseName - the name of the database to be retrieved. func (client DatabasesClient) GetByRecommendedElasticPool(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (result Database, err error) { req, err := client.GetByRecommendedElasticPoolPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName, databaseName) if err != nil { @@ -546,7 +536,6 @@ func (client DatabasesClient) GetByRecommendedElasticPool(ctx context.Context, r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByRecommendedElasticPoolPreparer prepares the GetByRecommendedElasticPool request. func (client DatabasesClient) GetByRecommendedElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -570,7 +559,6 @@ func (client DatabasesClient) GetByRecommendedElasticPoolPreparer(ctx context.Co return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByRecommendedElasticPoolSender sends the GetByRecommendedElasticPool request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) GetByRecommendedElasticPoolSender(req *http.Request) (*http.Response, error) { @@ -578,7 +566,6 @@ func (client DatabasesClient) GetByRecommendedElasticPoolSender(req *http.Reques azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetByRecommendedElasticPoolResponder handles the response to the GetByRecommendedElasticPool request. The method always // closes the http.Response Body. func (client DatabasesClient) GetByRecommendedElasticPoolResponder(resp *http.Response) (result Database, err error) { @@ -592,12 +579,12 @@ func (client DatabasesClient) GetByRecommendedElasticPoolResponder(resp *http.Re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Import imports a bacpac into a new database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the required -// parameters for importing a Bacpac into a database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for importing a Bacpac into a database. func (client DatabasesClient) Import(ctx context.Context, resourceGroupName string, serverName string, parameters ImportRequest) (result DatabasesImportFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -621,7 +608,6 @@ func (client DatabasesClient) Import(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ImportPreparer prepares the Import request. func (client DatabasesClient) ImportPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ImportRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -645,23 +631,23 @@ func (client DatabasesClient) ImportPreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ImportResponder handles the response to the Import request. The method always // closes the http.Response Body. func (client DatabasesClient) ImportResponder(resp *http.Response) (result ImportExportResponse, err error) { @@ -675,12 +661,12 @@ func (client DatabasesClient) ImportResponder(resp *http.Response) (result Impor return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPool returns a list of databases in an elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool to be retrieved. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool to be retrieved. func (client DatabasesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResult, err error) { req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -703,7 +689,6 @@ func (client DatabasesClient) ListByElasticPool(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolPreparer prepares the ListByElasticPool request. func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -726,7 +711,6 @@ func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolSender sends the ListByElasticPool request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { @@ -734,7 +718,6 @@ func (client DatabasesClient) ListByElasticPoolSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always // closes the http.Response Body. func (client DatabasesClient) ListByElasticPoolResponder(resp *http.Response) (result DatabaseListResult, err error) { @@ -748,12 +731,12 @@ func (client DatabasesClient) ListByElasticPoolResponder(resp *http.Response) (r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByRecommendedElasticPool returns a list of databases inside a recommented elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// recommendedElasticPoolName - the name of the recommended elastic pool to be retrieved. func (client DatabasesClient) ListByRecommendedElasticPool(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result DatabaseListResult, err error) { req, err := client.ListByRecommendedElasticPoolPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName) if err != nil { @@ -776,7 +759,6 @@ func (client DatabasesClient) ListByRecommendedElasticPool(ctx context.Context, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByRecommendedElasticPoolPreparer prepares the ListByRecommendedElasticPool request. func (client DatabasesClient) ListByRecommendedElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -799,7 +781,6 @@ func (client DatabasesClient) ListByRecommendedElasticPoolPreparer(ctx context.C return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByRecommendedElasticPoolSender sends the ListByRecommendedElasticPool request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) ListByRecommendedElasticPoolSender(req *http.Request) (*http.Response, error) { @@ -807,7 +788,6 @@ func (client DatabasesClient) ListByRecommendedElasticPoolSender(req *http.Reque azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByRecommendedElasticPoolResponder handles the response to the ListByRecommendedElasticPool request. The method always // closes the http.Response Body. func (client DatabasesClient) ListByRecommendedElasticPoolResponder(resp *http.Response) (result DatabaseListResult, err error) { @@ -821,13 +801,14 @@ func (client DatabasesClient) ListByRecommendedElasticPoolResponder(resp *http.R return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer returns a list of databases in a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. expand is a comma separated -// list of child objects to expand in the response. Possible properties: serviceTierAdvisors, -// transparentDataEncryption. filter is an OData filter expression that describes a subset of databases to return. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// expand - a comma separated list of child objects to expand in the response. Possible properties: +// serviceTierAdvisors, transparentDataEncryption. +// filter - an OData filter expression that describes a subset of databases to return. func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, expand string, filter string) (result DatabaseListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, expand, filter) if err != nil { @@ -850,7 +831,6 @@ func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupNam return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, expand string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -878,7 +858,6 @@ func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resource return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -886,7 +865,6 @@ func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Respo azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { @@ -900,12 +878,12 @@ func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitions returns database metric definitions. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DatabasesClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result MetricDefinitionListResult, err error) { req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -928,7 +906,6 @@ func (client DatabasesClient) ListMetricDefinitions(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. func (client DatabasesClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -951,7 +928,6 @@ func (client DatabasesClient) ListMetricDefinitionsPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { @@ -959,7 +935,6 @@ func (client DatabasesClient) ListMetricDefinitionsSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always // closes the http.Response Body. func (client DatabasesClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { @@ -973,12 +948,13 @@ func (client DatabasesClient) ListMetricDefinitionsResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetrics returns database metrics. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. filter is an OData filter expression that describes a subset of metrics to return. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// filter - an OData filter expression that describes a subset of metrics to return. func (client DatabasesClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result MetricListResult, err error) { req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, databaseName, filter) if err != nil { @@ -1001,7 +977,6 @@ func (client DatabasesClient) ListMetrics(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricsPreparer prepares the ListMetrics request. func (client DatabasesClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -1025,7 +1000,6 @@ func (client DatabasesClient) ListMetricsPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricsSender sends the ListMetrics request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) ListMetricsSender(req *http.Request) (*http.Response, error) { @@ -1033,7 +1007,6 @@ func (client DatabasesClient) ListMetricsSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricsResponder handles the response to the ListMetrics request. The method always // closes the http.Response Body. func (client DatabasesClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { @@ -1047,12 +1020,12 @@ func (client DatabasesClient) ListMetricsResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Pause pauses a data warehouse. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the data warehouse to pause. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the data warehouse to pause. func (client DatabasesClient) Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesPauseFuture, err error) { req, err := client.PausePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -1069,7 +1042,6 @@ func (client DatabasesClient) Pause(ctx context.Context, resourceGroupName strin return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PausePreparer prepares the Pause request. func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -1092,23 +1064,23 @@ func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupNa return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PauseSender sends the Pause request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) PauseSender(req *http.Request) (future DatabasesPauseFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PauseResponder handles the response to the Pause request. The method always // closes the http.Response Body. func (client DatabasesClient) PauseResponder(resp *http.Response) (result autorest.Response, err error) { @@ -1121,12 +1093,12 @@ func (client DatabasesClient) PauseResponder(resp *http.Response) (result autore return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Resume resumes a data warehouse. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the data warehouse to resume. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the data warehouse to resume. func (client DatabasesClient) Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesResumeFuture, err error) { req, err := client.ResumePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -1143,7 +1115,6 @@ func (client DatabasesClient) Resume(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ResumePreparer prepares the Resume request. func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -1166,23 +1137,23 @@ func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ResumeSender sends the Resume request. The method will close the // http.Response Body if it receives an error. func (client DatabasesClient) ResumeSender(req *http.Request) (future DatabasesResumeFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ResumeResponder handles the response to the Resume request. The method always // closes the http.Response Body. func (client DatabasesClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { @@ -1195,12 +1166,13 @@ func (client DatabasesClient) ResumeResponder(resp *http.Response) (result autor return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Update updates an existing database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to be updated. parameters is the required parameters for updating a database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to be updated. +// parameters - the required parameters for updating a database. func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (result DatabasesUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -1217,7 +1189,6 @@ func (client DatabasesClient) Update(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdatePreparer prepares the Update request. func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -1242,23 +1213,23 @@ func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go index 73bc6a5dfdef7..ff201caadaeb2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseThreatDetectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web // services that interact with Azure SQL Database services to manage your databases. The API enables you to create, // retrieve, update, and delete databases. @@ -32,26 +31,24 @@ type DatabaseThreatDetectionPoliciesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabaseThreatDetectionPoliciesClient creates an instance of the DatabaseThreatDetectionPoliciesClient client. func NewDatabaseThreatDetectionPoliciesClient(subscriptionID string) DatabaseThreatDetectionPoliciesClient { return NewDatabaseThreatDetectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabaseThreatDetectionPoliciesClientWithBaseURI creates an instance of the DatabaseThreatDetectionPoliciesClient // client. func NewDatabaseThreatDetectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseThreatDetectionPoliciesClient { return DatabaseThreatDetectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a database's threat detection policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database for which database Threat Detection policy is defined. parameters is the database Threat Detection -// policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database for which database Threat Detection policy is defined. +// parameters - the database Threat Detection policy. func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (result DatabaseSecurityAlertPolicy, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -74,7 +71,6 @@ func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdate(ctx context.C return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -100,7 +96,6 @@ func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdatePreparer(ctx c return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -108,7 +103,6 @@ func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdateSender(req *ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { @@ -122,12 +116,12 @@ func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdateResponder(resp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a database's threat detection policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database for which database Threat Detection policy is defined. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database for which database Threat Detection policy is defined. func (client DatabaseThreatDetectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseSecurityAlertPolicy, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -150,7 +144,6 @@ func (client DatabaseThreatDetectionPoliciesClient) Get(ctx context.Context, res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client DatabaseThreatDetectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -174,7 +167,6 @@ func (client DatabaseThreatDetectionPoliciesClient) GetPreparer(ctx context.Cont return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client DatabaseThreatDetectionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -182,7 +174,6 @@ func (client DatabaseThreatDetectionPoliciesClient) GetSender(req *http.Request) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client DatabaseThreatDetectionPoliciesClient) GetResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databaseusages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseusages.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databaseusages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseusages.go index 3cbb944e1814a..cfca64ba5220c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/databaseusages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseusages.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,22 @@ type DatabaseUsagesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabaseUsagesClient creates an instance of the DatabaseUsagesClient client. func NewDatabaseUsagesClient(subscriptionID string) DatabaseUsagesClient { return NewDatabaseUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDatabaseUsagesClientWithBaseURI creates an instance of the DatabaseUsagesClient client. func NewDatabaseUsagesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseUsagesClient { return DatabaseUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase returns database usages. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DatabaseUsagesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseUsageListResult, err error) { req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -72,7 +69,6 @@ func (client DatabaseUsagesClient) ListByDatabase(ctx context.Context, resourceG return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client DatabaseUsagesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -95,7 +91,6 @@ func (client DatabaseUsagesClient) ListByDatabasePreparer(ctx context.Context, r return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client DatabaseUsagesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -103,7 +98,6 @@ func (client DatabaseUsagesClient) ListByDatabaseSender(req *http.Request) (*htt azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client DatabaseUsagesClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseUsageListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go index 82a0a70000694..886e172f45731 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,23 @@ type DataMaskingPoliciesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDataMaskingPoliciesClient creates an instance of the DataMaskingPoliciesClient client. func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { return NewDataMaskingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDataMaskingPoliciesClientWithBaseURI creates an instance of the DataMaskingPoliciesClient client. func NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { return DataMaskingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a database data masking policy -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. parameters is parameters for creating or updating a data masking policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// parameters - parameters for creating or updating a data masking policy. func (client DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (result DataMaskingPolicy, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -72,7 +70,6 @@ func (client DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, reso return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client DataMaskingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -98,7 +95,6 @@ func (client DataMaskingPoliciesClient) CreateOrUpdatePreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DataMaskingPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -106,7 +102,6 @@ func (client DataMaskingPoliciesClient) CreateOrUpdateSender(req *http.Request) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client DataMaskingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingPolicy, err error) { @@ -120,12 +115,12 @@ func (client DataMaskingPoliciesClient) CreateOrUpdateResponder(resp *http.Respo return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a database data masking policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingPolicy, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -148,7 +143,6 @@ func (client DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client DataMaskingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -172,7 +166,6 @@ func (client DataMaskingPoliciesClient) GetPreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client DataMaskingPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -180,7 +173,6 @@ func (client DataMaskingPoliciesClient) GetSender(req *http.Request) (*http.Resp azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client DataMaskingPoliciesClient) GetResponder(resp *http.Response) (result DataMaskingPolicy, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go index 0b8b90df40569..8655ec37bdafc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -33,25 +32,24 @@ type DataMaskingRulesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDataMaskingRulesClient creates an instance of the DataMaskingRulesClient client. func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { return NewDataMaskingRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewDataMaskingRulesClientWithBaseURI creates an instance of the DataMaskingRulesClient client. func NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { return DataMaskingRulesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a database data masking rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. dataMaskingRuleName is the name of the data masking rule. parameters is the required parameters -// for creating or updating a data masking rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// dataMaskingRuleName - the name of the data masking rule. +// parameters - the required parameters for creating or updating a data masking rule. func (client DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (result DataMaskingRule, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -84,7 +82,6 @@ func (client DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client DataMaskingRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -111,7 +108,6 @@ func (client DataMaskingRulesClient) CreateOrUpdatePreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DataMaskingRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -119,7 +115,6 @@ func (client DataMaskingRulesClient) CreateOrUpdateSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client DataMaskingRulesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingRule, err error) { @@ -133,12 +128,12 @@ func (client DataMaskingRulesClient) CreateOrUpdateResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase gets a list of database data masking rules. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client DataMaskingRulesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingRuleListResult, err error) { req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -161,7 +156,6 @@ func (client DataMaskingRulesClient) ListByDatabase(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client DataMaskingRulesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -185,7 +179,6 @@ func (client DataMaskingRulesClient) ListByDatabasePreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client DataMaskingRulesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -193,7 +186,6 @@ func (client DataMaskingRulesClient) ListByDatabaseSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client DataMaskingRulesClient) ListByDatabaseResponder(resp *http.Response) (result DataMaskingRuleListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go index 3b493028d779a..1ddcca4d4f4f7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,22 @@ type ElasticPoolActivitiesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewElasticPoolActivitiesClient creates an instance of the ElasticPoolActivitiesClient client. func NewElasticPoolActivitiesClient(subscriptionID string) ElasticPoolActivitiesClient { return NewElasticPoolActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewElasticPoolActivitiesClientWithBaseURI creates an instance of the ElasticPoolActivitiesClient client. func NewElasticPoolActivitiesClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolActivitiesClient { return ElasticPoolActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPool returns elastic pool activities. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool for which to get the current activity. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool for which to get the current activity. func (client ElasticPoolActivitiesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolActivityListResult, err error) { req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -72,7 +69,6 @@ func (client ElasticPoolActivitiesClient) ListByElasticPool(ctx context.Context, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolPreparer prepares the ListByElasticPool request. func (client ElasticPoolActivitiesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -95,7 +91,6 @@ func (client ElasticPoolActivitiesClient) ListByElasticPoolPreparer(ctx context. return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolSender sends the ListByElasticPool request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolActivitiesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { @@ -103,7 +98,6 @@ func (client ElasticPoolActivitiesClient) ListByElasticPoolSender(req *http.Requ azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always // closes the http.Response Body. func (client ElasticPoolActivitiesClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolActivityListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go index 1b1d28e0cfcda..4aa8be207f7a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolDatabaseActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web // services that interact with Azure SQL Database services to manage your databases. The API enables you to create, // retrieve, update, and delete databases. @@ -32,25 +31,23 @@ type ElasticPoolDatabaseActivitiesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewElasticPoolDatabaseActivitiesClient creates an instance of the ElasticPoolDatabaseActivitiesClient client. func NewElasticPoolDatabaseActivitiesClient(subscriptionID string) ElasticPoolDatabaseActivitiesClient { return NewElasticPoolDatabaseActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewElasticPoolDatabaseActivitiesClientWithBaseURI creates an instance of the ElasticPoolDatabaseActivitiesClient // client. func NewElasticPoolDatabaseActivitiesClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolDatabaseActivitiesClient { return ElasticPoolDatabaseActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPool returns activity on databases inside of an elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool. func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolDatabaseActivityListResult, err error) { req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -73,7 +70,6 @@ func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPool(ctx context. return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolPreparer prepares the ListByElasticPool request. func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -96,7 +92,6 @@ func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolPreparer(ctx return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolSender sends the ListByElasticPool request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { @@ -104,7 +99,6 @@ func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolSender(req *h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always // closes the http.Response Body. func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolDatabaseActivityListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpools.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpools.go similarity index 75% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpools.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpools.go index d4cb52a2e5263..c872c28ea70c4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/elasticpools.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpools.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,25 +31,23 @@ type ElasticPoolsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewElasticPoolsClient creates an instance of the ElasticPoolsClient client. func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { return NewElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewElasticPoolsClientWithBaseURI creates an instance of the ElasticPoolsClient client. func NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates a new elastic pool or updates an existing elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool to be operated on (updated or created). parameters is the required parameters for creating -// or updating an elastic pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool to be operated on (updated or created). +// parameters - the required parameters for creating or updating an elastic pool. func (client ElasticPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (result ElasticPoolsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) if err != nil { @@ -67,7 +64,6 @@ func (client ElasticPoolsClient) CreateOrUpdate(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ElasticPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -92,23 +88,23 @@ func (client ElasticPoolsClient) CreateOrUpdatePreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolsClient) CreateOrUpdateSender(req *http.Request) (future ElasticPoolsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result ElasticPool, err error) { @@ -122,12 +118,12 @@ func (client ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes the elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool to be deleted. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool to be deleted. func (client ElasticPoolsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -150,7 +146,6 @@ func (client ElasticPoolsClient) Delete(ctx context.Context, resourceGroupName s return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client ElasticPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -173,7 +168,6 @@ func (client ElasticPoolsClient) DeletePreparer(ctx context.Context, resourceGro return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolsClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -181,7 +175,6 @@ func (client ElasticPoolsClient) DeleteSender(req *http.Request) (*http.Response azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ElasticPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -194,12 +187,12 @@ func (client ElasticPoolsClient) DeleteResponder(resp *http.Response) (result au return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets an elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool to be retrieved. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool to be retrieved. func (client ElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -222,7 +215,6 @@ func (client ElasticPoolsClient) Get(ctx context.Context, resourceGroupName stri return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ElasticPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -245,7 +237,6 @@ func (client ElasticPoolsClient) GetPreparer(ctx context.Context, resourceGroupN return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -253,7 +244,6 @@ func (client ElasticPoolsClient) GetSender(req *http.Request) (*http.Response, e azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ElasticPoolsClient) GetResponder(resp *http.Response) (result ElasticPool, err error) { @@ -267,11 +257,11 @@ func (client ElasticPoolsClient) GetResponder(resp *http.Response) (result Elast return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer returns a list of elastic pools in a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ElasticPoolListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -294,7 +284,6 @@ func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client ElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -316,7 +305,6 @@ func (client ElasticPoolsClient) ListByServerPreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -324,7 +312,6 @@ func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (result ElasticPoolListResult, err error) { @@ -338,12 +325,12 @@ func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitions returns elastic pool metric definitions. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool. func (client ElasticPoolsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result MetricDefinitionListResult, err error) { req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -366,7 +353,6 @@ func (client ElasticPoolsClient) ListMetricDefinitions(ctx context.Context, reso return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. func (client ElasticPoolsClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -389,7 +375,6 @@ func (client ElasticPoolsClient) ListMetricDefinitionsPreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { @@ -397,7 +382,6 @@ func (client ElasticPoolsClient) ListMetricDefinitionsSender(req *http.Request) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always // closes the http.Response Body. func (client ElasticPoolsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { @@ -411,12 +395,13 @@ func (client ElasticPoolsClient) ListMetricDefinitionsResponder(resp *http.Respo return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetrics returns elastic pool metrics. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool. filter is an OData filter expression that describes a subset of metrics to return. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool. +// filter - an OData filter expression that describes a subset of metrics to return. func (client ElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result MetricListResult, err error) { req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, elasticPoolName, filter) if err != nil { @@ -439,7 +424,6 @@ func (client ElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricsPreparer prepares the ListMetrics request. func (client ElasticPoolsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -463,7 +447,6 @@ func (client ElasticPoolsClient) ListMetricsPreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricsSender sends the ListMetrics request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { @@ -471,7 +454,6 @@ func (client ElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMetricsResponder handles the response to the ListMetrics request. The method always // closes the http.Response Body. func (client ElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { @@ -485,12 +467,13 @@ func (client ElasticPoolsClient) ListMetricsResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Update updates an existing elastic pool. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. elasticPoolName is the name -// of the elastic pool to be updated. parameters is the required parameters for updating an elastic pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// elasticPoolName - the name of the elastic pool to be updated. +// parameters - the required parameters for updating an elastic pool. func (client ElasticPoolsClient) Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (result ElasticPoolsUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) if err != nil { @@ -507,7 +490,6 @@ func (client ElasticPoolsClient) Update(ctx context.Context, resourceGroupName s return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdatePreparer prepares the Update request. func (client ElasticPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -532,23 +514,23 @@ func (client ElasticPoolsClient) UpdatePreparer(ctx context.Context, resourceGro return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client ElasticPoolsClient) UpdateSender(req *http.Request) (future ElasticPoolsUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client ElasticPoolsClient) UpdateResponder(resp *http.Response) (result ElasticPool, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go index dd8349e7399ae..645c86c4c8e73 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EncryptionProtectorsClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,22 @@ type EncryptionProtectorsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewEncryptionProtectorsClient creates an instance of the EncryptionProtectorsClient client. func NewEncryptionProtectorsClient(subscriptionID string) EncryptionProtectorsClient { return NewEncryptionProtectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewEncryptionProtectorsClientWithBaseURI creates an instance of the EncryptionProtectorsClient client. func NewEncryptionProtectorsClientWithBaseURI(baseURI string, subscriptionID string) EncryptionProtectorsClient { return EncryptionProtectorsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate updates an existing encryption protector. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the requested -// encryption protector resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the requested encryption protector resource state. func (client EncryptionProtectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters EncryptionProtector) (result EncryptionProtectorsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { @@ -66,7 +63,6 @@ func (client EncryptionProtectorsClient) CreateOrUpdate(ctx context.Context, res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters EncryptionProtector) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -91,23 +87,23 @@ func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Cont return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client EncryptionProtectorsClient) CreateOrUpdateSender(req *http.Request) (future EncryptionProtectorsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client EncryptionProtectorsClient) CreateOrUpdateResponder(resp *http.Response) (result EncryptionProtector, err error) { @@ -121,11 +117,11 @@ func (client EncryptionProtectorsClient) CreateOrUpdateResponder(resp *http.Resp return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a server encryption protector. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client EncryptionProtectorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtector, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -148,7 +144,6 @@ func (client EncryptionProtectorsClient) Get(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client EncryptionProtectorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -171,7 +166,6 @@ func (client EncryptionProtectorsClient) GetPreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client EncryptionProtectorsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -179,7 +173,6 @@ func (client EncryptionProtectorsClient) GetSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client EncryptionProtectorsClient) GetResponder(resp *http.Response) (result EncryptionProtector, err error) { @@ -193,11 +186,11 @@ func (client EncryptionProtectorsClient) GetResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer gets a list of server encryption protectors -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client EncryptionProtectorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorListResultPage, err error) { result.fn = client.listByServerNextResults req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) @@ -221,7 +214,6 @@ func (client EncryptionProtectorsClient) ListByServer(ctx context.Context, resou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client EncryptionProtectorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -243,7 +235,6 @@ func (client EncryptionProtectorsClient) ListByServerPreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client EncryptionProtectorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -251,7 +242,6 @@ func (client EncryptionProtectorsClient) ListByServerSender(req *http.Request) ( azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client EncryptionProtectorsClient) ListByServerResponder(resp *http.Response) (result EncryptionProtectorListResult, err error) { @@ -286,7 +276,6 @@ func (client EncryptionProtectorsClient) listByServerNextResults(lastResults Enc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerComplete enumerates all values, automatically crossing page boundaries as required. func (client EncryptionProtectorsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorListResultIterator, err error) { result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/failovergroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/failovergroups.go similarity index 74% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/failovergroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/failovergroups.go index 0768049eb37d1..114ab721211a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/failovergroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/failovergroups.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -33,24 +32,23 @@ type FailoverGroupsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewFailoverGroupsClient creates an instance of the FailoverGroupsClient client. func NewFailoverGroupsClient(subscriptionID string) FailoverGroupsClient { return NewFailoverGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewFailoverGroupsClientWithBaseURI creates an instance of the FailoverGroupsClient client. func NewFailoverGroupsClientWithBaseURI(baseURI string, subscriptionID string) FailoverGroupsClient { return FailoverGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a failover group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover -// group. failoverGroupName is the name of the failover group. parameters is the failover group parameters. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server containing the failover group. +// failoverGroupName - the name of the failover group. +// parameters - the failover group parameters. func (client FailoverGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (result FailoverGroupsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -76,7 +74,6 @@ func (client FailoverGroupsClient) CreateOrUpdate(ctx context.Context, resourceG return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client FailoverGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -101,23 +98,23 @@ func (client FailoverGroupsClient) CreateOrUpdatePreparer(ctx context.Context, r return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client FailoverGroupsClient) CreateOrUpdateSender(req *http.Request) (future FailoverGroupsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client FailoverGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result FailoverGroup, err error) { @@ -131,12 +128,12 @@ func (client FailoverGroupsClient) CreateOrUpdateResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a failover group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover -// group. failoverGroupName is the name of the failover group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server containing the failover group. +// failoverGroupName - the name of the failover group. func (client FailoverGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, failoverGroupName) if err != nil { @@ -153,7 +150,6 @@ func (client FailoverGroupsClient) Delete(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client FailoverGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -176,23 +172,23 @@ func (client FailoverGroupsClient) DeletePreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client FailoverGroupsClient) DeleteSender(req *http.Request) (future FailoverGroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client FailoverGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -205,12 +201,12 @@ func (client FailoverGroupsClient) DeleteResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Failover fails over from the current primary server to this server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover -// group. failoverGroupName is the name of the failover group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server containing the failover group. +// failoverGroupName - the name of the failover group. func (client FailoverGroupsClient) Failover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsFailoverFuture, err error) { req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, failoverGroupName) if err != nil { @@ -227,7 +223,6 @@ func (client FailoverGroupsClient) Failover(ctx context.Context, resourceGroupNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverPreparer prepares the Failover request. func (client FailoverGroupsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -250,23 +245,23 @@ func (client FailoverGroupsClient) FailoverPreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverSender sends the Failover request. The method will close the // http.Response Body if it receives an error. func (client FailoverGroupsClient) FailoverSender(req *http.Request) (future FailoverGroupsFailoverFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverResponder handles the response to the Failover request. The method always // closes the http.Response Body. func (client FailoverGroupsClient) FailoverResponder(resp *http.Response) (result FailoverGroup, err error) { @@ -280,13 +275,13 @@ func (client FailoverGroupsClient) FailoverResponder(resp *http.Response) (resul return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ForceFailoverAllowDataLoss fails over from the current primary server to this server. This operation might result in // data loss. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover -// group. failoverGroupName is the name of the failover group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server containing the failover group. +// failoverGroupName - the name of the failover group. func (client FailoverGroupsClient) ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsForceFailoverAllowDataLossFuture, err error) { req, err := client.ForceFailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, failoverGroupName) if err != nil { @@ -303,7 +298,6 @@ func (client FailoverGroupsClient) ForceFailoverAllowDataLoss(ctx context.Contex return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ForceFailoverAllowDataLossPreparer prepares the ForceFailoverAllowDataLoss request. func (client FailoverGroupsClient) ForceFailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -326,23 +320,23 @@ func (client FailoverGroupsClient) ForceFailoverAllowDataLossPreparer(ctx contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ForceFailoverAllowDataLossSender sends the ForceFailoverAllowDataLoss request. The method will close the // http.Response Body if it receives an error. func (client FailoverGroupsClient) ForceFailoverAllowDataLossSender(req *http.Request) (future FailoverGroupsForceFailoverAllowDataLossFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ForceFailoverAllowDataLossResponder handles the response to the ForceFailoverAllowDataLoss request. The method always // closes the http.Response Body. func (client FailoverGroupsClient) ForceFailoverAllowDataLossResponder(resp *http.Response) (result FailoverGroup, err error) { @@ -356,12 +350,12 @@ func (client FailoverGroupsClient) ForceFailoverAllowDataLossResponder(resp *htt return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a failover group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover -// group. failoverGroupName is the name of the failover group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server containing the failover group. +// failoverGroupName - the name of the failover group. func (client FailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroup, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, failoverGroupName) if err != nil { @@ -384,7 +378,6 @@ func (client FailoverGroupsClient) Get(ctx context.Context, resourceGroupName st return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client FailoverGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -407,7 +400,6 @@ func (client FailoverGroupsClient) GetPreparer(ctx context.Context, resourceGrou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client FailoverGroupsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -415,7 +407,6 @@ func (client FailoverGroupsClient) GetSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client FailoverGroupsClient) GetResponder(resp *http.Response) (result FailoverGroup, err error) { @@ -429,12 +420,11 @@ func (client FailoverGroupsClient) GetResponder(resp *http.Response) (result Fai return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer lists the failover groups in a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover -// group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server containing the failover group. func (client FailoverGroupsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultPage, err error) { result.fn = client.listByServerNextResults req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) @@ -458,7 +448,6 @@ func (client FailoverGroupsClient) ListByServer(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client FailoverGroupsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -480,7 +469,6 @@ func (client FailoverGroupsClient) ListByServerPreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client FailoverGroupsClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -488,7 +476,6 @@ func (client FailoverGroupsClient) ListByServerSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client FailoverGroupsClient) ListByServerResponder(resp *http.Response) (result FailoverGroupListResult, err error) { @@ -523,19 +510,19 @@ func (client FailoverGroupsClient) listByServerNextResults(lastResults FailoverG return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerComplete enumerates all values, automatically crossing page boundaries as required. func (client FailoverGroupsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultIterator, err error) { result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Update updates a failover group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server containing the failover -// group. failoverGroupName is the name of the failover group. parameters is the failover group parameters. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server containing the failover group. +// failoverGroupName - the name of the failover group. +// parameters - the failover group parameters. func (client FailoverGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (result FailoverGroupsUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, failoverGroupName, parameters) if err != nil { @@ -552,7 +539,6 @@ func (client FailoverGroupsClient) Update(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdatePreparer prepares the Update request. func (client FailoverGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -577,23 +563,23 @@ func (client FailoverGroupsClient) UpdatePreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client FailoverGroupsClient) UpdateSender(req *http.Request) (future FailoverGroupsUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client FailoverGroupsClient) UpdateResponder(resp *http.Response) (result FailoverGroup, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/firewallrules.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/firewallrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/firewallrules.go index 6ddb67e969e06..1f1b7f8a49f45 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/firewallrules.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FirewallRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -33,24 +32,23 @@ type FirewallRulesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewFirewallRulesClient creates an instance of the FirewallRulesClient client. func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient client. func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the firewall rule. parameters is the required parameters for creating or updating a firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the firewall rule. +// parameters - the required parameters for creating or updating a firewall rule. func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -82,7 +80,6 @@ func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGr return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -107,7 +104,6 @@ func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, re return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -115,7 +111,6 @@ func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -129,12 +124,12 @@ func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) ( return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the firewall rule. func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) if err != nil { @@ -157,7 +152,6 @@ func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -180,7 +174,6 @@ func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGr return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -188,7 +181,6 @@ func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Respons azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -201,12 +193,12 @@ func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result a return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a firewall rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. firewallRuleName is the name -// of the firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the firewall rule. func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) if err != nil { @@ -229,7 +221,6 @@ func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -252,7 +243,6 @@ func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -260,7 +250,6 @@ func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -274,11 +263,11 @@ func (client FirewallRulesClient) GetResponder(resp *http.Response) (result Fire return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer returns a list of firewall rules. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -301,7 +290,6 @@ func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGrou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -323,7 +311,6 @@ func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -331,7 +318,6 @@ func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.R azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go index 83e4f2688266b..3e4c95df43e25 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GeoBackupPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -33,24 +32,23 @@ type GeoBackupPoliciesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewGeoBackupPoliciesClient creates an instance of the GeoBackupPoliciesClient client. func NewGeoBackupPoliciesClient(subscriptionID string) GeoBackupPoliciesClient { return NewGeoBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewGeoBackupPoliciesClientWithBaseURI creates an instance of the GeoBackupPoliciesClient client. func NewGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) GeoBackupPoliciesClient { return GeoBackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate updates a database geo backup policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. parameters is the required parameters for creating or updating the geo backup policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// parameters - the required parameters for creating or updating the geo backup policy. func (client GeoBackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (result GeoBackupPolicy, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -79,7 +77,6 @@ func (client GeoBackupPoliciesClient) CreateOrUpdate(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client GeoBackupPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -105,7 +102,6 @@ func (client GeoBackupPoliciesClient) CreateOrUpdatePreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client GeoBackupPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -113,7 +109,6 @@ func (client GeoBackupPoliciesClient) CreateOrUpdateSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client GeoBackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result GeoBackupPolicy, err error) { @@ -127,12 +122,12 @@ func (client GeoBackupPoliciesClient) CreateOrUpdateResponder(resp *http.Respons return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a geo backup policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client GeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicy, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -155,7 +150,6 @@ func (client GeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client GeoBackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -179,7 +173,6 @@ func (client GeoBackupPoliciesClient) GetPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client GeoBackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -187,7 +180,6 @@ func (client GeoBackupPoliciesClient) GetSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client GeoBackupPoliciesClient) GetResponder(resp *http.Response) (result GeoBackupPolicy, err error) { @@ -201,12 +193,12 @@ func (client GeoBackupPoliciesClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase returns a list of geo backup policies. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. func (client GeoBackupPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicyListResult, err error) { req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -229,7 +221,6 @@ func (client GeoBackupPoliciesClient) ListByDatabase(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client GeoBackupPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -252,7 +243,6 @@ func (client GeoBackupPoliciesClient) ListByDatabasePreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client GeoBackupPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -260,7 +250,6 @@ func (client GeoBackupPoliciesClient) ListByDatabaseSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client GeoBackupPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result GeoBackupPolicyListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go new file mode 100644 index 0000000000000..64efddd7e24c7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go @@ -0,0 +1,523 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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" + "net/http" +) + +// ManagedInstancesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type ManagedInstancesClient struct { + BaseClient +} + +// NewManagedInstancesClient creates an instance of the ManagedInstancesClient client. +func NewManagedInstancesClient(subscriptionID string) ManagedInstancesClient { + return NewManagedInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedInstancesClientWithBaseURI creates an instance of the ManagedInstancesClient client. +func NewManagedInstancesClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstancesClient { + return ManagedInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a managed instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// parameters - the requested managed instance resource state. +func (client ManagedInstancesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstance) (result ManagedInstancesCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("sql.ManagedInstancesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedInstancesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstance) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstancesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstance, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a managed instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstancesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstancesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedInstancesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) DeleteSender(req *http.Request) (future ManagedInstancesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a managed instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstancesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstance, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedInstancesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) GetResponder(resp *http.Response) (result ManagedInstance, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all managed instances in the subscription. +func (client ManagedInstancesClient) List(ctx context.Context) (result ManagedInstanceListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.milr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", resp, "Failure sending request") + return + } + + result.milr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedInstancesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances", 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 ManagedInstancesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) ListResponder(resp *http.Response) (result ManagedInstanceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ManagedInstancesClient) listNextResults(lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { + req, err := lastResults.managedInstanceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "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, "sql.ManagedInstancesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstancesClient) ListComplete(ctx context.Context) (result ManagedInstanceListResultIterator, err error) { + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets a list of managed instances in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +func (client ManagedInstancesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedInstanceListResultPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.milr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.milr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagedInstancesClient) 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 = "2015-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.Sql/managedInstances", 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 ManagedInstancesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedInstanceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ManagedInstancesClient) listByResourceGroupNextResults(lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { + req, err := lastResults.managedInstanceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "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, "sql.ManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstancesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedInstanceListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update updates a managed instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// parameters - the requested managed instance resource state. +func (client ManagedInstancesClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate) (result ManagedInstancesUpdateFuture, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ManagedInstancesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) UpdateSender(req *http.Request) (future ManagedInstancesUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) UpdateResponder(resp *http.Response) (result ManagedInstance, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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/sql/mgmt/2015-05-01-preview/sql/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go similarity index 71% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go index 595240bbddeaa..a0ab829d48876 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go @@ -27,7 +27,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // AuthenticationType enumerates the values for authentication type. type AuthenticationType string @@ -38,13 +37,11 @@ const ( SQL AuthenticationType = "SQL" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. func PossibleAuthenticationTypeValues() []AuthenticationType { return []AuthenticationType{ADPassword, SQL} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionPolicyState enumerates the values for backup long term retention policy state. type BackupLongTermRetentionPolicyState string @@ -55,13 +52,11 @@ const ( Enabled BackupLongTermRetentionPolicyState = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleBackupLongTermRetentionPolicyStateValues returns an array of possible values for the BackupLongTermRetentionPolicyState const type. func PossibleBackupLongTermRetentionPolicyStateValues() []BackupLongTermRetentionPolicyState { return []BackupLongTermRetentionPolicyState{Disabled, Enabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BlobAuditingPolicyState enumerates the values for blob auditing policy state. type BlobAuditingPolicyState string @@ -72,13 +67,11 @@ const ( BlobAuditingPolicyStateEnabled BlobAuditingPolicyState = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleBlobAuditingPolicyStateValues returns an array of possible values for the BlobAuditingPolicyState const type. func PossibleBlobAuditingPolicyStateValues() []BlobAuditingPolicyState { return []BlobAuditingPolicyState{BlobAuditingPolicyStateDisabled, BlobAuditingPolicyStateEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CapabilityStatus enumerates the values for capability status. type CapabilityStatus string @@ -93,13 +86,11 @@ const ( CapabilityStatusVisible CapabilityStatus = "Visible" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleCapabilityStatusValues returns an array of possible values for the CapabilityStatus const type. func PossibleCapabilityStatusValues() []CapabilityStatus { return []CapabilityStatus{CapabilityStatusAvailable, CapabilityStatusDefault, CapabilityStatusDisabled, CapabilityStatusVisible} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CheckNameAvailabilityReason enumerates the values for check name availability reason. type CheckNameAvailabilityReason string @@ -110,13 +101,11 @@ const ( Invalid CheckNameAvailabilityReason = "Invalid" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleCheckNameAvailabilityReasonValues returns an array of possible values for the CheckNameAvailabilityReason const type. func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { return []CheckNameAvailabilityReason{AlreadyExists, Invalid} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateMode enumerates the values for create mode. type CreateMode string @@ -139,13 +128,11 @@ const ( RestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleCreateModeValues returns an array of possible values for the CreateMode const type. func PossibleCreateModeValues() []CreateMode { return []CreateMode{Copy, Default, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, Restore, RestoreLongTermRetentionBackup} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseEdition enumerates the values for database edition. type DatabaseEdition string @@ -174,13 +161,11 @@ const ( Web DatabaseEdition = "Web" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleDatabaseEditionValues returns an array of possible values for the DatabaseEdition const type. func PossibleDatabaseEditionValues() []DatabaseEdition { return []DatabaseEdition{Basic, Business, DataWarehouse, Free, Premium, PremiumRS, Standard, Stretch, System, System2, Web} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingFunction enumerates the values for data masking function. type DataMaskingFunction string @@ -199,13 +184,11 @@ const ( DataMaskingFunctionText DataMaskingFunction = "Text" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleDataMaskingFunctionValues returns an array of possible values for the DataMaskingFunction const type. func PossibleDataMaskingFunctionValues() []DataMaskingFunction { return []DataMaskingFunction{DataMaskingFunctionCCN, DataMaskingFunctionDefault, DataMaskingFunctionEmail, DataMaskingFunctionNumber, DataMaskingFunctionSSN, DataMaskingFunctionText} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingRuleState enumerates the values for data masking rule state. type DataMaskingRuleState string @@ -216,13 +199,11 @@ const ( DataMaskingRuleStateEnabled DataMaskingRuleState = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleDataMaskingRuleStateValues returns an array of possible values for the DataMaskingRuleState const type. func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { return []DataMaskingRuleState{DataMaskingRuleStateDisabled, DataMaskingRuleStateEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingState enumerates the values for data masking state. type DataMaskingState string @@ -233,13 +214,11 @@ const ( DataMaskingStateEnabled DataMaskingState = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleDataMaskingStateValues returns an array of possible values for the DataMaskingState const type. func PossibleDataMaskingStateValues() []DataMaskingState { return []DataMaskingState{DataMaskingStateDisabled, DataMaskingStateEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolEdition enumerates the values for elastic pool edition. type ElasticPoolEdition string @@ -252,13 +231,11 @@ const ( ElasticPoolEditionStandard ElasticPoolEdition = "Standard" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleElasticPoolEditionValues returns an array of possible values for the ElasticPoolEdition const type. func PossibleElasticPoolEditionValues() []ElasticPoolEdition { return []ElasticPoolEdition{ElasticPoolEditionBasic, ElasticPoolEditionPremium, ElasticPoolEditionStandard} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolState enumerates the values for elastic pool state. type ElasticPoolState string @@ -271,13 +248,11 @@ const ( ElasticPoolStateReady ElasticPoolState = "Ready" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleElasticPoolStateValues returns an array of possible values for the ElasticPoolState const type. func PossibleElasticPoolStateValues() []ElasticPoolState { return []ElasticPoolState{ElasticPoolStateCreating, ElasticPoolStateDisabled, ElasticPoolStateReady} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupReplicationRole enumerates the values for failover group replication role. type FailoverGroupReplicationRole string @@ -288,13 +263,11 @@ const ( Secondary FailoverGroupReplicationRole = "Secondary" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleFailoverGroupReplicationRoleValues returns an array of possible values for the FailoverGroupReplicationRole const type. func PossibleFailoverGroupReplicationRoleValues() []FailoverGroupReplicationRole { return []FailoverGroupReplicationRole{Primary, Secondary} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GeoBackupPolicyState enumerates the values for geo backup policy state. type GeoBackupPolicyState string @@ -305,13 +278,11 @@ const ( GeoBackupPolicyStateEnabled GeoBackupPolicyState = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleGeoBackupPolicyStateValues returns an array of possible values for the GeoBackupPolicyState const type. func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { return []GeoBackupPolicyState{GeoBackupPolicyStateDisabled, GeoBackupPolicyStateEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IdentityType enumerates the values for identity type. type IdentityType string @@ -320,13 +291,11 @@ const ( SystemAssigned IdentityType = "SystemAssigned" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. func PossibleIdentityTypeValues() []IdentityType { return []IdentityType{SystemAssigned} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MaxSizeUnits enumerates the values for max size units. type MaxSizeUnits string @@ -341,13 +310,11 @@ const ( Terabytes MaxSizeUnits = "Terabytes" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleMaxSizeUnitsValues returns an array of possible values for the MaxSizeUnits const type. func PossibleMaxSizeUnitsValues() []MaxSizeUnits { return []MaxSizeUnits{Gigabytes, Megabytes, Petabytes, Terabytes} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // OperationOrigin enumerates the values for operation origin. type OperationOrigin string @@ -358,13 +325,11 @@ const ( OperationOriginUser OperationOrigin = "user" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. func PossibleOperationOriginValues() []OperationOrigin { return []OperationOrigin{OperationOriginSystem, OperationOriginUser} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PerformanceLevelUnit enumerates the values for performance level unit. type PerformanceLevelUnit string @@ -373,13 +338,11 @@ const ( DTU PerformanceLevelUnit = "DTU" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossiblePerformanceLevelUnitValues returns an array of possible values for the PerformanceLevelUnit const type. func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { return []PerformanceLevelUnit{DTU} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PrimaryAggregationType enumerates the values for primary aggregation type. type PrimaryAggregationType string @@ -398,13 +361,11 @@ const ( Total PrimaryAggregationType = "Total" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { return []PrimaryAggregationType{Average, Count, Maximum, Minimum, None, Total} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReadOnlyEndpointFailoverPolicy enumerates the values for read only endpoint failover policy. type ReadOnlyEndpointFailoverPolicy string @@ -415,13 +376,11 @@ const ( ReadOnlyEndpointFailoverPolicyEnabled ReadOnlyEndpointFailoverPolicy = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleReadOnlyEndpointFailoverPolicyValues returns an array of possible values for the ReadOnlyEndpointFailoverPolicy const type. func PossibleReadOnlyEndpointFailoverPolicyValues() []ReadOnlyEndpointFailoverPolicy { return []ReadOnlyEndpointFailoverPolicy{ReadOnlyEndpointFailoverPolicyDisabled, ReadOnlyEndpointFailoverPolicyEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReadScale enumerates the values for read scale. type ReadScale string @@ -432,13 +391,11 @@ const ( ReadScaleEnabled ReadScale = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleReadScaleValues returns an array of possible values for the ReadScale const type. func PossibleReadScaleValues() []ReadScale { return []ReadScale{ReadScaleDisabled, ReadScaleEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReadWriteEndpointFailoverPolicy enumerates the values for read write endpoint failover policy. type ReadWriteEndpointFailoverPolicy string @@ -449,13 +406,11 @@ const ( Manual ReadWriteEndpointFailoverPolicy = "Manual" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleReadWriteEndpointFailoverPolicyValues returns an array of possible values for the ReadWriteEndpointFailoverPolicy const type. func PossibleReadWriteEndpointFailoverPolicyValues() []ReadWriteEndpointFailoverPolicy { return []ReadWriteEndpointFailoverPolicy{Automatic, Manual} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecommendedIndexAction enumerates the values for recommended index action. type RecommendedIndexAction string @@ -468,13 +423,11 @@ const ( Rebuild RecommendedIndexAction = "Rebuild" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleRecommendedIndexActionValues returns an array of possible values for the RecommendedIndexAction const type. func PossibleRecommendedIndexActionValues() []RecommendedIndexAction { return []RecommendedIndexAction{Create, Drop, Rebuild} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecommendedIndexState enumerates the values for recommended index state. type RecommendedIndexState string @@ -503,13 +456,11 @@ const ( Verifying RecommendedIndexState = "Verifying" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleRecommendedIndexStateValues returns an array of possible values for the RecommendedIndexState const type. func PossibleRecommendedIndexStateValues() []RecommendedIndexState { return []RecommendedIndexState{Active, Blocked, Executing, Expired, Ignored, Pending, PendingRevert, Reverted, Reverting, Success, Verifying} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecommendedIndexType enumerates the values for recommended index type. type RecommendedIndexType string @@ -524,13 +475,11 @@ const ( NONCLUSTERED RecommendedIndexType = "NONCLUSTERED" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleRecommendedIndexTypeValues returns an array of possible values for the RecommendedIndexType const type. func PossibleRecommendedIndexTypeValues() []RecommendedIndexType { return []RecommendedIndexType{CLUSTERED, CLUSTEREDCOLUMNSTORE, COLUMNSTORE, NONCLUSTERED} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationRole enumerates the values for replication role. type ReplicationRole string @@ -547,13 +496,11 @@ const ( ReplicationRoleSource ReplicationRole = "Source" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleReplicationRoleValues returns an array of possible values for the ReplicationRole const type. func PossibleReplicationRoleValues() []ReplicationRole { return []ReplicationRole{ReplicationRoleCopy, ReplicationRoleNonReadableSecondary, ReplicationRolePrimary, ReplicationRoleSecondary, ReplicationRoleSource} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationState enumerates the values for replication state. type ReplicationState string @@ -568,13 +515,11 @@ const ( SUSPENDED ReplicationState = "SUSPENDED" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleReplicationStateValues returns an array of possible values for the ReplicationState const type. func PossibleReplicationStateValues() []ReplicationState { return []ReplicationState{CATCHUP, PENDING, SEEDING, SUSPENDED} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorePointType enumerates the values for restore point type. type RestorePointType string @@ -585,13 +530,11 @@ const ( DISCRETE RestorePointType = "DISCRETE" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleRestorePointTypeValues returns an array of possible values for the RestorePointType const type. func PossibleRestorePointTypeValues() []RestorePointType { return []RestorePointType{CONTINUOUS, DISCRETE} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SampleName enumerates the values for sample name. type SampleName string @@ -600,13 +543,11 @@ const ( AdventureWorksLT SampleName = "AdventureWorksLT" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSampleNameValues returns an array of possible values for the SampleName const type. func PossibleSampleNameValues() []SampleName { return []SampleName{AdventureWorksLT} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SecurityAlertPolicyEmailAccountAdmins enumerates the values for security alert policy email account admins. type SecurityAlertPolicyEmailAccountAdmins string @@ -617,13 +558,11 @@ const ( SecurityAlertPolicyEmailAccountAdminsEnabled SecurityAlertPolicyEmailAccountAdmins = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSecurityAlertPolicyEmailAccountAdminsValues returns an array of possible values for the SecurityAlertPolicyEmailAccountAdmins const type. func PossibleSecurityAlertPolicyEmailAccountAdminsValues() []SecurityAlertPolicyEmailAccountAdmins { return []SecurityAlertPolicyEmailAccountAdmins{SecurityAlertPolicyEmailAccountAdminsDisabled, SecurityAlertPolicyEmailAccountAdminsEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SecurityAlertPolicyState enumerates the values for security alert policy state. type SecurityAlertPolicyState string @@ -636,13 +575,11 @@ const ( SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSecurityAlertPolicyStateValues returns an array of possible values for the SecurityAlertPolicyState const type. func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { return []SecurityAlertPolicyState{SecurityAlertPolicyStateDisabled, SecurityAlertPolicyStateEnabled, SecurityAlertPolicyStateNew} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SecurityAlertPolicyUseServerDefault enumerates the values for security alert policy use server default. type SecurityAlertPolicyUseServerDefault string @@ -653,13 +590,11 @@ const ( SecurityAlertPolicyUseServerDefaultEnabled SecurityAlertPolicyUseServerDefault = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSecurityAlertPolicyUseServerDefaultValues returns an array of possible values for the SecurityAlertPolicyUseServerDefault const type. func PossibleSecurityAlertPolicyUseServerDefaultValues() []SecurityAlertPolicyUseServerDefault { return []SecurityAlertPolicyUseServerDefault{SecurityAlertPolicyUseServerDefaultDisabled, SecurityAlertPolicyUseServerDefaultEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerConnectionType enumerates the values for server connection type. type ServerConnectionType string @@ -672,13 +607,11 @@ const ( ServerConnectionTypeRedirect ServerConnectionType = "Redirect" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleServerConnectionTypeValues returns an array of possible values for the ServerConnectionType const type. func PossibleServerConnectionTypeValues() []ServerConnectionType { return []ServerConnectionType{ServerConnectionTypeDefault, ServerConnectionTypeProxy, ServerConnectionTypeRedirect} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeyType enumerates the values for server key type. type ServerKeyType string @@ -689,13 +622,11 @@ const ( ServiceManaged ServerKeyType = "ServiceManaged" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleServerKeyTypeValues returns an array of possible values for the ServerKeyType const type. func PossibleServerKeyTypeValues() []ServerKeyType { return []ServerKeyType{AzureKeyVault, ServiceManaged} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceObjectiveName enumerates the values for service objective name. type ServiceObjectiveName string @@ -832,13 +763,11 @@ const ( ServiceObjectiveNameSystem4L ServiceObjectiveName = "System4L" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleServiceObjectiveNameValues returns an array of possible values for the ServiceObjectiveName const type. func PossibleServiceObjectiveNameValues() []ServiceObjectiveName { return []ServiceObjectiveName{ServiceObjectiveNameBasic, ServiceObjectiveNameDS100, ServiceObjectiveNameDS1000, ServiceObjectiveNameDS1200, ServiceObjectiveNameDS1500, ServiceObjectiveNameDS200, ServiceObjectiveNameDS2000, ServiceObjectiveNameDS300, ServiceObjectiveNameDS400, ServiceObjectiveNameDS500, ServiceObjectiveNameDS600, ServiceObjectiveNameDW100, ServiceObjectiveNameDW1000, ServiceObjectiveNameDW10000c, ServiceObjectiveNameDW1000c, ServiceObjectiveNameDW1200, ServiceObjectiveNameDW1500, ServiceObjectiveNameDW15000c, ServiceObjectiveNameDW1500c, ServiceObjectiveNameDW200, ServiceObjectiveNameDW2000, ServiceObjectiveNameDW2000c, ServiceObjectiveNameDW2500c, ServiceObjectiveNameDW300, ServiceObjectiveNameDW3000, ServiceObjectiveNameDW30000c, ServiceObjectiveNameDW3000c, ServiceObjectiveNameDW400, ServiceObjectiveNameDW500, ServiceObjectiveNameDW5000c, ServiceObjectiveNameDW600, ServiceObjectiveNameDW6000, ServiceObjectiveNameDW6000c, ServiceObjectiveNameDW7500c, ServiceObjectiveNameElasticPool, ServiceObjectiveNameFree, ServiceObjectiveNameP1, ServiceObjectiveNameP11, ServiceObjectiveNameP15, ServiceObjectiveNameP2, ServiceObjectiveNameP3, ServiceObjectiveNameP4, ServiceObjectiveNameP6, ServiceObjectiveNamePRS1, ServiceObjectiveNamePRS2, ServiceObjectiveNamePRS4, ServiceObjectiveNamePRS6, ServiceObjectiveNameS0, ServiceObjectiveNameS1, ServiceObjectiveNameS12, ServiceObjectiveNameS2, ServiceObjectiveNameS3, ServiceObjectiveNameS4, ServiceObjectiveNameS6, ServiceObjectiveNameS7, ServiceObjectiveNameS9, ServiceObjectiveNameSystem, ServiceObjectiveNameSystem0, ServiceObjectiveNameSystem1, ServiceObjectiveNameSystem2, ServiceObjectiveNameSystem2L, ServiceObjectiveNameSystem3, ServiceObjectiveNameSystem3L, ServiceObjectiveNameSystem4, ServiceObjectiveNameSystem4L} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // StorageKeyType enumerates the values for storage key type. type StorageKeyType string @@ -849,13 +778,11 @@ const ( StorageAccessKey StorageKeyType = "StorageAccessKey" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleStorageKeyTypeValues returns an array of possible values for the StorageKeyType const type. func PossibleStorageKeyTypeValues() []StorageKeyType { return []StorageKeyType{SharedAccessKey, StorageAccessKey} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentState enumerates the values for sync agent state. type SyncAgentState string @@ -868,13 +795,11 @@ const ( Online SyncAgentState = "Online" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSyncAgentStateValues returns an array of possible values for the SyncAgentState const type. func PossibleSyncAgentStateValues() []SyncAgentState { return []SyncAgentState{NeverConnected, Offline, Online} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncConflictResolutionPolicy enumerates the values for sync conflict resolution policy. type SyncConflictResolutionPolicy string @@ -885,13 +810,11 @@ const ( MemberWin SyncConflictResolutionPolicy = "MemberWin" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSyncConflictResolutionPolicyValues returns an array of possible values for the SyncConflictResolutionPolicy const type. func PossibleSyncConflictResolutionPolicyValues() []SyncConflictResolutionPolicy { return []SyncConflictResolutionPolicy{HubWin, MemberWin} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncDirection enumerates the values for sync direction. type SyncDirection string @@ -904,13 +827,11 @@ const ( OneWayMemberToHub SyncDirection = "OneWayMemberToHub" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSyncDirectionValues returns an array of possible values for the SyncDirection const type. func PossibleSyncDirectionValues() []SyncDirection { return []SyncDirection{Bidirectional, OneWayHubToMember, OneWayMemberToHub} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupLogType enumerates the values for sync group log type. type SyncGroupLogType string @@ -925,13 +846,11 @@ const ( SyncGroupLogTypeWarning SyncGroupLogType = "Warning" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSyncGroupLogTypeValues returns an array of possible values for the SyncGroupLogType const type. func PossibleSyncGroupLogTypeValues() []SyncGroupLogType { return []SyncGroupLogType{SyncGroupLogTypeAll, SyncGroupLogTypeError, SyncGroupLogTypeSuccess, SyncGroupLogTypeWarning} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupState enumerates the values for sync group state. type SyncGroupState string @@ -948,13 +867,11 @@ const ( Warning SyncGroupState = "Warning" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSyncGroupStateValues returns an array of possible values for the SyncGroupState const type. func PossibleSyncGroupStateValues() []SyncGroupState { return []SyncGroupState{Error, Good, NotReady, Progressing, Warning} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMemberDbType enumerates the values for sync member db type. type SyncMemberDbType string @@ -965,13 +882,11 @@ const ( SQLServerDatabase SyncMemberDbType = "SqlServerDatabase" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSyncMemberDbTypeValues returns an array of possible values for the SyncMemberDbType const type. func PossibleSyncMemberDbTypeValues() []SyncMemberDbType { return []SyncMemberDbType{AzureSQLDatabase, SQLServerDatabase} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMemberState enumerates the values for sync member state. type SyncMemberState string @@ -1014,13 +929,11 @@ const ( UnReprovisioned SyncMemberState = "UnReprovisioned" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleSyncMemberStateValues returns an array of possible values for the SyncMemberState const type. func PossibleSyncMemberStateValues() []SyncMemberState { return []SyncMemberState{DeProvisioned, DeProvisionFailed, DeProvisioning, DisabledBackupRestore, DisabledTombstoneCleanup, Provisioned, ProvisionFailed, Provisioning, ReprovisionFailed, Reprovisioning, SyncCancelled, SyncCancelling, SyncFailed, SyncInProgress, SyncSucceeded, SyncSucceededWithWarnings, UnProvisioned, UnReprovisioned} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionActivityStatus enumerates the values for transparent data encryption activity // status. type TransparentDataEncryptionActivityStatus string @@ -1032,13 +945,11 @@ const ( Encrypting TransparentDataEncryptionActivityStatus = "Encrypting" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleTransparentDataEncryptionActivityStatusValues returns an array of possible values for the TransparentDataEncryptionActivityStatus const type. func PossibleTransparentDataEncryptionActivityStatusValues() []TransparentDataEncryptionActivityStatus { return []TransparentDataEncryptionActivityStatus{Decrypting, Encrypting} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionStatus enumerates the values for transparent data encryption status. type TransparentDataEncryptionStatus string @@ -1049,13 +960,11 @@ const ( TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleTransparentDataEncryptionStatusValues returns an array of possible values for the TransparentDataEncryptionStatus const type. func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { return []TransparentDataEncryptionStatus{TransparentDataEncryptionStatusDisabled, TransparentDataEncryptionStatusEnabled} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnitDefinitionType enumerates the values for unit definition type. type UnitDefinitionType string @@ -1074,13 +983,11 @@ const ( UnitDefinitionTypeSeconds UnitDefinitionType = "Seconds" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleUnitDefinitionTypeValues returns an array of possible values for the UnitDefinitionType const type. func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { return []UnitDefinitionType{UnitDefinitionTypeBytes, UnitDefinitionTypeBytesPerSecond, UnitDefinitionTypeCount, UnitDefinitionTypeCountPerSecond, UnitDefinitionTypePercent, UnitDefinitionTypeSeconds} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnitType enumerates the values for unit type. type UnitType string @@ -1099,13 +1006,11 @@ const ( UnitTypeSeconds UnitType = "seconds" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleUnitTypeValues returns an array of possible values for the UnitType const type. func PossibleUnitTypeValues() []UnitType { return []UnitType{UnitTypeBytes, UnitTypeBytesPerSecond, UnitTypeCount, UnitTypeCountPerSecond, UnitTypePercent, UnitTypeSeconds} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRuleState enumerates the values for virtual network rule state. type VirtualNetworkRuleState string @@ -1122,24 +1027,20 @@ const ( Unknown VirtualNetworkRuleState = "Unknown" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { return []VirtualNetworkRuleState{Deleting, Initializing, InProgress, Ready, Unknown} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of // a long-running operation. type BackupLongTermRetentionPoliciesCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future BackupLongTermRetentionPoliciesCreateOrUpdateFuture) Result(client BackupLongTermRetentionPoliciesClient) (bltrp BackupLongTermRetentionPolicy, err error) { +func (future *BackupLongTermRetentionPoliciesCreateOrUpdateFuture) Result(client BackupLongTermRetentionPoliciesClient) (bltrp BackupLongTermRetentionPolicy, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1147,39 +1048,19 @@ func (future BackupLongTermRetentionPoliciesCreateOrUpdateFuture) Result(client return } if !done { - return bltrp, azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - bltrp, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bltrp.Response.Response, err = future.GetResult(sender); err == nil && bltrp.Response.Response.StatusCode != http.StatusNoContent { + bltrp, err = client.CreateOrUpdateResponder(bltrp.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", bltrp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - bltrp, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionPolicy a backup long term retention policy type BackupLongTermRetentionPolicy struct { autorest.Response `json:"-"` @@ -1195,7 +1076,6 @@ type BackupLongTermRetentionPolicy struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for BackupLongTermRetentionPolicy. func (bltrp BackupLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1217,7 +1097,6 @@ func (bltrp BackupLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for BackupLongTermRetentionPolicy struct. func (bltrp *BackupLongTermRetentionPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1278,7 +1157,6 @@ func (bltrp *BackupLongTermRetentionPolicy) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionPolicyListResult represents the response to a list long-term retention policies request. type BackupLongTermRetentionPolicyListResult struct { autorest.Response `json:"-"` @@ -1286,7 +1164,6 @@ type BackupLongTermRetentionPolicyListResult struct { Value *[]BackupLongTermRetentionPolicy `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionPolicyProperties the properties of a backup long term retention policy type BackupLongTermRetentionPolicyProperties struct { // State - The status of the backup long term retention policy. Possible values include: 'Disabled', 'Enabled' @@ -1295,7 +1172,6 @@ type BackupLongTermRetentionPolicyProperties struct { RecoveryServicesBackupPolicyResourceID *string `json:"recoveryServicesBackupPolicyResourceId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionVault a backup long term retention vault type BackupLongTermRetentionVault struct { autorest.Response `json:"-"` @@ -1311,7 +1187,6 @@ type BackupLongTermRetentionVault struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for BackupLongTermRetentionVault. func (bltrv BackupLongTermRetentionVault) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1333,7 +1208,6 @@ func (bltrv BackupLongTermRetentionVault) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for BackupLongTermRetentionVault struct. func (bltrv *BackupLongTermRetentionVault) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1394,7 +1268,6 @@ func (bltrv *BackupLongTermRetentionVault) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionVaultListResult represents the response to a list vaults request. type BackupLongTermRetentionVaultListResult struct { autorest.Response `json:"-"` @@ -1402,25 +1275,21 @@ type BackupLongTermRetentionVaultListResult struct { Value *[]BackupLongTermRetentionVault `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionVaultProperties the properties of a backup long term retention vault. type BackupLongTermRetentionVaultProperties struct { // RecoveryServicesVaultResourceID - The azure recovery services vault resource id RecoveryServicesVaultResourceID *string `json:"recoveryServicesVaultResourceId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // BackupLongTermRetentionVaultsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type BackupLongTermRetentionVaultsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future BackupLongTermRetentionVaultsCreateOrUpdateFuture) Result(client BackupLongTermRetentionVaultsClient) (bltrv BackupLongTermRetentionVault, err error) { +func (future *BackupLongTermRetentionVaultsCreateOrUpdateFuture) Result(client BackupLongTermRetentionVaultsClient) (bltrv BackupLongTermRetentionVault, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1428,39 +1297,19 @@ func (future BackupLongTermRetentionVaultsCreateOrUpdateFuture) Result(client Ba return } if !done { - return bltrv, azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - bltrv, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bltrv.Response.Response, err = future.GetResult(sender); err == nil && bltrv.Response.Response.StatusCode != http.StatusNoContent { + bltrv, err = client.CreateOrUpdateResponder(bltrv.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture", "Result", bltrv.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - bltrv, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CheckNameAvailabilityRequest a request to check whether the specified name for a resource is available. type CheckNameAvailabilityRequest struct { // Name - The name whose availability is to be checked. @@ -1469,7 +1318,6 @@ type CheckNameAvailabilityRequest struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CheckNameAvailabilityResponse a response indicating whether the specified name for a resource is available. type CheckNameAvailabilityResponse struct { autorest.Response `json:"-"` @@ -1483,7 +1331,6 @@ type CheckNameAvailabilityResponse struct { Reason CheckNameAvailabilityReason `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Database represents a database. type Database struct { autorest.Response `json:"-"` @@ -1491,10 +1338,10 @@ type Database struct { Kind *string `json:"kind,omitempty"` // DatabaseProperties - The properties representing the resource. *DatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -1503,7 +1350,6 @@ type Database struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for Database. func (d Database) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1513,12 +1359,12 @@ func (d Database) MarshalJSON() ([]byte, error) { if d.DatabaseProperties != nil { objectMap["properties"] = d.DatabaseProperties } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } if d.Location != nil { objectMap["location"] = d.Location } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } if d.ID != nil { objectMap["id"] = d.ID } @@ -1531,7 +1377,6 @@ func (d Database) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for Database struct. func (d *Database) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1559,23 +1404,23 @@ func (d *Database) UnmarshalJSON(body []byte) error { } d.DatabaseProperties = &databaseProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - d.Tags = tags + d.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - d.Location = &location + d.Tags = tags } case "id": if v != nil { @@ -1610,7 +1455,6 @@ func (d *Database) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseBlobAuditingPolicy a database blob auditing policy. type DatabaseBlobAuditingPolicy struct { autorest.Response `json:"-"` @@ -1626,7 +1470,6 @@ type DatabaseBlobAuditingPolicy struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for DatabaseBlobAuditingPolicy. func (dbap DatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1648,7 +1491,6 @@ func (dbap DatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for DatabaseBlobAuditingPolicy struct. func (dbap *DatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1709,7 +1551,6 @@ func (dbap *DatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseBlobAuditingPolicyProperties properties of a database blob auditing policy. type DatabaseBlobAuditingPolicyProperties struct { // State - Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' @@ -1720,15 +1561,70 @@ type DatabaseBlobAuditingPolicyProperties struct { StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` // RetentionDays - Specifies the number of days to keep in the audit logs. RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions and Actions-Groups to audit. + // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. + // + // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + // + // BATCH_COMPLETED_GROUP, + // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + // FAILED_DATABASE_AUTHENTICATION_GROUP. + // + // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + // + // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + // + // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + // BACKUP_RESTORE_GROUP + // DATABASE_LOGOUT_GROUP + // DATABASE_OBJECT_CHANGE_GROUP + // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + // DATABASE_OPERATION_GROUP + // DATABASE_PERMISSION_CHANGE_GROUP + // DATABASE_PRINCIPAL_CHANGE_GROUP + // DATABASE_PRINCIPAL_IMPERSONATION_GROUP + // DATABASE_ROLE_MEMBER_CHANGE_GROUP + // FAILED_DATABASE_AUTHENTICATION_GROUP + // SCHEMA_OBJECT_ACCESS_GROUP + // SCHEMA_OBJECT_CHANGE_GROUP + // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + // USER_CHANGE_PASSWORD_GROUP + // BATCH_STARTED_GROUP + // BATCH_COMPLETED_GROUP + // + // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + // + // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + // + // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + // SELECT + // UPDATE + // INSERT + // DELETE + // EXECUTE + // RECEIVE + // REFERENCES + // + // The general form for defining an action to be audited is: + // ON BY + // + // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE:: and SCHEMA:: are used, respectively. + // + // For example: + // SELECT on dbo.myTable by public + // SELECT on DATABASE::myDatabase by public + // SELECT on SCHEMA::mySchema by public + // + // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage’s secondary key. + // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseListResult represents the response to a list database request. type DatabaseListResult struct { autorest.Response `json:"-"` @@ -1736,7 +1632,6 @@ type DatabaseListResult struct { Value *[]Database `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseProperties represents the properties of a database. type DatabaseProperties struct { // Collation - The collation of the database. If createMode is not Default, this value is ignored. @@ -1801,18 +1696,15 @@ type DatabaseProperties struct { ZoneRedundant *bool `json:"zoneRedundant,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesCreateImportOperationFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type DatabasesCreateImportOperationFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesCreateImportOperationFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { +func (future *DatabasesCreateImportOperationFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1820,50 +1712,28 @@ func (future DatabasesCreateImportOperationFuture) Result(client DatabasesClient return } if !done { - return ier, azure.NewAsyncOpIncompleteError("sql.DatabasesCreateImportOperationFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ier, err = client.CreateImportOperationResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateImportOperationFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { + ier, err = client.CreateImportOperationResponder(ier.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", ier.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", resp, "Failure sending request") - return - } - ier, err = client.CreateImportOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type DatabasesCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1871,39 +1741,19 @@ func (future DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Da return } if !done { - return d, azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - d, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - d, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseSecurityAlertPolicy contains information about a database Threat Detection policy. type DatabaseSecurityAlertPolicy struct { autorest.Response `json:"-"` @@ -1921,7 +1771,6 @@ type DatabaseSecurityAlertPolicy struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy. func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1946,7 +1795,6 @@ func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct. func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2016,7 +1864,6 @@ func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseSecurityAlertPolicyProperties properties for a database Threat Detection policy. type DatabaseSecurityAlertPolicyProperties struct { // State - Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' @@ -2037,17 +1884,14 @@ type DatabaseSecurityAlertPolicyProperties struct { UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesExportFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DatabasesExportFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesExportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { +func (future *DatabasesExportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2055,49 +1899,27 @@ func (future DatabasesExportFuture) Result(client DatabasesClient) (ier ImportEx return } if !done { - return ier, azure.NewAsyncOpIncompleteError("sql.DatabasesExportFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ier, err = client.ExportResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.DatabasesExportFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { + ier, err = client.ExportResponder(ier.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ier.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", resp, "Failure sending request") - return - } - ier, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesImportFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DatabasesImportFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesImportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { +func (future *DatabasesImportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2105,49 +1927,27 @@ func (future DatabasesImportFuture) Result(client DatabasesClient) (ier ImportEx return } if !done { - return ier, azure.NewAsyncOpIncompleteError("sql.DatabasesImportFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ier, err = client.ImportResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.DatabasesImportFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { + ier, err = client.ImportResponder(ier.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", ier.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", resp, "Failure sending request") - return - } - ier, err = client.ImportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesPauseFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DatabasesPauseFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesPauseFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { +func (future *DatabasesPauseFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2155,49 +1955,21 @@ func (future DatabasesPauseFuture) Result(client DatabasesClient) (ar autorest.R return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.PauseResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") return } - ar, err = client.PauseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesResumeFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DatabasesResumeFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesResumeFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { +func (future *DatabasesResumeFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2205,49 +1977,21 @@ func (future DatabasesResumeFuture) Result(client DatabasesClient) (ar autorest. return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.ResumeResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") return } - ar, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DatabasesUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2255,39 +1999,19 @@ func (future DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, return } if !done { - return d, azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - d, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", resp, "Failure sending request") - return - } - d, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseUpdate represents a database update. type DatabaseUpdate struct { // Tags - Resource tags. @@ -2302,7 +2026,6 @@ type DatabaseUpdate struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for DatabaseUpdate. func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2324,7 +2047,6 @@ func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2385,7 +2107,6 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseUsage the database usages. type DatabaseUsage struct { // Name - The name of the usage metric. @@ -2404,7 +2125,6 @@ type DatabaseUsage struct { NextResetTime *date.Time `json:"nextResetTime,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DatabaseUsageListResult the response to a list database metrics request. type DatabaseUsageListResult struct { autorest.Response `json:"-"` @@ -2412,7 +2132,6 @@ type DatabaseUsageListResult struct { Value *[]DatabaseUsage `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingPolicy represents a database data masking policy. type DataMaskingPolicy struct { autorest.Response `json:"-"` @@ -2430,7 +2149,6 @@ type DataMaskingPolicy struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for DataMaskingPolicy. func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2455,7 +2173,6 @@ func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for DataMaskingPolicy struct. func (dmp *DataMaskingPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2525,7 +2242,6 @@ func (dmp *DataMaskingPolicy) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingPolicyProperties the properties of a database data masking policy. type DataMaskingPolicyProperties struct { // DataMaskingState - The state of the data masking policy. Possible values include: 'DataMaskingStateDisabled', 'DataMaskingStateEnabled' @@ -2538,7 +2254,6 @@ type DataMaskingPolicyProperties struct { MaskingLevel *string `json:"maskingLevel,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingRule represents a database data masking rule. type DataMaskingRule struct { autorest.Response `json:"-"` @@ -2556,7 +2271,6 @@ type DataMaskingRule struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for DataMaskingRule. func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2581,7 +2295,6 @@ func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for DataMaskingRule struct. func (dmr *DataMaskingRule) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2651,7 +2364,6 @@ func (dmr *DataMaskingRule) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingRuleListResult the response to a list data masking rules request. type DataMaskingRuleListResult struct { autorest.Response `json:"-"` @@ -2659,7 +2371,6 @@ type DataMaskingRuleListResult struct { Value *[]DataMaskingRule `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DataMaskingRuleProperties the properties of a database data masking rule. type DataMaskingRuleProperties struct { // ID - The rule Id. @@ -2688,7 +2399,6 @@ type DataMaskingRuleProperties struct { ReplacementString *string `json:"replacementString,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EditionCapability the edition capability. type EditionCapability struct { // Name - The database edition name. @@ -2701,7 +2411,6 @@ type EditionCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPool represents a database elastic pool. type ElasticPool struct { autorest.Response `json:"-"` @@ -2709,10 +2418,10 @@ type ElasticPool struct { *ElasticPoolProperties `json:"properties,omitempty"` // Kind - Kind of elastic pool. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -2721,7 +2430,6 @@ type ElasticPool struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ElasticPool. func (ep ElasticPool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2731,12 +2439,12 @@ func (ep ElasticPool) MarshalJSON() ([]byte, error) { if ep.Kind != nil { objectMap["kind"] = ep.Kind } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags - } if ep.Location != nil { objectMap["location"] = ep.Location } + if ep.Tags != nil { + objectMap["tags"] = ep.Tags + } if ep.ID != nil { objectMap["id"] = ep.ID } @@ -2749,7 +2457,6 @@ func (ep ElasticPool) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ElasticPool struct. func (ep *ElasticPool) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2777,23 +2484,23 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { } ep.Kind = &kind } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - ep.Tags = tags + ep.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - ep.Location = &location + ep.Tags = tags } case "id": if v != nil { @@ -2828,7 +2535,6 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolActivity represents the activity on an elastic pool. type ElasticPoolActivity struct { // Location - The geo-location where the resource lives @@ -2843,7 +2549,6 @@ type ElasticPoolActivity struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ElasticPoolActivity. func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2865,7 +2570,6 @@ func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -2926,7 +2630,6 @@ func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolActivityListResult represents the response to a list elastic pool activity request. type ElasticPoolActivityListResult struct { autorest.Response `json:"-"` @@ -2934,7 +2637,6 @@ type ElasticPoolActivityListResult struct { Value *[]ElasticPoolActivity `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolActivityProperties represents the properties of an elastic pool. type ElasticPoolActivityProperties struct { // EndTime - The time the operation finished (ISO8601 format). @@ -2979,7 +2681,6 @@ type ElasticPoolActivityProperties struct { RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolDatabaseActivity represents the activity on an elastic pool. type ElasticPoolDatabaseActivity struct { // Location - The geo-location where the resource lives @@ -2994,7 +2695,6 @@ type ElasticPoolDatabaseActivity struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -3016,7 +2716,6 @@ func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -3077,7 +2776,6 @@ func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity request. type ElasticPoolDatabaseActivityListResult struct { autorest.Response `json:"-"` @@ -3085,7 +2783,6 @@ type ElasticPoolDatabaseActivityListResult struct { Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolDatabaseActivityProperties represents the properties of an elastic pool database activity. type ElasticPoolDatabaseActivityProperties struct { // DatabaseName - The database name. @@ -3120,7 +2817,6 @@ type ElasticPoolDatabaseActivityProperties struct { State *string `json:"state,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolDtuCapability the Elastic Pool DTU capability. type ElasticPoolDtuCapability struct { // Limit - The DTU limit for the pool. @@ -3141,7 +2837,6 @@ type ElasticPoolDtuCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolEditionCapability the elastic pool edition capability. type ElasticPoolEditionCapability struct { // Name - The elastic pool edition name. @@ -3154,7 +2849,6 @@ type ElasticPoolEditionCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolListResult represents the response to a list elastic pool request. type ElasticPoolListResult struct { autorest.Response `json:"-"` @@ -3162,7 +2856,6 @@ type ElasticPoolListResult struct { Value *[]ElasticPool `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolPerDatabaseMaxDtuCapability the max per-database DTU capability. type ElasticPoolPerDatabaseMaxDtuCapability struct { // Limit - The maximum DTUs per database. @@ -3175,7 +2868,6 @@ type ElasticPoolPerDatabaseMaxDtuCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolPerDatabaseMinDtuCapability the minimum per-database DTU capability. type ElasticPoolPerDatabaseMinDtuCapability struct { // Limit - The minimum DTUs per database. @@ -3186,7 +2878,6 @@ type ElasticPoolPerDatabaseMinDtuCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolProperties represents the properties of an elastic pool. type ElasticPoolProperties struct { // CreationDate - The creation date of the elastic pool (ISO8601 format). @@ -3207,18 +2898,15 @@ type ElasticPoolProperties struct { ZoneRedundant *bool `json:"zoneRedundant,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ElasticPoolsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ElasticPoolsCreateOrUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { +func (future *ElasticPoolsCreateOrUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3226,49 +2914,27 @@ func (future ElasticPoolsCreateOrUpdateFuture) Result(client ElasticPoolsClient) return } if !done { - return ep, azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ep, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.CreateOrUpdateResponder(ep.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - ep, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ElasticPoolsUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ElasticPoolsUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { +func (future *ElasticPoolsUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3276,39 +2942,19 @@ func (future ElasticPoolsUpdateFuture) Result(client ElasticPoolsClient) (ep Ela return } if !done { - return ep, azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ep, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.UpdateResponder(ep.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", resp, "Failure sending request") - return - } - ep, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ElasticPoolUpdate represents an elastic pool update. type ElasticPoolUpdate struct { // Tags - Resource tags. @@ -3323,7 +2969,6 @@ type ElasticPoolUpdate struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ElasticPoolUpdate. func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -3345,7 +2990,6 @@ func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -3406,7 +3050,6 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EncryptionProtector the server encryption protector. type EncryptionProtector struct { autorest.Response `json:"-"` @@ -3424,7 +3067,6 @@ type EncryptionProtector struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for EncryptionProtector. func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -3449,7 +3091,6 @@ func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for EncryptionProtector struct. func (ep *EncryptionProtector) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -3519,7 +3160,6 @@ func (ep *EncryptionProtector) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EncryptionProtectorListResult a list of server encryption protectors. type EncryptionProtectorListResult struct { autorest.Response `json:"-"` @@ -3529,14 +3169,12 @@ type EncryptionProtectorListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EncryptionProtectorListResultIterator provides access to a complete listing of EncryptionProtector values. type EncryptionProtectorListResultIterator struct { i int page EncryptionProtectorListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *EncryptionProtectorListResultIterator) Next() error { @@ -3553,19 +3191,16 @@ func (iter *EncryptionProtectorListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter EncryptionProtectorListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter EncryptionProtectorListResultIterator) Response() EncryptionProtectorListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter EncryptionProtectorListResultIterator) Value() EncryptionProtector { @@ -3575,7 +3210,6 @@ func (iter EncryptionProtectorListResultIterator) Value() EncryptionProtector { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (eplr EncryptionProtectorListResult) IsEmpty() bool { return eplr.Value == nil || len(*eplr.Value) == 0 @@ -3593,14 +3227,12 @@ func (eplr EncryptionProtectorListResult) encryptionProtectorListResultPreparer( autorest.WithBaseURL(to.String(eplr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EncryptionProtectorListResultPage contains a page of EncryptionProtector values. type EncryptionProtectorListResultPage struct { fn func(EncryptionProtectorListResult) (EncryptionProtectorListResult, error) eplr EncryptionProtectorListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *EncryptionProtectorListResultPage) Next() error { @@ -3612,19 +3244,16 @@ func (page *EncryptionProtectorListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page EncryptionProtectorListResultPage) NotDone() bool { return !page.eplr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page EncryptionProtectorListResultPage) Response() EncryptionProtectorListResult { return page.eplr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { if page.eplr.IsEmpty() { @@ -3633,7 +3262,6 @@ func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { return *page.eplr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EncryptionProtectorProperties properties for an encryption protector execution. type EncryptionProtectorProperties struct { // Subregion - Subregion of the encryption protector. @@ -3648,18 +3276,15 @@ type EncryptionProtectorProperties struct { Thumbprint *string `json:"thumbprint,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // EncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type EncryptionProtectorsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future EncryptionProtectorsCreateOrUpdateFuture) Result(client EncryptionProtectorsClient) (ep EncryptionProtector, err error) { +func (future *EncryptionProtectorsCreateOrUpdateFuture) Result(client EncryptionProtectorsClient) (ep EncryptionProtector, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3667,39 +3292,19 @@ func (future EncryptionProtectorsCreateOrUpdateFuture) Result(client EncryptionP return } if !done { - return ep, azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ep, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.CreateOrUpdateResponder(ep.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - ep, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ExportRequest export database parameters. type ExportRequest struct { // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' @@ -3716,7 +3321,6 @@ type ExportRequest struct { AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroup a failover group. type FailoverGroup struct { autorest.Response `json:"-"` @@ -3734,7 +3338,6 @@ type FailoverGroup struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for FailoverGroup. func (fg FailoverGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -3759,7 +3362,6 @@ func (fg FailoverGroup) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for FailoverGroup struct. func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -3829,7 +3431,6 @@ func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupListResult a list of failover groups. type FailoverGroupListResult struct { autorest.Response `json:"-"` @@ -3839,14 +3440,12 @@ type FailoverGroupListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupListResultIterator provides access to a complete listing of FailoverGroup values. type FailoverGroupListResultIterator struct { i int page FailoverGroupListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *FailoverGroupListResultIterator) Next() error { @@ -3863,19 +3462,16 @@ func (iter *FailoverGroupListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter FailoverGroupListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter FailoverGroupListResultIterator) Response() FailoverGroupListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter FailoverGroupListResultIterator) Value() FailoverGroup { @@ -3885,7 +3481,6 @@ func (iter FailoverGroupListResultIterator) Value() FailoverGroup { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (fglr FailoverGroupListResult) IsEmpty() bool { return fglr.Value == nil || len(*fglr.Value) == 0 @@ -3903,14 +3498,12 @@ func (fglr FailoverGroupListResult) failoverGroupListResultPreparer() (*http.Req autorest.WithBaseURL(to.String(fglr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupListResultPage contains a page of FailoverGroup values. type FailoverGroupListResultPage struct { fn func(FailoverGroupListResult) (FailoverGroupListResult, error) fglr FailoverGroupListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *FailoverGroupListResultPage) Next() error { @@ -3922,19 +3515,16 @@ func (page *FailoverGroupListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page FailoverGroupListResultPage) NotDone() bool { return !page.fglr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page FailoverGroupListResultPage) Response() FailoverGroupListResult { return page.fglr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page FailoverGroupListResultPage) Values() []FailoverGroup { if page.fglr.IsEmpty() { @@ -3943,7 +3533,6 @@ func (page FailoverGroupListResultPage) Values() []FailoverGroup { return *page.fglr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupProperties properties of a failover group. type FailoverGroupProperties struct { // ReadWriteEndpoint - Read-write endpoint of the failover group instance. @@ -3960,14 +3549,12 @@ type FailoverGroupProperties struct { Databases *[]string `json:"databases,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. type FailoverGroupReadOnlyEndpoint struct { // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. type FailoverGroupReadWriteEndpoint struct { // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic' @@ -3976,18 +3563,15 @@ type FailoverGroupReadWriteEndpoint struct { FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type FailoverGroupsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FailoverGroupsCreateOrUpdateFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { +func (future *FailoverGroupsCreateOrUpdateFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3995,49 +3579,27 @@ func (future FailoverGroupsCreateOrUpdateFuture) Result(client FailoverGroupsCli return } if !done { - return fg, azure.NewAsyncOpIncompleteError("sql.FailoverGroupsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fg, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.CreateOrUpdateResponder(fg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - fg, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type FailoverGroupsDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FailoverGroupsDeleteFuture) Result(client FailoverGroupsClient) (ar autorest.Response, err error) { +func (future *FailoverGroupsDeleteFuture) Result(client FailoverGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4045,50 +3607,22 @@ func (future FailoverGroupsDeleteFuture) Result(client FailoverGroupsClient) (ar return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.FailoverGroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type FailoverGroupsFailoverFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FailoverGroupsFailoverFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { +func (future *FailoverGroupsFailoverFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4096,50 +3630,28 @@ func (future FailoverGroupsFailoverFuture) Result(client FailoverGroupsClient) ( return } if !done { - return fg, azure.NewAsyncOpIncompleteError("sql.FailoverGroupsFailoverFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fg, err = client.FailoverResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsFailoverFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.FailoverResponder(fg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", fg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", resp, "Failure sending request") - return - } - fg, err = client.FailoverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type FailoverGroupsForceFailoverAllowDataLossFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FailoverGroupsForceFailoverAllowDataLossFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { +func (future *FailoverGroupsForceFailoverAllowDataLossFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4147,49 +3659,27 @@ func (future FailoverGroupsForceFailoverAllowDataLossFuture) Result(client Failo return } if !done { - return fg, azure.NewAsyncOpIncompleteError("sql.FailoverGroupsForceFailoverAllowDataLossFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fg, err = client.ForceFailoverAllowDataLossResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsForceFailoverAllowDataLossFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.ForceFailoverAllowDataLossResponder(fg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", fg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", resp, "Failure sending request") - return - } - fg, err = client.ForceFailoverAllowDataLossResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type FailoverGroupsUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future FailoverGroupsUpdateFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { +func (future *FailoverGroupsUpdateFuture) Result(client FailoverGroupsClient) (fg FailoverGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4197,39 +3687,19 @@ func (future FailoverGroupsUpdateFuture) Result(client FailoverGroupsClient) (fg return } if !done { - return fg, azure.NewAsyncOpIncompleteError("sql.FailoverGroupsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fg, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.UpdateResponder(fg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", resp, "Failure sending request") - return - } - fg, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupUpdate a failover group update request. type FailoverGroupUpdate struct { // FailoverGroupUpdateProperties - Resource properties. @@ -4238,7 +3708,6 @@ type FailoverGroupUpdate struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for FailoverGroupUpdate. func (fgu FailoverGroupUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -4251,7 +3720,6 @@ func (fgu FailoverGroupUpdate) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for FailoverGroupUpdate struct. func (fgu *FailoverGroupUpdate) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -4285,7 +3753,6 @@ func (fgu *FailoverGroupUpdate) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverGroupUpdateProperties properties of a failover group update. type FailoverGroupUpdateProperties struct { // ReadWriteEndpoint - Read-write endpoint of the failover group instance. @@ -4296,7 +3763,6 @@ type FailoverGroupUpdateProperties struct { Databases *[]string `json:"databases,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FirewallRule represents a server firewall rule. type FirewallRule struct { autorest.Response `json:"-"` @@ -4314,7 +3780,6 @@ type FirewallRule struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for FirewallRule. func (fr FirewallRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -4339,7 +3804,6 @@ func (fr FirewallRule) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for FirewallRule struct. func (fr *FirewallRule) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -4409,7 +3873,6 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FirewallRuleListResult represents the response to a List Firewall Rules request. type FirewallRuleListResult struct { autorest.Response `json:"-"` @@ -4417,7 +3880,6 @@ type FirewallRuleListResult struct { Value *[]FirewallRule `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FirewallRuleProperties represents the properties of a server firewall rule. type FirewallRuleProperties struct { // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. @@ -4426,7 +3888,6 @@ type FirewallRuleProperties struct { EndIPAddress *string `json:"endIpAddress,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GeoBackupPolicy a database geo backup policy. type GeoBackupPolicy struct { autorest.Response `json:"-"` @@ -4444,7 +3905,6 @@ type GeoBackupPolicy struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for GeoBackupPolicy. func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -4469,7 +3929,6 @@ func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -4539,7 +3998,6 @@ func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GeoBackupPolicyListResult the response to a list geo backup policies request. type GeoBackupPolicyListResult struct { autorest.Response `json:"-"` @@ -4547,7 +4005,6 @@ type GeoBackupPolicyListResult struct { Value *[]GeoBackupPolicy `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GeoBackupPolicyProperties the properties of the geo backup policy. type GeoBackupPolicyProperties struct { // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' @@ -4556,7 +4013,6 @@ type GeoBackupPolicyProperties struct { StorageType *string `json:"storageType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ImportExportResponse response for Import/Export Get operation. type ImportExportResponse struct { autorest.Response `json:"-"` @@ -4570,7 +4026,6 @@ type ImportExportResponse struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ImportExportResponse. func (ier ImportExportResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -4589,7 +4044,6 @@ func (ier ImportExportResponse) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ImportExportResponse struct. func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -4641,7 +4095,6 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ImportExportResponseProperties response for Import/Export Status operation. type ImportExportResponseProperties struct { // RequestType - The request type of the operation. @@ -4664,7 +4117,6 @@ type ImportExportResponseProperties struct { ErrorMessage *string `json:"errorMessage,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ImportExtensionProperties represents the properties for an import operation type ImportExtensionProperties struct { // OperationMode - The type of import operation being performed. This is always Import. @@ -4683,7 +4135,6 @@ type ImportExtensionProperties struct { AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ImportExtensionRequest import database parameters. type ImportExtensionRequest struct { // Name - The name of the extension. @@ -4694,7 +4145,6 @@ type ImportExtensionRequest struct { *ImportExtensionProperties `json:"properties,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ImportExtensionRequest. func (ier ImportExtensionRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -4710,7 +4160,6 @@ func (ier ImportExtensionRequest) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ImportExtensionRequest struct. func (ier *ImportExtensionRequest) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -4753,7 +4202,6 @@ func (ier *ImportExtensionRequest) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ImportRequest import database parameters. type ImportRequest struct { // DatabaseName - The name of the database to import. @@ -4778,7 +4226,6 @@ type ImportRequest struct { AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // LocationCapabilities the location capability. type LocationCapabilities struct { autorest.Response `json:"-"` @@ -4792,7 +4239,414 @@ type LocationCapabilities struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. +// ManagedInstance an Azure SQL managed instance. +type ManagedInstance struct { + autorest.Response `json:"-"` + // Identity - The Azure Active Directory identity of the managed instance. + Identity *ResourceIdentity `json:"identity,omitempty"` + // Sku - Managed instance sku + Sku *Sku `json:"sku,omitempty"` + // ManagedInstanceProperties - Resource properties. + *ManagedInstanceProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstance. +func (mi ManagedInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mi.Identity != nil { + objectMap["identity"] = mi.Identity + } + if mi.Sku != nil { + objectMap["sku"] = mi.Sku + } + if mi.ManagedInstanceProperties != nil { + objectMap["properties"] = mi.ManagedInstanceProperties + } + if mi.Location != nil { + objectMap["location"] = mi.Location + } + if mi.Tags != nil { + objectMap["tags"] = mi.Tags + } + if mi.ID != nil { + objectMap["id"] = mi.ID + } + if mi.Name != nil { + objectMap["name"] = mi.Name + } + if mi.Type != nil { + objectMap["type"] = mi.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct. +func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { + 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 ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + mi.Identity = &identity + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mi.Sku = &sku + } + case "properties": + if v != nil { + var managedInstanceProperties ManagedInstanceProperties + err = json.Unmarshal(*v, &managedInstanceProperties) + if err != nil { + return err + } + mi.ManagedInstanceProperties = &managedInstanceProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mi.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mi.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceListResult a list of managed instances. +type ManagedInstanceListResult struct { + autorest.Response `json:"-"` + // Value - Array of results. + Value *[]ManagedInstance `json:"value,omitempty"` + // NextLink - Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values. +type ManagedInstanceListResultIterator struct { + i int + page ManagedInstanceListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedInstanceListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstanceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedInstanceListResultIterator) Response() ManagedInstanceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedInstanceListResultIterator) Value() ManagedInstance { + if !iter.page.NotDone() { + return ManagedInstance{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (milr ManagedInstanceListResult) IsEmpty() bool { + return milr.Value == nil || len(*milr.Value) == 0 +} + +// managedInstanceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (milr ManagedInstanceListResult) managedInstanceListResultPreparer() (*http.Request, error) { + if milr.NextLink == nil || len(to.String(milr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(milr.NextLink))) +} + +// ManagedInstanceListResultPage contains a page of ManagedInstance values. +type ManagedInstanceListResultPage struct { + fn func(ManagedInstanceListResult) (ManagedInstanceListResult, error) + milr ManagedInstanceListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedInstanceListResultPage) Next() error { + next, err := page.fn(page.milr) + if err != nil { + return err + } + page.milr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstanceListResultPage) NotDone() bool { + return !page.milr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult { + return page.milr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstanceListResultPage) Values() []ManagedInstance { + if page.milr.IsEmpty() { + return nil + } + return *page.milr.Value +} + +// ManagedInstanceProperties the properties of a managed instance. +type ManagedInstanceProperties struct { + // FullyQualifiedDomainName - The fully qualified domain name of the managed instance. + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + // AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - The administrator login password (required for managed instance creation). + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // SubnetID - Subnet resource ID for the managed instance. + SubnetID *string `json:"subnetId,omitempty"` + // State - The state of the managed instance. + State *string `json:"state,omitempty"` + // LicenseType - The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + LicenseType *string `json:"licenseType,omitempty"` + // VCores - The number of VCores. + VCores *int32 `json:"vCores,omitempty"` + // StorageSizeInGB - The maximum storage size in GB. + StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` +} + +// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedInstancesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstancesCreateOrUpdateFuture) Result(client ManagedInstancesClient) (mi ManagedInstance, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { + mi, err = client.CreateOrUpdateResponder(mi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedInstancesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstancesDeleteFuture) Result(client ManagedInstancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedInstancesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstancesUpdateFuture) Result(client ManagedInstancesClient) (mi ManagedInstance, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { + mi, err = client.UpdateResponder(mi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance. +type ManagedInstanceUpdate struct { + // Sku - Managed instance sku + Sku *Sku `json:"sku,omitempty"` + // ManagedInstanceProperties - Resource properties. + *ManagedInstanceProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceUpdate. +func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miu.Sku != nil { + objectMap["sku"] = miu.Sku + } + if miu.ManagedInstanceProperties != nil { + objectMap["properties"] = miu.ManagedInstanceProperties + } + if miu.Tags != nil { + objectMap["tags"] = miu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct. +func (miu *ManagedInstanceUpdate) UnmarshalJSON(body []byte) error { + 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 + } + miu.Sku = &sku + } + case "properties": + if v != nil { + var managedInstanceProperties ManagedInstanceProperties + err = json.Unmarshal(*v, &managedInstanceProperties) + if err != nil { + return err + } + miu.ManagedInstanceProperties = &managedInstanceProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + miu.Tags = tags + } + } + } + + return nil +} + // MaxSizeCapability the maximum size capability. type MaxSizeCapability struct { // Limit - The maximum size limit (see 'unit' for the units). @@ -4805,7 +4659,6 @@ type MaxSizeCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Metric database metrics. type Metric struct { // StartTime - The start time for the metric (ISO-8601 format). @@ -4822,7 +4675,6 @@ type Metric struct { MetricValues *[]MetricValue `json:"metricValues,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MetricAvailability a metric availability value. type MetricAvailability struct { // Retention - The length of retention for the database metric. @@ -4831,7 +4683,6 @@ type MetricAvailability struct { TimeGrain *string `json:"timeGrain,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MetricDefinition a database metric definition. type MetricDefinition struct { // Name - The name information for the metric. @@ -4846,7 +4697,6 @@ type MetricDefinition struct { MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MetricDefinitionListResult the response to a list database metric definitions request. type MetricDefinitionListResult struct { autorest.Response `json:"-"` @@ -4854,7 +4704,6 @@ type MetricDefinitionListResult struct { Value *[]MetricDefinition `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MetricListResult the response to a list database metrics request. type MetricListResult struct { autorest.Response `json:"-"` @@ -4862,7 +4711,6 @@ type MetricListResult struct { Value *[]Metric `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MetricName a database metric name. type MetricName struct { // Value - The name of the database metric. @@ -4871,7 +4719,6 @@ type MetricName struct { LocalizedValue *string `json:"localizedValue,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MetricValue represents database metrics. type MetricValue struct { // Count - The number of values for the metric. @@ -4888,7 +4735,6 @@ type MetricValue struct { Total *float64 `json:"total,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Operation SQL REST API operation definition. type Operation struct { // Name - The name of the operation being performed on this particular object. @@ -4901,7 +4747,6 @@ type Operation struct { Properties map[string]interface{} `json:"properties"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -4920,7 +4765,6 @@ func (o Operation) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // OperationDisplay display metadata associated with the operation. type OperationDisplay struct { // Provider - The localized friendly form of the resource provider name. @@ -4933,7 +4777,6 @@ type OperationDisplay struct { Description *string `json:"description,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // OperationImpact the impact of an operation, both in absolute and relative terms. type OperationImpact struct { // Name - The name of the impact dimension. @@ -4946,7 +4789,6 @@ type OperationImpact struct { ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // OperationListResult result of the request to list SQL operations. type OperationListResult struct { autorest.Response `json:"-"` @@ -4956,14 +4798,12 @@ type OperationListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // OperationListResultIterator provides access to a complete listing of Operation values. type OperationListResultIterator struct { i int page OperationListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances 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) Next() error { @@ -4980,19 +4820,16 @@ func (iter *OperationListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter OperationListResultIterator) Response() OperationListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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 { @@ -5002,7 +4839,6 @@ func (iter OperationListResultIterator) Value() Operation { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (olr OperationListResult) IsEmpty() bool { return olr.Value == nil || len(*olr.Value) == 0 @@ -5020,14 +4856,12 @@ func (olr OperationListResult) operationListResultPreparer() (*http.Request, err autorest.WithBaseURL(to.String(olr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // OperationListResultPage contains a page of Operation values. type OperationListResultPage struct { fn func(OperationListResult) (OperationListResult, error) olr OperationListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the 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) Next() error { @@ -5039,19 +4873,16 @@ func (page *OperationListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page OperationListResultPage) NotDone() bool { return !page.olr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page OperationListResultPage) Response() OperationListResult { return page.olr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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() { @@ -5060,7 +4891,6 @@ func (page OperationListResultPage) Values() []Operation { return *page.olr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PartnerInfo partner server information for the failover group. type PartnerInfo struct { // ID - Resource identifier of the partner server. @@ -5071,7 +4901,6 @@ type PartnerInfo struct { ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // PerformanceLevelCapability the performance level capability. type PerformanceLevelCapability struct { // Value - Performance level value. @@ -5080,7 +4909,6 @@ type PerformanceLevelCapability struct { Unit PerformanceLevelUnit `json:"unit,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ProxyResource ARM proxy resource. type ProxyResource struct { // ID - Resource ID. @@ -5091,7 +4919,6 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecommendedIndex represents a database recommended index. type RecommendedIndex struct { // RecommendedIndexProperties - The properties representing the resource. @@ -5104,7 +4931,6 @@ type RecommendedIndex struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for RecommendedIndex. func (ri RecommendedIndex) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -5123,7 +4949,6 @@ func (ri RecommendedIndex) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for RecommendedIndex struct. func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5175,7 +5000,6 @@ func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecommendedIndexProperties represents the properties of a database recommended index. type RecommendedIndexProperties struct { // Action - The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild' @@ -5204,7 +5028,6 @@ type RecommendedIndexProperties struct { ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecoverableDatabase a recoverable database type RecoverableDatabase struct { autorest.Response `json:"-"` @@ -5218,7 +5041,6 @@ type RecoverableDatabase struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for RecoverableDatabase. func (rd RecoverableDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -5237,7 +5059,6 @@ func (rd RecoverableDatabase) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for RecoverableDatabase struct. func (rd *RecoverableDatabase) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5289,7 +5110,6 @@ func (rd *RecoverableDatabase) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecoverableDatabaseListResult the response to a list recoverable databases request type RecoverableDatabaseListResult struct { autorest.Response `json:"-"` @@ -5297,7 +5117,6 @@ type RecoverableDatabaseListResult struct { Value *[]RecoverableDatabase `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecoverableDatabaseProperties the properties of a recoverable database type RecoverableDatabaseProperties struct { // Edition - The edition of the database @@ -5310,7 +5129,6 @@ type RecoverableDatabaseProperties struct { LastAvailableBackupDate *date.Time `json:"lastAvailableBackupDate,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationLink represents a database replication link. type ReplicationLink struct { autorest.Response `json:"-"` @@ -5326,7 +5144,6 @@ type ReplicationLink struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ReplicationLink. func (rl ReplicationLink) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -5348,7 +5165,6 @@ func (rl ReplicationLink) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. func (rl *ReplicationLink) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5409,7 +5225,6 @@ func (rl *ReplicationLink) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationLinkListResult represents the response to a List database replication link request. type ReplicationLinkListResult struct { autorest.Response `json:"-"` @@ -5417,7 +5232,6 @@ type ReplicationLinkListResult struct { Value *[]ReplicationLink `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationLinkProperties represents the properties of a database replication link. type ReplicationLinkProperties struct { // IsTerminationAllowed - Legacy value indicating whether termination is allowed. Currently always returns true. @@ -5442,18 +5256,15 @@ type ReplicationLinkProperties struct { ReplicationState ReplicationState `json:"replicationState,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationLinksFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type ReplicationLinksFailoverAllowDataLossFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ReplicationLinksFailoverAllowDataLossFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { +func (future *ReplicationLinksFailoverAllowDataLossFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5461,50 +5272,22 @@ func (future ReplicationLinksFailoverAllowDataLossFuture) Result(client Replicat return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.FailoverAllowDataLossResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") return } - ar, err = client.FailoverAllowDataLossResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationLinksFailoverFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ReplicationLinksFailoverFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ReplicationLinksFailoverFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { +func (future *ReplicationLinksFailoverFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5512,39 +5295,13 @@ func (future ReplicationLinksFailoverFuture) Result(client ReplicationLinksClien return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.FailoverResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") return } - ar, err = client.FailoverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Resource ARM resource. type Resource struct { // ID - Resource ID. @@ -5555,7 +5312,6 @@ type Resource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ResourceIdentity azure Active Directory identity configuration for a resource. type ResourceIdentity struct { // PrincipalID - The Azure Active Directory principal id. @@ -5566,7 +5322,6 @@ type ResourceIdentity struct { TenantID *uuid.UUID `json:"tenantId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorableDroppedDatabase a restorable dropped database type RestorableDroppedDatabase struct { autorest.Response `json:"-"` @@ -5582,7 +5337,6 @@ type RestorableDroppedDatabase struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for RestorableDroppedDatabase. func (rdd RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -5604,7 +5358,6 @@ func (rdd RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for RestorableDroppedDatabase struct. func (rdd *RestorableDroppedDatabase) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5665,7 +5418,6 @@ func (rdd *RestorableDroppedDatabase) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorableDroppedDatabaseListResult the response to a list restorable dropped databases request type RestorableDroppedDatabaseListResult struct { autorest.Response `json:"-"` @@ -5673,7 +5425,6 @@ type RestorableDroppedDatabaseListResult struct { Value *[]RestorableDroppedDatabase `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorableDroppedDatabaseProperties the properties of a restorable dropped database type RestorableDroppedDatabaseProperties struct { // DatabaseName - The name of the database @@ -5694,7 +5445,6 @@ type RestorableDroppedDatabaseProperties struct { EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorePoint a database restore point. type RestorePoint struct { // RestorePointProperties - The properties of the restore point. @@ -5707,7 +5457,6 @@ type RestorePoint struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for RestorePoint. func (rp RestorePoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -5726,7 +5475,6 @@ func (rp RestorePoint) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for RestorePoint struct. func (rp *RestorePoint) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5778,7 +5526,6 @@ func (rp *RestorePoint) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorePointListResult the response to a list database restore points request. type RestorePointListResult struct { autorest.Response `json:"-"` @@ -5786,7 +5533,6 @@ type RestorePointListResult struct { Value *[]RestorePoint `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorePointProperties represents the properties of a database restore point. type RestorePointProperties struct { // RestorePointType - The restore point type of the database restore point. Possible values include: 'DISCRETE', 'CONTINUOUS' @@ -5797,7 +5543,6 @@ type RestorePointProperties struct { EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Server an Azure SQL Database server. type Server struct { autorest.Response `json:"-"` @@ -5807,10 +5552,10 @@ type Server struct { Kind *string `json:"kind,omitempty"` // ServerProperties - Resource properties. *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -5819,7 +5564,6 @@ type Server struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for Server. func (s Server) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -5832,12 +5576,12 @@ func (s Server) MarshalJSON() ([]byte, error) { if s.ServerProperties != nil { objectMap["properties"] = s.ServerProperties } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } if s.Location != nil { objectMap["location"] = s.Location } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } if s.ID != nil { objectMap["id"] = s.ID } @@ -5850,7 +5594,6 @@ func (s Server) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for Server struct. func (s *Server) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5887,23 +5630,23 @@ func (s *Server) UnmarshalJSON(body []byte) error { } s.ServerProperties = &serverProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - s.Tags = tags + s.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - s.Location = &location + s.Tags = tags } case "id": if v != nil { @@ -5938,7 +5681,6 @@ func (s *Server) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerAdministratorListResult the response to a list Active Directory Administrators request. type ServerAdministratorListResult struct { autorest.Response `json:"-"` @@ -5946,7 +5688,6 @@ type ServerAdministratorListResult struct { Value *[]ServerAzureADAdministrator `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerAdministratorProperties the properties of an server Administrator. type ServerAdministratorProperties struct { // AdministratorType - The type of administrator. @@ -5959,7 +5700,6 @@ type ServerAdministratorProperties struct { TenantID *uuid.UUID `json:"tenantId,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerAzureADAdministrator an server Active Directory Administrator. type ServerAzureADAdministrator struct { autorest.Response `json:"-"` @@ -5973,7 +5713,6 @@ type ServerAzureADAdministrator struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ServerAzureADAdministrator. func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -5992,7 +5731,6 @@ func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ServerAzureADAdministrator struct. func (saaa *ServerAzureADAdministrator) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -6044,18 +5782,15 @@ func (saaa *ServerAzureADAdministrator) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerAzureADAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type ServerAzureADAdministratorsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServerAzureADAdministratorsCreateOrUpdateFuture) Result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { +func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) Result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6063,50 +5798,28 @@ func (future ServerAzureADAdministratorsCreateOrUpdateFuture) Result(client Serv return } if !done { - return saaa, azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - saaa, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { + saaa, err = client.CreateOrUpdateResponder(saaa.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", saaa.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - saaa, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerAzureADAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type ServerAzureADAdministratorsDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServerAzureADAdministratorsDeleteFuture) Result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { +func (future *ServerAzureADAdministratorsDeleteFuture) Result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6114,39 +5827,19 @@ func (future ServerAzureADAdministratorsDeleteFuture) Result(client ServerAzureA return } if !done { - return saaa, azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - saaa, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { + saaa, err = client.DeleteResponder(saaa.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", saaa.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", resp, "Failure sending request") - return - } - saaa, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerCommunicationLink server communication link. type ServerCommunicationLink struct { autorest.Response `json:"-"` @@ -6164,7 +5857,6 @@ type ServerCommunicationLink struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ServerCommunicationLink. func (scl ServerCommunicationLink) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -6189,7 +5881,6 @@ func (scl ServerCommunicationLink) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ServerCommunicationLink struct. func (scl *ServerCommunicationLink) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -6259,7 +5950,6 @@ func (scl *ServerCommunicationLink) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerCommunicationLinkListResult a list of server communication links. type ServerCommunicationLinkListResult struct { autorest.Response `json:"-"` @@ -6267,7 +5957,6 @@ type ServerCommunicationLinkListResult struct { Value *[]ServerCommunicationLink `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerCommunicationLinkProperties the properties of a server communication link. type ServerCommunicationLinkProperties struct { // State - The state. @@ -6276,18 +5965,15 @@ type ServerCommunicationLinkProperties struct { PartnerServer *string `json:"partnerServer,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerCommunicationLinksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type ServerCommunicationLinksCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServerCommunicationLinksCreateOrUpdateFuture) Result(client ServerCommunicationLinksClient) (scl ServerCommunicationLink, err error) { +func (future *ServerCommunicationLinksCreateOrUpdateFuture) Result(client ServerCommunicationLinksClient) (scl ServerCommunicationLink, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6295,39 +5981,19 @@ func (future ServerCommunicationLinksCreateOrUpdateFuture) Result(client ServerC return } if !done { - return scl, azure.NewAsyncOpIncompleteError("sql.ServerCommunicationLinksCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - scl, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ServerCommunicationLinksCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if scl.Response.Response, err = future.GetResult(sender); err == nil && scl.Response.Response.StatusCode != http.StatusNoContent { + scl, err = client.CreateOrUpdateResponder(scl.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", scl.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - scl, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerConnectionPolicy a server secure connection policy. type ServerConnectionPolicy struct { autorest.Response `json:"-"` @@ -6345,7 +6011,6 @@ type ServerConnectionPolicy struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ServerConnectionPolicy. func (scp ServerConnectionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -6370,7 +6035,6 @@ func (scp ServerConnectionPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ServerConnectionPolicy struct. func (scp *ServerConnectionPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -6440,14 +6104,12 @@ func (scp *ServerConnectionPolicy) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerConnectionPolicyProperties the properties of a server secure connection policy. type ServerConnectionPolicyProperties struct { // ConnectionType - The server connection type. Possible values include: 'ServerConnectionTypeDefault', 'ServerConnectionTypeProxy', 'ServerConnectionTypeRedirect' ConnectionType ServerConnectionType `json:"connectionType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKey a server key. type ServerKey struct { autorest.Response `json:"-"` @@ -6465,7 +6127,6 @@ type ServerKey struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ServerKey. func (sk ServerKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -6490,7 +6151,6 @@ func (sk ServerKey) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ServerKey struct. func (sk *ServerKey) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -6560,7 +6220,6 @@ func (sk *ServerKey) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeyListResult a list of server keys. type ServerKeyListResult struct { autorest.Response `json:"-"` @@ -6570,14 +6229,12 @@ type ServerKeyListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeyListResultIterator provides access to a complete listing of ServerKey values. type ServerKeyListResultIterator struct { i int page ServerKeyListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *ServerKeyListResultIterator) Next() error { @@ -6594,19 +6251,16 @@ func (iter *ServerKeyListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter ServerKeyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter ServerKeyListResultIterator) Response() ServerKeyListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter ServerKeyListResultIterator) Value() ServerKey { @@ -6616,7 +6270,6 @@ func (iter ServerKeyListResultIterator) Value() ServerKey { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (sklr ServerKeyListResult) IsEmpty() bool { return sklr.Value == nil || len(*sklr.Value) == 0 @@ -6634,14 +6287,12 @@ func (sklr ServerKeyListResult) serverKeyListResultPreparer() (*http.Request, er autorest.WithBaseURL(to.String(sklr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeyListResultPage contains a page of ServerKey values. type ServerKeyListResultPage struct { fn func(ServerKeyListResult) (ServerKeyListResult, error) sklr ServerKeyListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *ServerKeyListResultPage) Next() error { @@ -6653,19 +6304,16 @@ func (page *ServerKeyListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page ServerKeyListResultPage) NotDone() bool { return !page.sklr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page ServerKeyListResultPage) Response() ServerKeyListResult { return page.sklr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page ServerKeyListResultPage) Values() []ServerKey { if page.sklr.IsEmpty() { @@ -6674,7 +6322,6 @@ func (page ServerKeyListResultPage) Values() []ServerKey { return *page.sklr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeyProperties properties for a server key execution. type ServerKeyProperties struct { // Subregion - Subregion of the server key. @@ -6689,18 +6336,15 @@ type ServerKeyProperties struct { CreationDate *date.Time `json:"creationDate,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ServerKeysCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServerKeysCreateOrUpdateFuture) Result(client ServerKeysClient) (sk ServerKey, err error) { +func (future *ServerKeysCreateOrUpdateFuture) Result(client ServerKeysClient) (sk ServerKey, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6708,49 +6352,27 @@ func (future ServerKeysCreateOrUpdateFuture) Result(client ServerKeysClient) (sk return } if !done { - return sk, azure.NewAsyncOpIncompleteError("sql.ServerKeysCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sk, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ServerKeysCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { + sk, err = client.CreateOrUpdateResponder(sk.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sk, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServerKeysDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServerKeysDeleteFuture) Result(client ServerKeysClient) (ar autorest.Response, err error) { +func (future *ServerKeysDeleteFuture) Result(client ServerKeysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6758,39 +6380,13 @@ func (future ServerKeysDeleteFuture) Result(client ServerKeysClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.ServerKeysDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.ServerKeysDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerListResult a list of servers. type ServerListResult struct { autorest.Response `json:"-"` @@ -6800,14 +6396,12 @@ type ServerListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerListResultIterator provides access to a complete listing of Server values. type ServerListResultIterator struct { i int page ServerListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *ServerListResultIterator) Next() error { @@ -6824,19 +6418,16 @@ func (iter *ServerListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter ServerListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter ServerListResultIterator) Response() ServerListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter ServerListResultIterator) Value() Server { @@ -6846,7 +6437,6 @@ func (iter ServerListResultIterator) Value() Server { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (slr ServerListResult) IsEmpty() bool { return slr.Value == nil || len(*slr.Value) == 0 @@ -6864,14 +6454,12 @@ func (slr ServerListResult) serverListResultPreparer() (*http.Request, error) { autorest.WithBaseURL(to.String(slr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerListResultPage contains a page of Server values. type ServerListResultPage struct { fn func(ServerListResult) (ServerListResult, error) slr ServerListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *ServerListResultPage) Next() error { @@ -6883,19 +6471,16 @@ func (page *ServerListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page ServerListResultPage) NotDone() bool { return !page.slr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page ServerListResultPage) Response() ServerListResult { return page.slr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page ServerListResultPage) Values() []Server { if page.slr.IsEmpty() { @@ -6904,7 +6489,6 @@ func (page ServerListResultPage) Values() []Server { return *page.slr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerProperties the properties of a server. type ServerProperties struct { // AdministratorLogin - Administrator username for the server. Once created it cannot be changed. @@ -6919,18 +6503,15 @@ type ServerProperties struct { FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ServersCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersCreateOrUpdateFuture) Result(client ServersClient) (s Server, err error) { +func (future *ServersCreateOrUpdateFuture) Result(client ServersClient) (s Server, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6938,49 +6519,27 @@ func (future ServersCreateOrUpdateFuture) Result(client ServersClient) (s Server return } if !done { - return s, azure.NewAsyncOpIncompleteError("sql.ServersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ServersCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) { +func (future *ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6988,49 +6547,21 @@ func (future ServersDeleteFuture) Result(client ServersClient) (ar autorest.Resp return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.ServersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.ServersDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServersUpdateFuture) Result(client ServersClient) (s Server, err error) { +func (future *ServersUpdateFuture) Result(client ServersClient) (s Server, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7038,39 +6569,19 @@ func (future ServersUpdateFuture) Result(client ServersClient) (s Server, err er return } if !done { - return s, azure.NewAsyncOpIncompleteError("sql.ServersUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.ServersUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerUpdate an update request for an Azure SQL Database server. type ServerUpdate struct { // ServerProperties - Resource properties. @@ -7079,7 +6590,6 @@ type ServerUpdate struct { Tags map[string]*string `json:"tags"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ServerUpdate. func (su ServerUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -7092,7 +6602,6 @@ func (su ServerUpdate) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ServerUpdate struct. func (su *ServerUpdate) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -7126,7 +6635,6 @@ func (su *ServerUpdate) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerUsage represents server metrics. type ServerUsage struct { // Name - Name of the server usage metric. @@ -7145,7 +6653,6 @@ type ServerUsage struct { NextResetTime *date.Time `json:"nextResetTime,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerUsageListResult represents the response to a list server metrics request. type ServerUsageListResult struct { autorest.Response `json:"-"` @@ -7153,7 +6660,6 @@ type ServerUsageListResult struct { Value *[]ServerUsage `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerVersionCapability the server capability type ServerVersionCapability struct { // Name - The server version name. @@ -7168,7 +6674,6 @@ type ServerVersionCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceLevelObjectiveCapability the service objectives capability. type ServiceLevelObjectiveCapability struct { // ID - The unique ID of the service objective. @@ -7187,7 +6692,6 @@ type ServiceLevelObjectiveCapability struct { Reason *string `json:"reason,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceObjective represents a database service objective. type ServiceObjective struct { autorest.Response `json:"-"` @@ -7201,7 +6705,6 @@ type ServiceObjective struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ServiceObjective. func (so ServiceObjective) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -7220,7 +6723,6 @@ func (so ServiceObjective) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ServiceObjective struct. func (so *ServiceObjective) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -7272,7 +6774,6 @@ func (so *ServiceObjective) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceObjectiveListResult represents the response to a get database service objectives request. type ServiceObjectiveListResult struct { autorest.Response `json:"-"` @@ -7280,7 +6781,6 @@ type ServiceObjectiveListResult struct { Value *[]ServiceObjective `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceObjectiveProperties represents the properties of a database service objective. type ServiceObjectiveProperties struct { // ServiceObjectiveName - The name for the service objective. @@ -7295,7 +6795,6 @@ type ServiceObjectiveProperties struct { Enabled *bool `json:"enabled,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceTierAdvisor represents a Service Tier Advisor. type ServiceTierAdvisor struct { autorest.Response `json:"-"` @@ -7309,7 +6808,6 @@ type ServiceTierAdvisor struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for ServiceTierAdvisor. func (sta ServiceTierAdvisor) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -7328,7 +6826,6 @@ func (sta ServiceTierAdvisor) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for ServiceTierAdvisor struct. func (sta *ServiceTierAdvisor) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -7380,7 +6877,6 @@ func (sta *ServiceTierAdvisor) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceTierAdvisorListResult represents the response to a list service tier advisor request. type ServiceTierAdvisorListResult struct { autorest.Response `json:"-"` @@ -7388,7 +6884,6 @@ type ServiceTierAdvisorListResult struct { Value *[]ServiceTierAdvisor `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceTierAdvisorProperties represents the properties of a Service Tier Advisor. type ServiceTierAdvisorProperties struct { // ObservationPeriodStart - The observation period start (ISO8601 format). @@ -7431,7 +6926,20 @@ type ServiceTierAdvisorProperties struct { Confidence *float64 `json:"confidence,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + Tier *string `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + // SloUsageMetric a Slo Usage Metric. type SloUsageMetric struct { // ServiceLevelObjective - The serviceLevelObjective for SLO usage metric. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' @@ -7442,7 +6950,6 @@ type SloUsageMetric struct { InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SubscriptionUsage usage Metric of a Subscription in a Location. type SubscriptionUsage struct { autorest.Response `json:"-"` @@ -7456,7 +6963,6 @@ type SubscriptionUsage struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for SubscriptionUsage. func (su SubscriptionUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -7475,7 +6981,6 @@ func (su SubscriptionUsage) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for SubscriptionUsage struct. func (su *SubscriptionUsage) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -7527,7 +7032,6 @@ func (su *SubscriptionUsage) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SubscriptionUsageListResult a list of subscription usage metrics in a location. type SubscriptionUsageListResult struct { autorest.Response `json:"-"` @@ -7537,14 +7041,12 @@ type SubscriptionUsageListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SubscriptionUsageListResultIterator provides access to a complete listing of SubscriptionUsage values. type SubscriptionUsageListResultIterator struct { i int page SubscriptionUsageListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SubscriptionUsageListResultIterator) Next() error { @@ -7561,19 +7063,16 @@ func (iter *SubscriptionUsageListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SubscriptionUsageListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SubscriptionUsageListResultIterator) Response() SubscriptionUsageListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SubscriptionUsageListResultIterator) Value() SubscriptionUsage { @@ -7583,7 +7082,6 @@ func (iter SubscriptionUsageListResultIterator) Value() SubscriptionUsage { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (sulr SubscriptionUsageListResult) IsEmpty() bool { return sulr.Value == nil || len(*sulr.Value) == 0 @@ -7601,14 +7099,12 @@ func (sulr SubscriptionUsageListResult) subscriptionUsageListResultPreparer() (* autorest.WithBaseURL(to.String(sulr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SubscriptionUsageListResultPage contains a page of SubscriptionUsage values. type SubscriptionUsageListResultPage struct { fn func(SubscriptionUsageListResult) (SubscriptionUsageListResult, error) sulr SubscriptionUsageListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SubscriptionUsageListResultPage) Next() error { @@ -7620,19 +7116,16 @@ func (page *SubscriptionUsageListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SubscriptionUsageListResultPage) NotDone() bool { return !page.sulr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SubscriptionUsageListResultPage) Response() SubscriptionUsageListResult { return page.sulr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SubscriptionUsageListResultPage) Values() []SubscriptionUsage { if page.sulr.IsEmpty() { @@ -7641,7 +7134,6 @@ func (page SubscriptionUsageListResultPage) Values() []SubscriptionUsage { return *page.sulr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SubscriptionUsageProperties properties of a subscription usage. type SubscriptionUsageProperties struct { // DisplayName - User-readable name of the metric. @@ -7654,7 +7146,6 @@ type SubscriptionUsageProperties struct { Unit *string `json:"unit,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgent an Azure SQL Database sync agent. type SyncAgent struct { autorest.Response `json:"-"` @@ -7668,7 +7159,6 @@ type SyncAgent struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for SyncAgent. func (sa SyncAgent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -7687,7 +7177,6 @@ func (sa SyncAgent) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for SyncAgent struct. func (sa *SyncAgent) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -7739,7 +7228,6 @@ func (sa *SyncAgent) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentKeyProperties properties of an Azure SQL Database sync agent key. type SyncAgentKeyProperties struct { autorest.Response `json:"-"` @@ -7747,7 +7235,6 @@ type SyncAgentKeyProperties struct { SyncAgentKey *string `json:"syncAgentKey,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentLinkedDatabase an Azure SQL Database sync agent linked database. type SyncAgentLinkedDatabase struct { // SyncAgentLinkedDatabaseProperties - Resource properties. @@ -7760,7 +7247,6 @@ type SyncAgentLinkedDatabase struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for SyncAgentLinkedDatabase. func (sald SyncAgentLinkedDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -7779,7 +7265,6 @@ func (sald SyncAgentLinkedDatabase) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for SyncAgentLinkedDatabase struct. func (sald *SyncAgentLinkedDatabase) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -7831,7 +7316,6 @@ func (sald *SyncAgentLinkedDatabase) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentLinkedDatabaseListResult a list of sync agent linked databases. type SyncAgentLinkedDatabaseListResult struct { autorest.Response `json:"-"` @@ -7841,7 +7325,6 @@ type SyncAgentLinkedDatabaseListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentLinkedDatabaseListResultIterator provides access to a complete listing of SyncAgentLinkedDatabase // values. type SyncAgentLinkedDatabaseListResultIterator struct { @@ -7849,7 +7332,6 @@ type SyncAgentLinkedDatabaseListResultIterator struct { page SyncAgentLinkedDatabaseListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SyncAgentLinkedDatabaseListResultIterator) Next() error { @@ -7866,19 +7348,16 @@ func (iter *SyncAgentLinkedDatabaseListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SyncAgentLinkedDatabaseListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SyncAgentLinkedDatabaseListResultIterator) Response() SyncAgentLinkedDatabaseListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SyncAgentLinkedDatabaseListResultIterator) Value() SyncAgentLinkedDatabase { @@ -7888,7 +7367,6 @@ func (iter SyncAgentLinkedDatabaseListResultIterator) Value() SyncAgentLinkedDat return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (saldlr SyncAgentLinkedDatabaseListResult) IsEmpty() bool { return saldlr.Value == nil || len(*saldlr.Value) == 0 @@ -7906,14 +7384,12 @@ func (saldlr SyncAgentLinkedDatabaseListResult) syncAgentLinkedDatabaseListResul autorest.WithBaseURL(to.String(saldlr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentLinkedDatabaseListResultPage contains a page of SyncAgentLinkedDatabase values. type SyncAgentLinkedDatabaseListResultPage struct { fn func(SyncAgentLinkedDatabaseListResult) (SyncAgentLinkedDatabaseListResult, error) saldlr SyncAgentLinkedDatabaseListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SyncAgentLinkedDatabaseListResultPage) Next() error { @@ -7925,19 +7401,16 @@ func (page *SyncAgentLinkedDatabaseListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SyncAgentLinkedDatabaseListResultPage) NotDone() bool { return !page.saldlr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SyncAgentLinkedDatabaseListResultPage) Response() SyncAgentLinkedDatabaseListResult { return page.saldlr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SyncAgentLinkedDatabaseListResultPage) Values() []SyncAgentLinkedDatabase { if page.saldlr.IsEmpty() { @@ -7946,7 +7419,6 @@ func (page SyncAgentLinkedDatabaseListResultPage) Values() []SyncAgentLinkedData return *page.saldlr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentLinkedDatabaseProperties properties of an Azure SQL Database sync agent linked database. type SyncAgentLinkedDatabaseProperties struct { // DatabaseType - Type of the sync agent linked database. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' @@ -7963,7 +7435,6 @@ type SyncAgentLinkedDatabaseProperties struct { UserName *string `json:"userName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentListResult a list of sync agents. type SyncAgentListResult struct { autorest.Response `json:"-"` @@ -7973,14 +7444,12 @@ type SyncAgentListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentListResultIterator provides access to a complete listing of SyncAgent values. type SyncAgentListResultIterator struct { i int page SyncAgentListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SyncAgentListResultIterator) Next() error { @@ -7997,19 +7466,16 @@ func (iter *SyncAgentListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SyncAgentListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SyncAgentListResultIterator) Response() SyncAgentListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SyncAgentListResultIterator) Value() SyncAgent { @@ -8019,7 +7485,6 @@ func (iter SyncAgentListResultIterator) Value() SyncAgent { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (salr SyncAgentListResult) IsEmpty() bool { return salr.Value == nil || len(*salr.Value) == 0 @@ -8037,14 +7502,12 @@ func (salr SyncAgentListResult) syncAgentListResultPreparer() (*http.Request, er autorest.WithBaseURL(to.String(salr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentListResultPage contains a page of SyncAgent values. type SyncAgentListResultPage struct { fn func(SyncAgentListResult) (SyncAgentListResult, error) salr SyncAgentListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SyncAgentListResultPage) Next() error { @@ -8056,19 +7519,16 @@ func (page *SyncAgentListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SyncAgentListResultPage) NotDone() bool { return !page.salr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SyncAgentListResultPage) Response() SyncAgentListResult { return page.salr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SyncAgentListResultPage) Values() []SyncAgent { if page.salr.IsEmpty() { @@ -8077,7 +7537,6 @@ func (page SyncAgentListResultPage) Values() []SyncAgent { return *page.salr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentProperties properties of an Azure SQL Database sync agent. type SyncAgentProperties struct { // Name - Name of the sync agent. @@ -8096,18 +7555,15 @@ type SyncAgentProperties struct { Version *string `json:"version,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type SyncAgentsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncAgentsCreateOrUpdateFuture) Result(client SyncAgentsClient) (sa SyncAgent, err error) { +func (future *SyncAgentsCreateOrUpdateFuture) Result(client SyncAgentsClient) (sa SyncAgent, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8115,49 +7571,27 @@ func (future SyncAgentsCreateOrUpdateFuture) Result(client SyncAgentsClient) (sa return } if !done { - return sa, azure.NewAsyncOpIncompleteError("sql.SyncAgentsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sa, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sa.Response.Response, err = future.GetResult(sender); err == nil && sa.Response.Response.StatusCode != http.StatusNoContent { + sa, err = client.CreateOrUpdateResponder(sa.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", sa.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sa, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SyncAgentsDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncAgentsDeleteFuture) Result(client SyncAgentsClient) (ar autorest.Response, err error) { +func (future *SyncAgentsDeleteFuture) Result(client SyncAgentsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8165,39 +7599,13 @@ func (future SyncAgentsDeleteFuture) Result(client SyncAgentsClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.SyncAgentsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncDatabaseIDListResult a list of sync database ID properties. type SyncDatabaseIDListResult struct { autorest.Response `json:"-"` @@ -8207,14 +7615,12 @@ type SyncDatabaseIDListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncDatabaseIDListResultIterator provides access to a complete listing of SyncDatabaseIDProperties values. type SyncDatabaseIDListResultIterator struct { i int page SyncDatabaseIDListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SyncDatabaseIDListResultIterator) Next() error { @@ -8231,19 +7637,16 @@ func (iter *SyncDatabaseIDListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SyncDatabaseIDListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SyncDatabaseIDListResultIterator) Response() SyncDatabaseIDListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SyncDatabaseIDListResultIterator) Value() SyncDatabaseIDProperties { @@ -8253,7 +7656,6 @@ func (iter SyncDatabaseIDListResultIterator) Value() SyncDatabaseIDProperties { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (sdilr SyncDatabaseIDListResult) IsEmpty() bool { return sdilr.Value == nil || len(*sdilr.Value) == 0 @@ -8271,14 +7673,12 @@ func (sdilr SyncDatabaseIDListResult) syncDatabaseIDListResultPreparer() (*http. autorest.WithBaseURL(to.String(sdilr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncDatabaseIDListResultPage contains a page of SyncDatabaseIDProperties values. type SyncDatabaseIDListResultPage struct { fn func(SyncDatabaseIDListResult) (SyncDatabaseIDListResult, error) sdilr SyncDatabaseIDListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SyncDatabaseIDListResultPage) Next() error { @@ -8290,19 +7690,16 @@ func (page *SyncDatabaseIDListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SyncDatabaseIDListResultPage) NotDone() bool { return !page.sdilr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SyncDatabaseIDListResultPage) Response() SyncDatabaseIDListResult { return page.sdilr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SyncDatabaseIDListResultPage) Values() []SyncDatabaseIDProperties { if page.sdilr.IsEmpty() { @@ -8311,14 +7708,12 @@ func (page SyncDatabaseIDListResultPage) Values() []SyncDatabaseIDProperties { return *page.sdilr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncDatabaseIDProperties properties of the sync database id. type SyncDatabaseIDProperties struct { // ID - ARM resource id of sync database. ID *string `json:"id,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncFullSchemaProperties properties of the database full schema. type SyncFullSchemaProperties struct { // Tables - List of tables in the database full schema. @@ -8327,7 +7722,6 @@ type SyncFullSchemaProperties struct { LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncFullSchemaPropertiesListResult a list of sync schema properties. type SyncFullSchemaPropertiesListResult struct { autorest.Response `json:"-"` @@ -8337,7 +7731,6 @@ type SyncFullSchemaPropertiesListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncFullSchemaPropertiesListResultIterator provides access to a complete listing of SyncFullSchemaProperties // values. type SyncFullSchemaPropertiesListResultIterator struct { @@ -8345,7 +7738,6 @@ type SyncFullSchemaPropertiesListResultIterator struct { page SyncFullSchemaPropertiesListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SyncFullSchemaPropertiesListResultIterator) Next() error { @@ -8362,19 +7754,16 @@ func (iter *SyncFullSchemaPropertiesListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SyncFullSchemaPropertiesListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SyncFullSchemaPropertiesListResultIterator) Response() SyncFullSchemaPropertiesListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SyncFullSchemaPropertiesListResultIterator) Value() SyncFullSchemaProperties { @@ -8384,7 +7773,6 @@ func (iter SyncFullSchemaPropertiesListResultIterator) Value() SyncFullSchemaPro return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (sfsplr SyncFullSchemaPropertiesListResult) IsEmpty() bool { return sfsplr.Value == nil || len(*sfsplr.Value) == 0 @@ -8402,14 +7790,12 @@ func (sfsplr SyncFullSchemaPropertiesListResult) syncFullSchemaPropertiesListRes autorest.WithBaseURL(to.String(sfsplr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncFullSchemaPropertiesListResultPage contains a page of SyncFullSchemaProperties values. type SyncFullSchemaPropertiesListResultPage struct { fn func(SyncFullSchemaPropertiesListResult) (SyncFullSchemaPropertiesListResult, error) sfsplr SyncFullSchemaPropertiesListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SyncFullSchemaPropertiesListResultPage) Next() error { @@ -8421,19 +7807,16 @@ func (page *SyncFullSchemaPropertiesListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SyncFullSchemaPropertiesListResultPage) NotDone() bool { return !page.sfsplr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SyncFullSchemaPropertiesListResultPage) Response() SyncFullSchemaPropertiesListResult { return page.sfsplr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SyncFullSchemaPropertiesListResultPage) Values() []SyncFullSchemaProperties { if page.sfsplr.IsEmpty() { @@ -8442,7 +7825,6 @@ func (page SyncFullSchemaPropertiesListResultPage) Values() []SyncFullSchemaProp return *page.sfsplr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncFullSchemaTable properties of the table in the database full schema. type SyncFullSchemaTable struct { // Columns - List of columns in the table of database full schema. @@ -8457,7 +7839,6 @@ type SyncFullSchemaTable struct { QuotedName *string `json:"quotedName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncFullSchemaTableColumn properties of the column in the table of database full schema. type SyncFullSchemaTableColumn struct { // DataSize - Data size of the column. @@ -8476,7 +7857,6 @@ type SyncFullSchemaTableColumn struct { QuotedName *string `json:"quotedName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroup an Azure SQL Database sync group. type SyncGroup struct { autorest.Response `json:"-"` @@ -8490,7 +7870,6 @@ type SyncGroup struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for SyncGroup. func (sg SyncGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -8509,7 +7888,6 @@ func (sg SyncGroup) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for SyncGroup struct. func (sg *SyncGroup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -8561,7 +7939,6 @@ func (sg *SyncGroup) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupListResult a list of sync groups. type SyncGroupListResult struct { autorest.Response `json:"-"` @@ -8571,14 +7948,12 @@ type SyncGroupListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupListResultIterator provides access to a complete listing of SyncGroup values. type SyncGroupListResultIterator struct { i int page SyncGroupListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SyncGroupListResultIterator) Next() error { @@ -8595,19 +7970,16 @@ func (iter *SyncGroupListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SyncGroupListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SyncGroupListResultIterator) Response() SyncGroupListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SyncGroupListResultIterator) Value() SyncGroup { @@ -8617,7 +7989,6 @@ func (iter SyncGroupListResultIterator) Value() SyncGroup { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (sglr SyncGroupListResult) IsEmpty() bool { return sglr.Value == nil || len(*sglr.Value) == 0 @@ -8635,14 +8006,12 @@ func (sglr SyncGroupListResult) syncGroupListResultPreparer() (*http.Request, er autorest.WithBaseURL(to.String(sglr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupListResultPage contains a page of SyncGroup values. type SyncGroupListResultPage struct { fn func(SyncGroupListResult) (SyncGroupListResult, error) sglr SyncGroupListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SyncGroupListResultPage) Next() error { @@ -8654,19 +8023,16 @@ func (page *SyncGroupListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SyncGroupListResultPage) NotDone() bool { return !page.sglr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SyncGroupListResultPage) Response() SyncGroupListResult { return page.sglr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SyncGroupListResultPage) Values() []SyncGroup { if page.sglr.IsEmpty() { @@ -8675,7 +8041,6 @@ func (page SyncGroupListResultPage) Values() []SyncGroup { return *page.sglr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupLogListResult a list of sync group log properties. type SyncGroupLogListResult struct { autorest.Response `json:"-"` @@ -8685,14 +8050,12 @@ type SyncGroupLogListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupLogListResultIterator provides access to a complete listing of SyncGroupLogProperties values. type SyncGroupLogListResultIterator struct { i int page SyncGroupLogListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SyncGroupLogListResultIterator) Next() error { @@ -8709,19 +8072,16 @@ func (iter *SyncGroupLogListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SyncGroupLogListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SyncGroupLogListResultIterator) Response() SyncGroupLogListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SyncGroupLogListResultIterator) Value() SyncGroupLogProperties { @@ -8731,7 +8091,6 @@ func (iter SyncGroupLogListResultIterator) Value() SyncGroupLogProperties { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (sgllr SyncGroupLogListResult) IsEmpty() bool { return sgllr.Value == nil || len(*sgllr.Value) == 0 @@ -8749,14 +8108,12 @@ func (sgllr SyncGroupLogListResult) syncGroupLogListResultPreparer() (*http.Requ autorest.WithBaseURL(to.String(sgllr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupLogListResultPage contains a page of SyncGroupLogProperties values. type SyncGroupLogListResultPage struct { fn func(SyncGroupLogListResult) (SyncGroupLogListResult, error) sgllr SyncGroupLogListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SyncGroupLogListResultPage) Next() error { @@ -8768,19 +8125,16 @@ func (page *SyncGroupLogListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SyncGroupLogListResultPage) NotDone() bool { return !page.sgllr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SyncGroupLogListResultPage) Response() SyncGroupLogListResult { return page.sgllr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SyncGroupLogListResultPage) Values() []SyncGroupLogProperties { if page.sgllr.IsEmpty() { @@ -8789,7 +8143,6 @@ func (page SyncGroupLogListResultPage) Values() []SyncGroupLogProperties { return *page.sgllr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupLogProperties properties of an Azure SQL Database sync group log. type SyncGroupLogProperties struct { // Timestamp - Timestamp of the sync group log. @@ -8806,7 +8159,6 @@ type SyncGroupLogProperties struct { OperationStatus *string `json:"operationStatus,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupProperties properties of a sync group. type SyncGroupProperties struct { // Interval - Sync interval of the sync group. @@ -8827,7 +8179,6 @@ type SyncGroupProperties struct { Schema *SyncGroupSchema `json:"schema,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupSchema properties of sync group schema. type SyncGroupSchema struct { // Tables - List of tables in sync group schema. @@ -8836,7 +8187,6 @@ type SyncGroupSchema struct { MasterSyncMemberName *string `json:"masterSyncMemberName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupSchemaTable properties of table in sync group schema. type SyncGroupSchemaTable struct { // Columns - List of columns in sync group schema. @@ -8845,7 +8195,6 @@ type SyncGroupSchemaTable struct { QuotedName *string `json:"quotedName,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupSchemaTableColumn properties of column in sync group table. type SyncGroupSchemaTableColumn struct { // QuotedName - Quoted name of sync group table column. @@ -8856,18 +8205,15 @@ type SyncGroupSchemaTableColumn struct { DataType *string `json:"dataType,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type SyncGroupsCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncGroupsCreateOrUpdateFuture) Result(client SyncGroupsClient) (sg SyncGroup, err error) { +func (future *SyncGroupsCreateOrUpdateFuture) Result(client SyncGroupsClient) (sg SyncGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8875,49 +8221,27 @@ func (future SyncGroupsCreateOrUpdateFuture) Result(client SyncGroupsClient) (sg return } if !done { - return sg, azure.NewAsyncOpIncompleteError("sql.SyncGroupsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sg, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sg, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SyncGroupsDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncGroupsDeleteFuture) Result(client SyncGroupsClient) (ar autorest.Response, err error) { +func (future *SyncGroupsDeleteFuture) Result(client SyncGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8925,50 +8249,22 @@ func (future SyncGroupsDeleteFuture) Result(client SyncGroupsClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.SyncGroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupsRefreshHubSchemaFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type SyncGroupsRefreshHubSchemaFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncGroupsRefreshHubSchemaFuture) Result(client SyncGroupsClient) (ar autorest.Response, err error) { +func (future *SyncGroupsRefreshHubSchemaFuture) Result(client SyncGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8976,49 +8272,21 @@ func (future SyncGroupsRefreshHubSchemaFuture) Result(client SyncGroupsClient) ( return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.SyncGroupsRefreshHubSchemaFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.RefreshHubSchemaResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsRefreshHubSchemaFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsRefreshHubSchemaFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsRefreshHubSchemaFuture") return } - ar, err = client.RefreshHubSchemaResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsRefreshHubSchemaFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SyncGroupsUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncGroupsUpdateFuture) Result(client SyncGroupsClient) (sg SyncGroup, err error) { +func (future *SyncGroupsUpdateFuture) Result(client SyncGroupsClient) (sg SyncGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9026,39 +8294,19 @@ func (future SyncGroupsUpdateFuture) Result(client SyncGroupsClient) (sg SyncGro return } if !done { - return sg, azure.NewAsyncOpIncompleteError("sql.SyncGroupsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sg, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateResponder(sg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", resp, "Failure sending request") - return - } - sg, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMember an Azure SQL Database sync member. type SyncMember struct { autorest.Response `json:"-"` @@ -9072,7 +8320,6 @@ type SyncMember struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for SyncMember. func (sm SyncMember) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -9091,7 +8338,6 @@ func (sm SyncMember) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for SyncMember struct. func (sm *SyncMember) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -9143,7 +8389,6 @@ func (sm *SyncMember) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMemberListResult a list of Azure SQL Database sync members. type SyncMemberListResult struct { autorest.Response `json:"-"` @@ -9153,14 +8398,12 @@ type SyncMemberListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMemberListResultIterator provides access to a complete listing of SyncMember values. type SyncMemberListResultIterator struct { i int page SyncMemberListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *SyncMemberListResultIterator) Next() error { @@ -9177,19 +8420,16 @@ func (iter *SyncMemberListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter SyncMemberListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter SyncMemberListResultIterator) Response() SyncMemberListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter SyncMemberListResultIterator) Value() SyncMember { @@ -9199,7 +8439,6 @@ func (iter SyncMemberListResultIterator) Value() SyncMember { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (smlr SyncMemberListResult) IsEmpty() bool { return smlr.Value == nil || len(*smlr.Value) == 0 @@ -9217,14 +8456,12 @@ func (smlr SyncMemberListResult) syncMemberListResultPreparer() (*http.Request, autorest.WithBaseURL(to.String(smlr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMemberListResultPage contains a page of SyncMember values. type SyncMemberListResultPage struct { fn func(SyncMemberListResult) (SyncMemberListResult, error) smlr SyncMemberListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *SyncMemberListResultPage) Next() error { @@ -9236,19 +8473,16 @@ func (page *SyncMemberListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page SyncMemberListResultPage) NotDone() bool { return !page.smlr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page SyncMemberListResultPage) Response() SyncMemberListResult { return page.smlr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page SyncMemberListResultPage) Values() []SyncMember { if page.smlr.IsEmpty() { @@ -9257,7 +8491,6 @@ func (page SyncMemberListResultPage) Values() []SyncMember { return *page.smlr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMemberProperties properties of a sync member. type SyncMemberProperties struct { // DatabaseType - Database type of the sync member. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' @@ -9280,18 +8513,15 @@ type SyncMemberProperties struct { SyncState SyncMemberState `json:"syncState,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMembersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type SyncMembersCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncMembersCreateOrUpdateFuture) Result(client SyncMembersClient) (sm SyncMember, err error) { +func (future *SyncMembersCreateOrUpdateFuture) Result(client SyncMembersClient) (sm SyncMember, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9299,49 +8529,27 @@ func (future SyncMembersCreateOrUpdateFuture) Result(client SyncMembersClient) ( return } if !done { - return sm, azure.NewAsyncOpIncompleteError("sql.SyncMembersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sm, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.SyncMembersCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { + sm, err = client.CreateOrUpdateResponder(sm.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sm, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMembersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SyncMembersDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncMembersDeleteFuture) Result(client SyncMembersClient) (ar autorest.Response, err error) { +func (future *SyncMembersDeleteFuture) Result(client SyncMembersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9349,50 +8557,22 @@ func (future SyncMembersDeleteFuture) Result(client SyncMembersClient) (ar autor return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.SyncMembersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.SyncMembersDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMembersRefreshMemberSchemaFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type SyncMembersRefreshMemberSchemaFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncMembersRefreshMemberSchemaFuture) Result(client SyncMembersClient) (ar autorest.Response, err error) { +func (future *SyncMembersRefreshMemberSchemaFuture) Result(client SyncMembersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9400,49 +8580,21 @@ func (future SyncMembersRefreshMemberSchemaFuture) Result(client SyncMembersClie return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.SyncMembersRefreshMemberSchemaFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.RefreshMemberSchemaResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersRefreshMemberSchemaFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersRefreshMemberSchemaFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("sql.SyncMembersRefreshMemberSchemaFuture") return } - ar, err = client.RefreshMemberSchemaResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersRefreshMemberSchemaFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMembersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SyncMembersUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SyncMembersUpdateFuture) Result(client SyncMembersClient) (sm SyncMember, err error) { +func (future *SyncMembersUpdateFuture) Result(client SyncMembersClient) (sm SyncMember, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9450,45 +8602,25 @@ func (future SyncMembersUpdateFuture) Result(client SyncMembersClient) (sm SyncM return } if !done { - return sm, azure.NewAsyncOpIncompleteError("sql.SyncMembersUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sm, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.SyncMembersUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { + sm, err = client.UpdateResponder(sm.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", resp, "Failure sending request") - return - } - sm, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -9497,16 +8629,15 @@ type TrackedResource struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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 } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } if tr.ID != nil { objectMap["id"] = tr.ID } @@ -9519,7 +8650,6 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryption represents a database transparent data encryption configuration. type TransparentDataEncryption struct { autorest.Response `json:"-"` @@ -9535,7 +8665,6 @@ type TransparentDataEncryption struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for TransparentDataEncryption. func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -9557,7 +8686,6 @@ func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for TransparentDataEncryption struct. func (tde *TransparentDataEncryption) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -9618,7 +8746,6 @@ func (tde *TransparentDataEncryption) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionActivity represents a database transparent data encryption Scan. type TransparentDataEncryptionActivity struct { // Location - Resource location. @@ -9633,7 +8760,6 @@ type TransparentDataEncryptionActivity struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for TransparentDataEncryptionActivity. func (tdea TransparentDataEncryptionActivity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -9655,7 +8781,6 @@ func (tdea TransparentDataEncryptionActivity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for TransparentDataEncryptionActivity struct. func (tdea *TransparentDataEncryptionActivity) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -9716,7 +8841,6 @@ func (tdea *TransparentDataEncryptionActivity) UnmarshalJSON(body []byte) error return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionActivityListResult represents the response to a list database transparent data // encryption activity request. type TransparentDataEncryptionActivityListResult struct { @@ -9725,7 +8849,6 @@ type TransparentDataEncryptionActivityListResult struct { Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionActivityProperties represents the properties of a database transparent data encryption // Scan. type TransparentDataEncryptionActivityProperties struct { @@ -9735,14 +8858,12 @@ type TransparentDataEncryptionActivityProperties struct { PercentComplete *float64 `json:"percentComplete,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. type TransparentDataEncryptionProperties struct { // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' Status TransparentDataEncryptionStatus `json:"status,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRule a virtual network rule. type VirtualNetworkRule struct { autorest.Response `json:"-"` @@ -9756,7 +8877,6 @@ type VirtualNetworkRule struct { Type *string `json:"type,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // MarshalJSON is the custom marshaler for VirtualNetworkRule. func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -9775,7 +8895,6 @@ func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -9827,7 +8946,6 @@ func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRuleListResult a list of virtual network rules. type VirtualNetworkRuleListResult struct { autorest.Response `json:"-"` @@ -9837,14 +8955,12 @@ type VirtualNetworkRuleListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. type VirtualNetworkRuleListResultIterator struct { i int page VirtualNetworkRuleListResultPage } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. func (iter *VirtualNetworkRuleListResultIterator) Next() error { @@ -9861,19 +8977,16 @@ func (iter *VirtualNetworkRuleListResultIterator) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the enumeration should be started or is not yet complete. func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { return iter.page.Response() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { @@ -9883,7 +8996,6 @@ func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { return iter.page.Values()[iter.i] } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // IsEmpty returns true if the ListResult contains no values. func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { return vnrlr.Value == nil || len(*vnrlr.Value) == 0 @@ -9901,14 +9013,12 @@ func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer() autorest.WithBaseURL(to.String(vnrlr.NextLink))) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. type VirtualNetworkRuleListResultPage struct { fn func(VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) vnrlr VirtualNetworkRuleListResult } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. func (page *VirtualNetworkRuleListResultPage) Next() error { @@ -9920,19 +9030,16 @@ func (page *VirtualNetworkRuleListResultPage) Next() error { return nil } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NotDone returns true if the page enumeration should be started or is not yet complete. func (page VirtualNetworkRuleListResultPage) NotDone() bool { return !page.vnrlr.IsEmpty() } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Response returns the raw server response from the last page request. func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { return page.vnrlr } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Values returns the slice of values for the current page or nil if there are no values. func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { if page.vnrlr.IsEmpty() { @@ -9941,7 +9048,6 @@ func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { return *page.vnrlr.Value } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRuleProperties properties of a virtual network rule. type VirtualNetworkRuleProperties struct { // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. @@ -9952,18 +9058,15 @@ type VirtualNetworkRuleProperties struct { State VirtualNetworkRuleState `json:"state,omitempty"` } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type VirtualNetworkRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkRulesCreateOrUpdateFuture) Result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { +func (future *VirtualNetworkRulesCreateOrUpdateFuture) Result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9971,50 +9074,28 @@ func (future VirtualNetworkRulesCreateOrUpdateFuture) Result(client VirtualNetwo return } if !done { - return vnr, azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vnr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { + vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vnr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type VirtualNetworkRulesDeleteFuture struct { azure.Future - req *http.Request } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkRulesDeleteFuture) Result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { +func (future *VirtualNetworkRulesDeleteFuture) Result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10022,34 +9103,9 @@ func (future VirtualNetworkRulesDeleteFuture) Result(client VirtualNetworkRulesC return } if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/operations.go similarity index 83% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/operations.go index 1046841acd859..d5c11bcff4cd5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/operations.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // OperationsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,19 +31,16 @@ type OperationsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewOperationsClient creates an instance of the OperationsClient client. func NewOperationsClient(subscriptionID string) OperationsClient { return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // List lists all of the available SQL Rest API operations. func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { result.fn = client.listNextResults @@ -69,7 +65,6 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { const APIVersion = "2015-05-01-preview" @@ -85,7 +80,6 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -93,7 +87,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // 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) { @@ -128,7 +121,6 @@ func (client OperationsClient) listNextResults(lastResults OperationListResult) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListComplete enumerates all values, automatically crossing page boundaries as required. func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { result.page, err = client.List(ctx) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go index fa6c48773d273..cf043230ed08d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RecoverableDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,22 @@ type RecoverableDatabasesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewRecoverableDatabasesClient creates an instance of the RecoverableDatabasesClient client. func NewRecoverableDatabasesClient(subscriptionID string) RecoverableDatabasesClient { return NewRecoverableDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewRecoverableDatabasesClientWithBaseURI creates an instance of the RecoverableDatabasesClient client. func NewRecoverableDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableDatabasesClient { return RecoverableDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a recoverable database, which is a resource representing a database's geo backup -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database func (client RecoverableDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RecoverableDatabase, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -72,7 +69,6 @@ func (client RecoverableDatabasesClient) Get(ctx context.Context, resourceGroupN return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client RecoverableDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -95,7 +91,6 @@ func (client RecoverableDatabasesClient) GetPreparer(ctx context.Context, resour return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client RecoverableDatabasesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -103,7 +98,6 @@ func (client RecoverableDatabasesClient) GetSender(req *http.Request) (*http.Res azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client RecoverableDatabasesClient) GetResponder(resp *http.Response) (result RecoverableDatabase, err error) { @@ -117,11 +111,11 @@ func (client RecoverableDatabasesClient) GetResponder(resp *http.Response) (resu return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer gets a list of recoverable databases -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client RecoverableDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RecoverableDatabaseListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -144,7 +138,6 @@ func (client RecoverableDatabasesClient) ListByServer(ctx context.Context, resou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client RecoverableDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -166,7 +159,6 @@ func (client RecoverableDatabasesClient) ListByServerPreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client RecoverableDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -174,7 +166,6 @@ func (client RecoverableDatabasesClient) ListByServerSender(req *http.Request) ( azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client RecoverableDatabasesClient) ListByServerResponder(resp *http.Response) (result RecoverableDatabaseListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go similarity index 75% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go index f0a91edca87d7..d4560b265371e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ReplicationLinksClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,25 +31,23 @@ type ReplicationLinksClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewReplicationLinksClient creates an instance of the ReplicationLinksClient client. func NewReplicationLinksClient(subscriptionID string) ReplicationLinksClient { return NewReplicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewReplicationLinksClientWithBaseURI creates an instance of the ReplicationLinksClient client. func NewReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ReplicationLinksClient { return ReplicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a database replication link. Cannot be done during failover. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database that has the replication link to be dropped. linkID is the ID of the replication link to be -// deleted. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database that has the replication link to be dropped. +// linkID - the ID of the replication link to be deleted. func (client ReplicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, linkID) if err != nil { @@ -73,7 +70,6 @@ func (client ReplicationLinksClient) Delete(ctx context.Context, resourceGroupNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client ReplicationLinksClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -97,7 +93,6 @@ func (client ReplicationLinksClient) DeletePreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ReplicationLinksClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -105,7 +100,6 @@ func (client ReplicationLinksClient) DeleteSender(req *http.Request) (*http.Resp azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ReplicationLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -118,13 +112,13 @@ func (client ReplicationLinksClient) DeleteResponder(resp *http.Response) (resul return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Failover sets which replica database is primary by failing over from the current primary replica database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database that has the replication link to be failed over. linkID is the ID of the replication link to be -// failed over. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database that has the replication link to be failed over. +// linkID - the ID of the replication link to be failed over. func (client ReplicationLinksClient) Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverFuture, err error) { req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, databaseName, linkID) if err != nil { @@ -141,7 +135,6 @@ func (client ReplicationLinksClient) Failover(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverPreparer prepares the Failover request. func (client ReplicationLinksClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -165,23 +158,23 @@ func (client ReplicationLinksClient) FailoverPreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverSender sends the Failover request. The method will close the // http.Response Body if it receives an error. func (client ReplicationLinksClient) FailoverSender(req *http.Request) (future ReplicationLinksFailoverFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverResponder handles the response to the Failover request. The method always // closes the http.Response Body. func (client ReplicationLinksClient) FailoverResponder(resp *http.Response) (result autorest.Response, err error) { @@ -194,14 +187,14 @@ func (client ReplicationLinksClient) FailoverResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverAllowDataLoss sets which replica database is primary by failing over from the current primary replica // database. This operation might result in data loss. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database that has the replication link to be failed over. linkID is the ID of the replication link to be -// failed over. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database that has the replication link to be failed over. +// linkID - the ID of the replication link to be failed over. func (client ReplicationLinksClient) FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverAllowDataLossFuture, err error) { req, err := client.FailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, databaseName, linkID) if err != nil { @@ -218,7 +211,6 @@ func (client ReplicationLinksClient) FailoverAllowDataLoss(ctx context.Context, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverAllowDataLossPreparer prepares the FailoverAllowDataLoss request. func (client ReplicationLinksClient) FailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -242,23 +234,23 @@ func (client ReplicationLinksClient) FailoverAllowDataLossPreparer(ctx context.C return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverAllowDataLossSender sends the FailoverAllowDataLoss request. The method will close the // http.Response Body if it receives an error. func (client ReplicationLinksClient) FailoverAllowDataLossSender(req *http.Request) (future ReplicationLinksFailoverAllowDataLossFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // FailoverAllowDataLossResponder handles the response to the FailoverAllowDataLoss request. The method always // closes the http.Response Body. func (client ReplicationLinksClient) FailoverAllowDataLossResponder(resp *http.Response) (result autorest.Response, err error) { @@ -271,12 +263,13 @@ func (client ReplicationLinksClient) FailoverAllowDataLossResponder(resp *http.R return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a database replication link. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to get the link for. linkID is the replication link ID to be retrieved. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to get the link for. +// linkID - the replication link ID to be retrieved. func (client ReplicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLink, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, linkID) if err != nil { @@ -299,7 +292,6 @@ func (client ReplicationLinksClient) Get(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ReplicationLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -323,7 +315,6 @@ func (client ReplicationLinksClient) GetPreparer(ctx context.Context, resourceGr return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ReplicationLinksClient) GetSender(req *http.Request) (*http.Response, error) { @@ -331,7 +322,6 @@ func (client ReplicationLinksClient) GetSender(req *http.Request) (*http.Respons azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ReplicationLinksClient) GetResponder(resp *http.Response) (result ReplicationLink, err error) { @@ -345,12 +335,12 @@ func (client ReplicationLinksClient) GetResponder(resp *http.Response) (result R return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase lists a database's replication links. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to retrieve links for. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to retrieve links for. func (client ReplicationLinksClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ReplicationLinkListResult, err error) { req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -373,7 +363,6 @@ func (client ReplicationLinksClient) ListByDatabase(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client ReplicationLinksClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -396,7 +385,6 @@ func (client ReplicationLinksClient) ListByDatabasePreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client ReplicationLinksClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -404,7 +392,6 @@ func (client ReplicationLinksClient) ListByDatabaseSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client ReplicationLinksClient) ListByDatabaseResponder(resp *http.Response) (result ReplicationLinkListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go index 9e8d1b610aa5f..bc868bb018043 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorableDroppedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services // that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, // update, and delete databases. @@ -32,24 +31,22 @@ type RestorableDroppedDatabasesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewRestorableDroppedDatabasesClient creates an instance of the RestorableDroppedDatabasesClient client. func NewRestorableDroppedDatabasesClient(subscriptionID string) RestorableDroppedDatabasesClient { return NewRestorableDroppedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewRestorableDroppedDatabasesClientWithBaseURI creates an instance of the RestorableDroppedDatabasesClient client. func NewRestorableDroppedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedDatabasesClient { return RestorableDroppedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a deleted database that can be restored -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. -// restorableDroppededDatabaseID is the id of the deleted database in the form of +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// restorableDroppededDatabaseID - the id of the deleted database in the form of // databaseName,deletionTimeInFileTimeFormat func (client RestorableDroppedDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (result RestorableDroppedDatabase, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, restorableDroppededDatabaseID) @@ -73,7 +70,6 @@ func (client RestorableDroppedDatabasesClient) Get(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client RestorableDroppedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -96,7 +92,6 @@ func (client RestorableDroppedDatabasesClient) GetPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client RestorableDroppedDatabasesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -104,7 +99,6 @@ func (client RestorableDroppedDatabasesClient) GetSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client RestorableDroppedDatabasesClient) GetResponder(resp *http.Response) (result RestorableDroppedDatabase, err error) { @@ -118,11 +112,11 @@ func (client RestorableDroppedDatabasesClient) GetResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer gets a list of deleted databases that can be restored -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client RestorableDroppedDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RestorableDroppedDatabaseListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -145,7 +139,6 @@ func (client RestorableDroppedDatabasesClient) ListByServer(ctx context.Context, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client RestorableDroppedDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -167,7 +160,6 @@ func (client RestorableDroppedDatabasesClient) ListByServerPreparer(ctx context. return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client RestorableDroppedDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -175,7 +167,6 @@ func (client RestorableDroppedDatabasesClient) ListByServerSender(req *http.Requ azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client RestorableDroppedDatabasesClient) ListByServerResponder(resp *http.Response) (result RestorableDroppedDatabaseListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/restorepoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/restorepoints.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/restorepoints.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/restorepoints.go index 7e739f47d45d0..76427f5d2ece3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/restorepoints.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/restorepoints.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RestorePointsClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,22 @@ type RestorePointsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewRestorePointsClient creates an instance of the RestorePointsClient client. func NewRestorePointsClient(subscriptionID string) RestorePointsClient { return NewRestorePointsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewRestorePointsClientWithBaseURI creates an instance of the RestorePointsClient client. func NewRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) RestorePointsClient { return RestorePointsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase gets a list of database restore points. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database to get available restore points. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database to get available restore points. func (client RestorePointsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) { req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -72,7 +69,6 @@ func (client RestorePointsClient) ListByDatabase(ctx context.Context, resourceGr return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client RestorePointsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -95,7 +91,6 @@ func (client RestorePointsClient) ListByDatabasePreparer(ctx context.Context, re return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client RestorePointsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -103,7 +98,6 @@ func (client RestorePointsClient) ListByDatabaseSender(req *http.Request) (*http azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client RestorePointsClient) ListByDatabaseResponder(resp *http.Response) (result RestorePointListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go index d69f7e421260c..21b4055b1d4aa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerAzureADAdministratorsClient is the the Azure SQL Database management API provides a RESTful set of web // services that interact with Azure SQL Database services to manage your databases. The API enables you to create, // retrieve, update, and delete databases. @@ -33,25 +32,23 @@ type ServerAzureADAdministratorsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerAzureADAdministratorsClient creates an instance of the ServerAzureADAdministratorsClient client. func NewServerAzureADAdministratorsClient(subscriptionID string) ServerAzureADAdministratorsClient { return NewServerAzureADAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerAzureADAdministratorsClientWithBaseURI creates an instance of the ServerAzureADAdministratorsClient client. func NewServerAzureADAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAzureADAdministratorsClient { return ServerAzureADAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates a new Server Active Directory Administrator or updates an existing server Active Directory // Administrator. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. properties is the required -// parameters for creating or updating an Active Directory Administrator. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// properties - the required parameters for creating or updating an Active Directory Administrator. func (client ServerAzureADAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties ServerAzureADAdministrator) (result ServerAzureADAdministratorsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: properties, @@ -79,7 +76,6 @@ func (client ServerAzureADAdministratorsClient) CreateOrUpdate(ctx context.Conte return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ServerAzureADAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, properties ServerAzureADAdministrator) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -104,23 +100,23 @@ func (client ServerAzureADAdministratorsClient) CreateOrUpdatePreparer(ctx conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ServerAzureADAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ServerAzureADAdministratorsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ServerAzureADAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { @@ -134,11 +130,11 @@ func (client ServerAzureADAdministratorsClient) CreateOrUpdateResponder(resp *ht return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes an existing server Active Directory Administrator. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServerAzureADAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministratorsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -155,7 +151,6 @@ func (client ServerAzureADAdministratorsClient) Delete(ctx context.Context, reso return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client ServerAzureADAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -178,23 +173,23 @@ func (client ServerAzureADAdministratorsClient) DeletePreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ServerAzureADAdministratorsClient) DeleteSender(req *http.Request) (future ServerAzureADAdministratorsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ServerAzureADAdministratorsClient) DeleteResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { @@ -208,11 +203,11 @@ func (client ServerAzureADAdministratorsClient) DeleteResponder(resp *http.Respo return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get returns an server Administrator. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServerAzureADAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministrator, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -235,7 +230,6 @@ func (client ServerAzureADAdministratorsClient) Get(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ServerAzureADAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -258,7 +252,6 @@ func (client ServerAzureADAdministratorsClient) GetPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ServerAzureADAdministratorsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -266,7 +259,6 @@ func (client ServerAzureADAdministratorsClient) GetSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServerAzureADAdministratorsClient) GetResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { @@ -280,11 +272,11 @@ func (client ServerAzureADAdministratorsClient) GetResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer returns a list of server Administrators. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServerAzureADAdministratorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -307,7 +299,6 @@ func (client ServerAzureADAdministratorsClient) ListByServer(ctx context.Context return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client ServerAzureADAdministratorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -329,7 +320,6 @@ func (client ServerAzureADAdministratorsClient) ListByServerPreparer(ctx context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client ServerAzureADAdministratorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -337,7 +327,6 @@ func (client ServerAzureADAdministratorsClient) ListByServerSender(req *http.Req azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client ServerAzureADAdministratorsClient) ListByServerResponder(resp *http.Response) (result ServerAdministratorListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go similarity index 78% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go index 9015acb14e3ec..d59823088d014 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerCommunicationLinksClient is the the Azure SQL Database management API provides a RESTful set of web services // that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, // update, and delete databases. @@ -33,25 +32,23 @@ type ServerCommunicationLinksClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerCommunicationLinksClient creates an instance of the ServerCommunicationLinksClient client. func NewServerCommunicationLinksClient(subscriptionID string) ServerCommunicationLinksClient { return NewServerCommunicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerCommunicationLinksClientWithBaseURI creates an instance of the ServerCommunicationLinksClient client. func NewServerCommunicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ServerCommunicationLinksClient { return ServerCommunicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates a server communication link. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. communicationLinkName is the -// name of the server communication link. parameters is the required parameters for creating a server communication -// link. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// communicationLinkName - the name of the server communication link. +// parameters - the required parameters for creating a server communication link. func (client ServerCommunicationLinksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (result ServerCommunicationLinksCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -75,7 +72,6 @@ func (client ServerCommunicationLinksClient) CreateOrUpdate(ctx context.Context, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ServerCommunicationLinksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -100,23 +96,23 @@ func (client ServerCommunicationLinksClient) CreateOrUpdatePreparer(ctx context. return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ServerCommunicationLinksClient) CreateOrUpdateSender(req *http.Request) (future ServerCommunicationLinksCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ServerCommunicationLinksClient) CreateOrUpdateResponder(resp *http.Response) (result ServerCommunicationLink, err error) { @@ -130,12 +126,12 @@ func (client ServerCommunicationLinksClient) CreateOrUpdateResponder(resp *http. return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a server communication link. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. communicationLinkName is the -// name of the server communication link. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// communicationLinkName - the name of the server communication link. func (client ServerCommunicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, communicationLinkName) if err != nil { @@ -158,7 +154,6 @@ func (client ServerCommunicationLinksClient) Delete(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client ServerCommunicationLinksClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -181,7 +176,6 @@ func (client ServerCommunicationLinksClient) DeletePreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ServerCommunicationLinksClient) DeleteSender(req *http.Request) (*http.Response, error) { @@ -189,7 +183,6 @@ func (client ServerCommunicationLinksClient) DeleteSender(req *http.Request) (*h azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ServerCommunicationLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -202,12 +195,12 @@ func (client ServerCommunicationLinksClient) DeleteResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get returns a server communication link. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. communicationLinkName is the -// name of the server communication link. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// communicationLinkName - the name of the server communication link. func (client ServerCommunicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result ServerCommunicationLink, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, communicationLinkName) if err != nil { @@ -230,7 +223,6 @@ func (client ServerCommunicationLinksClient) Get(ctx context.Context, resourceGr return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ServerCommunicationLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -253,7 +245,6 @@ func (client ServerCommunicationLinksClient) GetPreparer(ctx context.Context, re return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ServerCommunicationLinksClient) GetSender(req *http.Request) (*http.Response, error) { @@ -261,7 +252,6 @@ func (client ServerCommunicationLinksClient) GetSender(req *http.Request) (*http azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServerCommunicationLinksClient) GetResponder(resp *http.Response) (result ServerCommunicationLink, err error) { @@ -275,11 +265,11 @@ func (client ServerCommunicationLinksClient) GetResponder(resp *http.Response) ( return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer gets a list of server communication links. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServerCommunicationLinksClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerCommunicationLinkListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -302,7 +292,6 @@ func (client ServerCommunicationLinksClient) ListByServer(ctx context.Context, r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client ServerCommunicationLinksClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -324,7 +313,6 @@ func (client ServerCommunicationLinksClient) ListByServerPreparer(ctx context.Co return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client ServerCommunicationLinksClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -332,7 +320,6 @@ func (client ServerCommunicationLinksClient) ListByServerSender(req *http.Reques azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client ServerCommunicationLinksClient) ListByServerResponder(resp *http.Response) (result ServerCommunicationLinkListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go index c4e22b61f964c..b451d8018af45 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerConnectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services // that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, // update, and delete databases. @@ -32,24 +31,22 @@ type ServerConnectionPoliciesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerConnectionPoliciesClient creates an instance of the ServerConnectionPoliciesClient client. func NewServerConnectionPoliciesClient(subscriptionID string) ServerConnectionPoliciesClient { return NewServerConnectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerConnectionPoliciesClientWithBaseURI creates an instance of the ServerConnectionPoliciesClient client. func NewServerConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerConnectionPoliciesClient { return ServerConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates the server's connection policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the required -// parameters for updating a secure connection policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for updating a secure connection policy. func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (result ServerConnectionPolicy, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { @@ -72,7 +69,6 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ServerConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -97,7 +93,6 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context. return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ServerConnectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -105,7 +100,6 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdateSender(req *http.Requ azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ServerConnectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerConnectionPolicy, err error) { @@ -119,11 +113,11 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdateResponder(resp *http. return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets the server's secure connection policy. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServerConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerConnectionPolicy, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -146,7 +140,6 @@ func (client ServerConnectionPoliciesClient) Get(ctx context.Context, resourceGr return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ServerConnectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -169,7 +162,6 @@ func (client ServerConnectionPoliciesClient) GetPreparer(ctx context.Context, re return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ServerConnectionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -177,7 +169,6 @@ func (client ServerConnectionPoliciesClient) GetSender(req *http.Request) (*http azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServerConnectionPoliciesClient) GetResponder(resp *http.Response) (result ServerConnectionPolicy, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverkeys.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverkeys.go similarity index 75% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverkeys.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverkeys.go index 3401aac55ef30..a70e07c8509e3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverkeys.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverkeys.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerKeysClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,28 +31,26 @@ type ServerKeysClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerKeysClient creates an instance of the ServerKeysClient client. func NewServerKeysClient(subscriptionID string) ServerKeysClient { return NewServerKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerKeysClientWithBaseURI creates an instance of the ServerKeysClient client. func NewServerKeysClientWithBaseURI(baseURI string, subscriptionID string) ServerKeysClient { return ServerKeysClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a server key. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. keyName is the name of the -// server key to be operated on (updated or created). The key name is required to be in the format of -// 'vault_key_version'. For example, if the keyId is +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// keyName - the name of the server key to be operated on (updated or created). The key name is required to be +// in the format of 'vault_key_version'. For example, if the keyId is // https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key -// name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 parameters is the -// requested server key resource state. +// name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 +// parameters - the requested server key resource state. func (client ServerKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters ServerKey) (result ServerKeysCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, keyName, parameters) if err != nil { @@ -70,7 +67,6 @@ func (client ServerKeysClient) CreateOrUpdate(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ServerKeysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters ServerKey) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -95,23 +91,23 @@ func (client ServerKeysClient) CreateOrUpdatePreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ServerKeysClient) CreateOrUpdateSender(req *http.Request) (future ServerKeysCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ServerKeysClient) CreateOrUpdateResponder(resp *http.Response) (result ServerKey, err error) { @@ -125,12 +121,12 @@ func (client ServerKeysClient) CreateOrUpdateResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes the server key with the given name. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. keyName is the name of the -// server key to be deleted. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// keyName - the name of the server key to be deleted. func (client ServerKeysClient) Delete(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKeysDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, keyName) if err != nil { @@ -147,7 +143,6 @@ func (client ServerKeysClient) Delete(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client ServerKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -170,23 +165,23 @@ func (client ServerKeysClient) DeletePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ServerKeysClient) DeleteSender(req *http.Request) (future ServerKeysDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ServerKeysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -199,12 +194,12 @@ func (client ServerKeysClient) DeleteResponder(resp *http.Response) (result auto return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a server key. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. keyName is the name of the -// server key to be retrieved. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// keyName - the name of the server key to be retrieved. func (client ServerKeysClient) Get(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKey, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, keyName) if err != nil { @@ -227,7 +222,6 @@ func (client ServerKeysClient) Get(ctx context.Context, resourceGroupName string return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ServerKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -250,7 +244,6 @@ func (client ServerKeysClient) GetPreparer(ctx context.Context, resourceGroupNam return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ServerKeysClient) GetSender(req *http.Request) (*http.Response, error) { @@ -258,7 +251,6 @@ func (client ServerKeysClient) GetSender(req *http.Request) (*http.Response, err azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServerKeysClient) GetResponder(resp *http.Response) (result ServerKey, err error) { @@ -272,11 +264,11 @@ func (client ServerKeysClient) GetResponder(resp *http.Response) (result ServerK return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer gets a list of server keys. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServerKeysClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultPage, err error) { result.fn = client.listByServerNextResults req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) @@ -300,7 +292,6 @@ func (client ServerKeysClient) ListByServer(ctx context.Context, resourceGroupNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client ServerKeysClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -322,7 +313,6 @@ func (client ServerKeysClient) ListByServerPreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client ServerKeysClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -330,7 +320,6 @@ func (client ServerKeysClient) ListByServerSender(req *http.Request) (*http.Resp azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client ServerKeysClient) ListByServerResponder(resp *http.Response) (result ServerKeyListResult, err error) { @@ -365,7 +354,6 @@ func (client ServerKeysClient) listByServerNextResults(lastResults ServerKeyList return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerComplete enumerates all values, automatically crossing page boundaries as required. func (client ServerKeysClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultIterator, err error) { result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servers.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servers.go index c1316c41332c9..78d1a37f603ed 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servers.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServersClient is the the Azure SQL Database management API provides a RESTful set of web services that interact with // Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete // databases. @@ -33,22 +32,19 @@ type ServersClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServersClient creates an instance of the ServersClient client. func NewServersClient(subscriptionID string) ServersClient { return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServersClientWithBaseURI creates an instance of the ServersClient client. func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CheckNameAvailability determines whether a resource can be created with the specified name. -// -// parameters is the parameters to request for name availability. +// Parameters: +// parameters - the parameters to request for name availability. func (client ServersClient) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -78,7 +74,6 @@ func (client ServersClient) CheckNameAvailability(ctx context.Context, parameter return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. func (client ServersClient) CheckNameAvailabilityPreparer(ctx context.Context, parameters CheckNameAvailabilityRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -100,7 +95,6 @@ func (client ServersClient) CheckNameAvailabilityPreparer(ctx context.Context, p return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { @@ -108,7 +102,6 @@ func (client ServersClient) CheckNameAvailabilitySender(req *http.Request) (*htt azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always // closes the http.Response Body. func (client ServersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { @@ -122,12 +115,12 @@ func (client ServersClient) CheckNameAvailabilityResponder(resp *http.Response) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the requested -// server resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the requested server resource state. func (client ServersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (result ServersCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { @@ -144,7 +137,6 @@ func (client ServersClient) CreateOrUpdate(ctx context.Context, resourceGroupNam return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -168,23 +160,23 @@ func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resource return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) CreateOrUpdateSender(req *http.Request) (future ServersCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, err error) { @@ -198,11 +190,11 @@ func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -219,7 +211,6 @@ func (client ServersClient) Delete(ctx context.Context, resourceGroupName string return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -241,23 +232,23 @@ func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupNam return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -270,11 +261,11 @@ func (client ServersClient) DeleteResponder(resp *http.Response) (result autores return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -297,7 +288,6 @@ func (client ServersClient) Get(ctx context.Context, resourceGroupName string, s return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -319,7 +309,6 @@ func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName s return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { @@ -327,7 +316,6 @@ func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { @@ -341,7 +329,6 @@ func (client ServersClient) GetResponder(resp *http.Response) (result Server, er return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // List gets a list of all servers in the subscription. func (client ServersClient) List(ctx context.Context) (result ServerListResultPage, err error) { result.fn = client.listNextResults @@ -366,7 +353,6 @@ func (client ServersClient) List(ctx context.Context) (result ServerListResultPa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListPreparer prepares the List request. func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -386,7 +372,6 @@ func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, er return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { @@ -394,7 +379,6 @@ func (client ServersClient) ListSender(req *http.Request) (*http.Response, error azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { @@ -429,18 +413,16 @@ func (client ServersClient) listNextResults(lastResults ServerListResult) (resul return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListComplete enumerates all values, automatically crossing page boundaries as required. func (client ServersClient) ListComplete(ctx context.Context) (result ServerListResultIterator, err error) { result.page, err = client.List(ctx) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByResourceGroup gets a list of servers in a resource groups. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResultPage, err error) { result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) @@ -464,7 +446,6 @@ func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -485,7 +466,6 @@ func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { @@ -493,7 +473,6 @@ func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { @@ -528,19 +507,18 @@ func (client ServersClient) listByResourceGroupNextResults(lastResults ServerLis return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. func (client ServersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServerListResultIterator, err error) { result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Update updates a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. parameters is the requested -// server resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the requested server resource state. func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (result ServersUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { @@ -557,7 +535,6 @@ func (client ServersClient) Update(ctx context.Context, resourceGroupName string return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdatePreparer prepares the Update request. func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -581,23 +558,23 @@ func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupNam return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverusages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverusages.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverusages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverusages.go index 6aa3e2dad0068..cbf405da43a08 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serverusages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serverusages.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServerUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,23 +31,21 @@ type ServerUsagesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerUsagesClient creates an instance of the ServerUsagesClient client. func NewServerUsagesClient(subscriptionID string) ServerUsagesClient { return NewServerUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServerUsagesClientWithBaseURI creates an instance of the ServerUsagesClient client. func NewServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) ServerUsagesClient { return ServerUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer returns server usages. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServerUsagesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerUsageListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -71,7 +68,6 @@ func (client ServerUsagesClient) ListByServer(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client ServerUsagesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -93,7 +89,6 @@ func (client ServerUsagesClient) ListByServerPreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client ServerUsagesClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -101,7 +96,6 @@ func (client ServerUsagesClient) ListByServerSender(req *http.Request) (*http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client ServerUsagesClient) ListByServerResponder(resp *http.Response) (result ServerUsageListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go index b66790523cb82..9e8b92bfd3194 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceObjectivesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,22 @@ type ServiceObjectivesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServiceObjectivesClient creates an instance of the ServiceObjectivesClient client. func NewServiceObjectivesClient(subscriptionID string) ServiceObjectivesClient { return NewServiceObjectivesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServiceObjectivesClientWithBaseURI creates an instance of the ServiceObjectivesClient client. func NewServiceObjectivesClientWithBaseURI(baseURI string, subscriptionID string) ServiceObjectivesClient { return ServiceObjectivesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a database service objective. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. serviceObjectiveName is the -// name of the service objective to retrieve. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// serviceObjectiveName - the name of the service objective to retrieve. func (client ServiceObjectivesClient) Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, serviceObjectiveName) if err != nil { @@ -72,7 +69,6 @@ func (client ServiceObjectivesClient) Get(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ServiceObjectivesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -95,7 +91,6 @@ func (client ServiceObjectivesClient) GetPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ServiceObjectivesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -103,7 +98,6 @@ func (client ServiceObjectivesClient) GetSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServiceObjectivesClient) GetResponder(resp *http.Response) (result ServiceObjective, err error) { @@ -117,11 +111,11 @@ func (client ServiceObjectivesClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer returns database service objectives. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client ServiceObjectivesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) { req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) if err != nil { @@ -144,7 +138,6 @@ func (client ServiceObjectivesClient) ListByServer(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client ServiceObjectivesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -166,7 +159,6 @@ func (client ServiceObjectivesClient) ListByServerPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client ServiceObjectivesClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -174,7 +166,6 @@ func (client ServiceObjectivesClient) ListByServerSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client ServiceObjectivesClient) ListByServerResponder(resp *http.Response) (result ServiceObjectiveListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go index 55cede01c08de..0d1ee5db99ad9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ServiceTierAdvisorsClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,24 +31,23 @@ type ServiceTierAdvisorsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServiceTierAdvisorsClient creates an instance of the ServiceTierAdvisorsClient client. func NewServiceTierAdvisorsClient(subscriptionID string) ServiceTierAdvisorsClient { return NewServiceTierAdvisorsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewServiceTierAdvisorsClientWithBaseURI creates an instance of the ServiceTierAdvisorsClient client. func NewServiceTierAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) ServiceTierAdvisorsClient { return ServiceTierAdvisorsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a service tier advisor. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// database. serviceTierAdvisorName is the name of service tier advisor. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of database. +// serviceTierAdvisorName - the name of service tier advisor. func (client ServiceTierAdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result ServiceTierAdvisor, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, serviceTierAdvisorName) if err != nil { @@ -72,7 +70,6 @@ func (client ServiceTierAdvisorsClient) Get(ctx context.Context, resourceGroupNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client ServiceTierAdvisorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -96,7 +93,6 @@ func (client ServiceTierAdvisorsClient) GetPreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ServiceTierAdvisorsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -104,7 +100,6 @@ func (client ServiceTierAdvisorsClient) GetSender(req *http.Request) (*http.Resp azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServiceTierAdvisorsClient) GetResponder(resp *http.Response) (result ServiceTierAdvisor, err error) { @@ -118,12 +113,12 @@ func (client ServiceTierAdvisorsClient) GetResponder(resp *http.Response) (resul return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase returns service tier advisors for specified database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// database. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of database. func (client ServiceTierAdvisorsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ServiceTierAdvisorListResult, err error) { req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -146,7 +141,6 @@ func (client ServiceTierAdvisorsClient) ListByDatabase(ctx context.Context, reso return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client ServiceTierAdvisorsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -169,7 +163,6 @@ func (client ServiceTierAdvisorsClient) ListByDatabasePreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client ServiceTierAdvisorsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -177,7 +170,6 @@ func (client ServiceTierAdvisorsClient) ListByDatabaseSender(req *http.Request) azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client ServiceTierAdvisorsClient) ListByDatabaseResponder(resp *http.Response) (result ServiceTierAdvisorListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go similarity index 82% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go index ee985d4b99759..fb8883c25a776 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SubscriptionUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -32,23 +31,20 @@ type SubscriptionUsagesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSubscriptionUsagesClient creates an instance of the SubscriptionUsagesClient client. func NewSubscriptionUsagesClient(subscriptionID string) SubscriptionUsagesClient { return NewSubscriptionUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSubscriptionUsagesClientWithBaseURI creates an instance of the SubscriptionUsagesClient client. func NewSubscriptionUsagesClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionUsagesClient { return SubscriptionUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a subscription usage metric. -// -// locationName is the name of the region where the resource is located. usageName is name of usage metric to -// return. +// Parameters: +// locationName - the name of the region where the resource is located. +// usageName - name of usage metric to return. func (client SubscriptionUsagesClient) Get(ctx context.Context, locationName string, usageName string) (result SubscriptionUsage, err error) { req, err := client.GetPreparer(ctx, locationName, usageName) if err != nil { @@ -71,7 +67,6 @@ func (client SubscriptionUsagesClient) Get(ctx context.Context, locationName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client SubscriptionUsagesClient) GetPreparer(ctx context.Context, locationName string, usageName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -93,7 +88,6 @@ func (client SubscriptionUsagesClient) GetPreparer(ctx context.Context, location return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SubscriptionUsagesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -101,7 +95,6 @@ func (client SubscriptionUsagesClient) GetSender(req *http.Request) (*http.Respo azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client SubscriptionUsagesClient) GetResponder(resp *http.Response) (result SubscriptionUsage, err error) { @@ -115,10 +108,9 @@ func (client SubscriptionUsagesClient) GetResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocation gets all subscription usage metrics in a given location. -// -// locationName is the name of the region where the resource is located. +// Parameters: +// locationName - the name of the region where the resource is located. func (client SubscriptionUsagesClient) ListByLocation(ctx context.Context, locationName string) (result SubscriptionUsageListResultPage, err error) { result.fn = client.listByLocationNextResults req, err := client.ListByLocationPreparer(ctx, locationName) @@ -142,7 +134,6 @@ func (client SubscriptionUsagesClient) ListByLocation(ctx context.Context, locat return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocationPreparer prepares the ListByLocation request. func (client SubscriptionUsagesClient) ListByLocationPreparer(ctx context.Context, locationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -163,7 +154,6 @@ func (client SubscriptionUsagesClient) ListByLocationPreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocationSender sends the ListByLocation request. The method will close the // http.Response Body if it receives an error. func (client SubscriptionUsagesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { @@ -171,7 +161,6 @@ func (client SubscriptionUsagesClient) ListByLocationSender(req *http.Request) ( azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocationResponder handles the response to the ListByLocation request. The method always // closes the http.Response Body. func (client SubscriptionUsagesClient) ListByLocationResponder(resp *http.Response) (result SubscriptionUsageListResult, err error) { @@ -206,7 +195,6 @@ func (client SubscriptionUsagesClient) listByLocationNextResults(lastResults Sub return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. func (client SubscriptionUsagesClient) ListByLocationComplete(ctx context.Context, locationName string) (result SubscriptionUsageListResultIterator, err error) { result.page, err = client.ListByLocation(ctx, locationName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncagents.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncagents.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncagents.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncagents.go index 33b7c52467054..83be0b22baa7f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncagents.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncagents.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncAgentsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,24 +31,23 @@ type SyncAgentsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSyncAgentsClient creates an instance of the SyncAgentsClient client. func NewSyncAgentsClient(subscriptionID string) SyncAgentsClient { return NewSyncAgentsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSyncAgentsClientWithBaseURI creates an instance of the SyncAgentsClient client. func NewSyncAgentsClientWithBaseURI(baseURI string, subscriptionID string) SyncAgentsClient { return SyncAgentsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a sync agent. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server on which the sync agent is -// hosted. syncAgentName is the name of the sync agent. parameters is the requested sync agent resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server on which the sync agent is hosted. +// syncAgentName - the name of the sync agent. +// parameters - the requested sync agent resource state. func (client SyncAgentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters SyncAgent) (result SyncAgentsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, syncAgentName, parameters) if err != nil { @@ -66,7 +64,6 @@ func (client SyncAgentsClient) CreateOrUpdate(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client SyncAgentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters SyncAgent) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -91,23 +88,23 @@ func (client SyncAgentsClient) CreateOrUpdatePreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SyncAgentsClient) CreateOrUpdateSender(req *http.Request) (future SyncAgentsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client SyncAgentsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncAgent, err error) { @@ -121,12 +118,12 @@ func (client SyncAgentsClient) CreateOrUpdateResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a sync agent. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server on which the sync agent is -// hosted. syncAgentName is the name of the sync agent. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server on which the sync agent is hosted. +// syncAgentName - the name of the sync agent. func (client SyncAgentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, syncAgentName) if err != nil { @@ -143,7 +140,6 @@ func (client SyncAgentsClient) Delete(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client SyncAgentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -166,23 +162,23 @@ func (client SyncAgentsClient) DeletePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SyncAgentsClient) DeleteSender(req *http.Request) (future SyncAgentsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client SyncAgentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -195,12 +191,12 @@ func (client SyncAgentsClient) DeleteResponder(resp *http.Response) (result auto return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GenerateKey generates a sync agent key. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server on which the sync agent is -// hosted. syncAgentName is the name of the sync agent. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server on which the sync agent is hosted. +// syncAgentName - the name of the sync agent. func (client SyncAgentsClient) GenerateKey(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentKeyProperties, err error) { req, err := client.GenerateKeyPreparer(ctx, resourceGroupName, serverName, syncAgentName) if err != nil { @@ -223,7 +219,6 @@ func (client SyncAgentsClient) GenerateKey(ctx context.Context, resourceGroupNam return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GenerateKeyPreparer prepares the GenerateKey request. func (client SyncAgentsClient) GenerateKeyPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -246,7 +241,6 @@ func (client SyncAgentsClient) GenerateKeyPreparer(ctx context.Context, resource return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GenerateKeySender sends the GenerateKey request. The method will close the // http.Response Body if it receives an error. func (client SyncAgentsClient) GenerateKeySender(req *http.Request) (*http.Response, error) { @@ -254,7 +248,6 @@ func (client SyncAgentsClient) GenerateKeySender(req *http.Request) (*http.Respo azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GenerateKeyResponder handles the response to the GenerateKey request. The method always // closes the http.Response Body. func (client SyncAgentsClient) GenerateKeyResponder(resp *http.Response) (result SyncAgentKeyProperties, err error) { @@ -268,12 +261,12 @@ func (client SyncAgentsClient) GenerateKeyResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a sync agent. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server on which the sync agent is -// hosted. syncAgentName is the name of the sync agent. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server on which the sync agent is hosted. +// syncAgentName - the name of the sync agent. func (client SyncAgentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgent, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, syncAgentName) if err != nil { @@ -296,7 +289,6 @@ func (client SyncAgentsClient) Get(ctx context.Context, resourceGroupName string return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client SyncAgentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -319,7 +311,6 @@ func (client SyncAgentsClient) GetPreparer(ctx context.Context, resourceGroupNam return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SyncAgentsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -327,7 +318,6 @@ func (client SyncAgentsClient) GetSender(req *http.Request) (*http.Response, err azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client SyncAgentsClient) GetResponder(resp *http.Response) (result SyncAgent, err error) { @@ -341,12 +331,11 @@ func (client SyncAgentsClient) GetResponder(resp *http.Response) (result SyncAge return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer lists sync agents in a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server on which the sync agent is -// hosted. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server on which the sync agent is hosted. func (client SyncAgentsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result SyncAgentListResultPage, err error) { result.fn = client.listByServerNextResults req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) @@ -370,7 +359,6 @@ func (client SyncAgentsClient) ListByServer(ctx context.Context, resourceGroupNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client SyncAgentsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -392,7 +380,6 @@ func (client SyncAgentsClient) ListByServerPreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client SyncAgentsClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -400,7 +387,6 @@ func (client SyncAgentsClient) ListByServerSender(req *http.Request) (*http.Resp azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client SyncAgentsClient) ListByServerResponder(resp *http.Response) (result SyncAgentListResult, err error) { @@ -435,19 +421,18 @@ func (client SyncAgentsClient) listByServerNextResults(lastResults SyncAgentList return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncAgentsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result SyncAgentListResultIterator, err error) { result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLinkedDatabases lists databases linked to a sync agent. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server on which the sync agent is -// hosted. syncAgentName is the name of the sync agent. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server on which the sync agent is hosted. +// syncAgentName - the name of the sync agent. func (client SyncAgentsClient) ListLinkedDatabases(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentLinkedDatabaseListResultPage, err error) { result.fn = client.listLinkedDatabasesNextResults req, err := client.ListLinkedDatabasesPreparer(ctx, resourceGroupName, serverName, syncAgentName) @@ -471,7 +456,6 @@ func (client SyncAgentsClient) ListLinkedDatabases(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLinkedDatabasesPreparer prepares the ListLinkedDatabases request. func (client SyncAgentsClient) ListLinkedDatabasesPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -494,7 +478,6 @@ func (client SyncAgentsClient) ListLinkedDatabasesPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLinkedDatabasesSender sends the ListLinkedDatabases request. The method will close the // http.Response Body if it receives an error. func (client SyncAgentsClient) ListLinkedDatabasesSender(req *http.Request) (*http.Response, error) { @@ -502,7 +485,6 @@ func (client SyncAgentsClient) ListLinkedDatabasesSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLinkedDatabasesResponder handles the response to the ListLinkedDatabases request. The method always // closes the http.Response Body. func (client SyncAgentsClient) ListLinkedDatabasesResponder(resp *http.Response) (result SyncAgentLinkedDatabaseListResult, err error) { @@ -537,7 +519,6 @@ func (client SyncAgentsClient) listLinkedDatabasesNextResults(lastResults SyncAg return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLinkedDatabasesComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncAgentsClient) ListLinkedDatabasesComplete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentLinkedDatabaseListResultIterator, err error) { result.page, err = client.ListLinkedDatabases(ctx, resourceGroupName, serverName, syncAgentName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncgroups.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncgroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncgroups.go index 79dec2b508747..e1d7d22092a7f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncgroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncgroups.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,24 +31,23 @@ type SyncGroupsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSyncGroupsClient creates an instance of the SyncGroupsClient client. func NewSyncGroupsClient(subscriptionID string) SyncGroupsClient { return NewSyncGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSyncGroupsClientWithBaseURI creates an instance of the SyncGroupsClient client. func NewSyncGroupsClientWithBaseURI(baseURI string, subscriptionID string) SyncGroupsClient { return SyncGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CancelSync cancels a sync group synchronization. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. func (client SyncGroupsClient) CancelSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { req, err := client.CancelSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) if err != nil { @@ -72,7 +70,6 @@ func (client SyncGroupsClient) CancelSync(ctx context.Context, resourceGroupName return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CancelSyncPreparer prepares the CancelSync request. func (client SyncGroupsClient) CancelSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -96,7 +93,6 @@ func (client SyncGroupsClient) CancelSyncPreparer(ctx context.Context, resourceG return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CancelSyncSender sends the CancelSync request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) CancelSyncSender(req *http.Request) (*http.Response, error) { @@ -104,7 +100,6 @@ func (client SyncGroupsClient) CancelSyncSender(req *http.Request) (*http.Respon azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CancelSyncResponder handles the response to the CancelSync request. The method always // closes the http.Response Body. func (client SyncGroupsClient) CancelSyncResponder(resp *http.Response) (result autorest.Response, err error) { @@ -117,13 +112,14 @@ func (client SyncGroupsClient) CancelSyncResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a sync group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. parameters is the -// requested sync group resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. +// parameters - the requested sync group resource state. func (client SyncGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) if err != nil { @@ -140,7 +136,6 @@ func (client SyncGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client SyncGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -166,23 +161,23 @@ func (client SyncGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) CreateOrUpdateSender(req *http.Request) (future SyncGroupsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client SyncGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncGroup, err error) { @@ -196,12 +191,13 @@ func (client SyncGroupsClient) CreateOrUpdateResponder(resp *http.Response) (res return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a sync group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. func (client SyncGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) if err != nil { @@ -218,7 +214,6 @@ func (client SyncGroupsClient) Delete(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client SyncGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -242,23 +237,23 @@ func (client SyncGroupsClient) DeletePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) DeleteSender(req *http.Request) (future SyncGroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client SyncGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -271,12 +266,13 @@ func (client SyncGroupsClient) DeleteResponder(resp *http.Response) (result auto return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a sync group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. func (client SyncGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroup, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) if err != nil { @@ -299,7 +295,6 @@ func (client SyncGroupsClient) Get(ctx context.Context, resourceGroupName string return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client SyncGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -323,7 +318,6 @@ func (client SyncGroupsClient) GetPreparer(ctx context.Context, resourceGroupNam return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -331,7 +325,6 @@ func (client SyncGroupsClient) GetSender(req *http.Request) (*http.Response, err azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client SyncGroupsClient) GetResponder(resp *http.Response) (result SyncGroup, err error) { @@ -345,12 +338,12 @@ func (client SyncGroupsClient) GetResponder(resp *http.Response) (result SyncGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabase lists sync groups under a hub database. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. func (client SyncGroupsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultPage, err error) { result.fn = client.listByDatabaseNextResults req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) @@ -374,7 +367,6 @@ func (client SyncGroupsClient) ListByDatabase(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabasePreparer prepares the ListByDatabase request. func (client SyncGroupsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -397,7 +389,6 @@ func (client SyncGroupsClient) ListByDatabasePreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { @@ -405,7 +396,6 @@ func (client SyncGroupsClient) ListByDatabaseSender(req *http.Request) (*http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. func (client SyncGroupsClient) ListByDatabaseResponder(resp *http.Response) (result SyncGroupListResult, err error) { @@ -440,19 +430,19 @@ func (client SyncGroupsClient) listByDatabaseNextResults(lastResults SyncGroupLi return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncGroupsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultIterator, err error) { result.page, err = client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListHubSchemas gets a collection of hub database schemas. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. func (client SyncGroupsClient) ListHubSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultPage, err error) { result.fn = client.listHubSchemasNextResults req, err := client.ListHubSchemasPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) @@ -476,7 +466,6 @@ func (client SyncGroupsClient) ListHubSchemas(ctx context.Context, resourceGroup return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListHubSchemasPreparer prepares the ListHubSchemas request. func (client SyncGroupsClient) ListHubSchemasPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -500,7 +489,6 @@ func (client SyncGroupsClient) ListHubSchemasPreparer(ctx context.Context, resou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListHubSchemasSender sends the ListHubSchemas request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) ListHubSchemasSender(req *http.Request) (*http.Response, error) { @@ -508,7 +496,6 @@ func (client SyncGroupsClient) ListHubSchemasSender(req *http.Request) (*http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListHubSchemasResponder handles the response to the ListHubSchemas request. The method always // closes the http.Response Body. func (client SyncGroupsClient) ListHubSchemasResponder(resp *http.Response) (result SyncFullSchemaPropertiesListResult, err error) { @@ -543,21 +530,23 @@ func (client SyncGroupsClient) listHubSchemasNextResults(lastResults SyncFullSch return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListHubSchemasComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncGroupsClient) ListHubSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultIterator, err error) { result.page, err = client.ListHubSchemas(ctx, resourceGroupName, serverName, databaseName, syncGroupName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLogs gets a collection of sync group logs. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. startTime is get -// logs generated after this time. endTime is get logs generated before this time. typeParameter is the types of -// logs to retrieve. continuationToken is the continuation token for this operation. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. +// startTime - get logs generated after this time. +// endTime - get logs generated before this time. +// typeParameter - the types of logs to retrieve. +// continuationToken - the continuation token for this operation. func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultPage, err error) { result.fn = client.listLogsNextResults req, err := client.ListLogsPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) @@ -581,7 +570,6 @@ func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName s return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLogsPreparer prepares the ListLogs request. func (client SyncGroupsClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -611,7 +599,6 @@ func (client SyncGroupsClient) ListLogsPreparer(ctx context.Context, resourceGro return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLogsSender sends the ListLogs request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) ListLogsSender(req *http.Request) (*http.Response, error) { @@ -619,7 +606,6 @@ func (client SyncGroupsClient) ListLogsSender(req *http.Request) (*http.Response azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLogsResponder handles the response to the ListLogs request. The method always // closes the http.Response Body. func (client SyncGroupsClient) ListLogsResponder(resp *http.Response) (result SyncGroupLogListResult, err error) { @@ -654,17 +640,15 @@ func (client SyncGroupsClient) listLogsNextResults(lastResults SyncGroupLogListR return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListLogsComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncGroupsClient) ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultIterator, err error) { result.page, err = client.ListLogs(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListSyncDatabaseIds gets a collection of sync database ids. -// -// locationName is the name of the region where the resource is located. +// Parameters: +// locationName - the name of the region where the resource is located. func (client SyncGroupsClient) ListSyncDatabaseIds(ctx context.Context, locationName string) (result SyncDatabaseIDListResultPage, err error) { result.fn = client.listSyncDatabaseIdsNextResults req, err := client.ListSyncDatabaseIdsPreparer(ctx, locationName) @@ -688,7 +672,6 @@ func (client SyncGroupsClient) ListSyncDatabaseIds(ctx context.Context, location return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListSyncDatabaseIdsPreparer prepares the ListSyncDatabaseIds request. func (client SyncGroupsClient) ListSyncDatabaseIdsPreparer(ctx context.Context, locationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -709,7 +692,6 @@ func (client SyncGroupsClient) ListSyncDatabaseIdsPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListSyncDatabaseIdsSender sends the ListSyncDatabaseIds request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) ListSyncDatabaseIdsSender(req *http.Request) (*http.Response, error) { @@ -717,7 +699,6 @@ func (client SyncGroupsClient) ListSyncDatabaseIdsSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListSyncDatabaseIdsResponder handles the response to the ListSyncDatabaseIds request. The method always // closes the http.Response Body. func (client SyncGroupsClient) ListSyncDatabaseIdsResponder(resp *http.Response) (result SyncDatabaseIDListResult, err error) { @@ -752,19 +733,19 @@ func (client SyncGroupsClient) listSyncDatabaseIdsNextResults(lastResults SyncDa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListSyncDatabaseIdsComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncGroupsClient) ListSyncDatabaseIdsComplete(ctx context.Context, locationName string) (result SyncDatabaseIDListResultIterator, err error) { result.page, err = client.ListSyncDatabaseIds(ctx, locationName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshHubSchema refreshes a hub database schema. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. func (client SyncGroupsClient) RefreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsRefreshHubSchemaFuture, err error) { req, err := client.RefreshHubSchemaPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) if err != nil { @@ -781,7 +762,6 @@ func (client SyncGroupsClient) RefreshHubSchema(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshHubSchemaPreparer prepares the RefreshHubSchema request. func (client SyncGroupsClient) RefreshHubSchemaPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -805,23 +785,23 @@ func (client SyncGroupsClient) RefreshHubSchemaPreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshHubSchemaSender sends the RefreshHubSchema request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) RefreshHubSchemaSender(req *http.Request) (future SyncGroupsRefreshHubSchemaFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshHubSchemaResponder handles the response to the RefreshHubSchema request. The method always // closes the http.Response Body. func (client SyncGroupsClient) RefreshHubSchemaResponder(resp *http.Response) (result autorest.Response, err error) { @@ -834,12 +814,13 @@ func (client SyncGroupsClient) RefreshHubSchemaResponder(resp *http.Response) (r return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TriggerSync triggers a sync group synchronization. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. func (client SyncGroupsClient) TriggerSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { req, err := client.TriggerSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) if err != nil { @@ -862,7 +843,6 @@ func (client SyncGroupsClient) TriggerSync(ctx context.Context, resourceGroupNam return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TriggerSyncPreparer prepares the TriggerSync request. func (client SyncGroupsClient) TriggerSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -886,7 +866,6 @@ func (client SyncGroupsClient) TriggerSyncPreparer(ctx context.Context, resource return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TriggerSyncSender sends the TriggerSync request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) TriggerSyncSender(req *http.Request) (*http.Response, error) { @@ -894,7 +873,6 @@ func (client SyncGroupsClient) TriggerSyncSender(req *http.Request) (*http.Respo azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TriggerSyncResponder handles the response to the TriggerSync request. The method always // closes the http.Response Body. func (client SyncGroupsClient) TriggerSyncResponder(resp *http.Response) (result autorest.Response, err error) { @@ -907,13 +885,14 @@ func (client SyncGroupsClient) TriggerSyncResponder(resp *http.Response) (result return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Update updates a sync group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. parameters is the -// requested sync group resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. +// parameters - the requested sync group resource state. func (client SyncGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) if err != nil { @@ -930,7 +909,6 @@ func (client SyncGroupsClient) Update(ctx context.Context, resourceGroupName str return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdatePreparer prepares the Update request. func (client SyncGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -956,23 +934,23 @@ func (client SyncGroupsClient) UpdatePreparer(ctx context.Context, resourceGroup return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client SyncGroupsClient) UpdateSender(req *http.Request) (future SyncGroupsUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client SyncGroupsClient) UpdateResponder(resp *http.Response) (result SyncGroup, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncmembers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncmembers.go similarity index 75% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncmembers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncmembers.go index 9b29ee128362d..28c36fba46d2b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/syncmembers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/syncmembers.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // SyncMembersClient is the the Azure SQL Database management API provides a RESTful set of web services that interact // with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and // delete databases. @@ -32,26 +31,25 @@ type SyncMembersClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSyncMembersClient creates an instance of the SyncMembersClient client. func NewSyncMembersClient(subscriptionID string) SyncMembersClient { return NewSyncMembersClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewSyncMembersClientWithBaseURI creates an instance of the SyncMembersClient client. func NewSyncMembersClientWithBaseURI(baseURI string, subscriptionID string) SyncMembersClient { return SyncMembersClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a sync member. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group on which the sync -// member is hosted. syncMemberName is the name of the sync member. parameters is the requested sync member -// resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group on which the sync member is hosted. +// syncMemberName - the name of the sync member. +// parameters - the requested sync member resource state. func (client SyncMembersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (result SyncMembersCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) if err != nil { @@ -68,7 +66,6 @@ func (client SyncMembersClient) CreateOrUpdate(ctx context.Context, resourceGrou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client SyncMembersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -95,23 +92,23 @@ func (client SyncMembersClient) CreateOrUpdatePreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SyncMembersClient) CreateOrUpdateSender(req *http.Request) (future SyncMembersCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client SyncMembersClient) CreateOrUpdateResponder(resp *http.Response) (result SyncMember, err error) { @@ -125,13 +122,14 @@ func (client SyncMembersClient) CreateOrUpdateResponder(resp *http.Response) (re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes a sync member. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group on which the sync -// member is hosted. syncMemberName is the name of the sync member. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group on which the sync member is hosted. +// syncMemberName - the name of the sync member. func (client SyncMembersClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMembersDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) if err != nil { @@ -148,7 +146,6 @@ func (client SyncMembersClient) Delete(ctx context.Context, resourceGroupName st return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client SyncMembersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -173,23 +170,23 @@ func (client SyncMembersClient) DeletePreparer(ctx context.Context, resourceGrou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SyncMembersClient) DeleteSender(req *http.Request) (future SyncMembersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client SyncMembersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -202,13 +199,14 @@ func (client SyncMembersClient) DeleteResponder(resp *http.Response) (result aut return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a sync member. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group on which the sync -// member is hosted. syncMemberName is the name of the sync member. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group on which the sync member is hosted. +// syncMemberName - the name of the sync member. func (client SyncMembersClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMember, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) if err != nil { @@ -231,7 +229,6 @@ func (client SyncMembersClient) Get(ctx context.Context, resourceGroupName strin return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client SyncMembersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -256,7 +253,6 @@ func (client SyncMembersClient) GetPreparer(ctx context.Context, resourceGroupNa return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SyncMembersClient) GetSender(req *http.Request) (*http.Response, error) { @@ -264,7 +260,6 @@ func (client SyncMembersClient) GetSender(req *http.Request) (*http.Response, er azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client SyncMembersClient) GetResponder(resp *http.Response) (result SyncMember, err error) { @@ -278,12 +273,13 @@ func (client SyncMembersClient) GetResponder(resp *http.Response) (result SyncMe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListBySyncGroup lists sync members in the given sync group. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group. func (client SyncMembersClient) ListBySyncGroup(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncMemberListResultPage, err error) { result.fn = client.listBySyncGroupNextResults req, err := client.ListBySyncGroupPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) @@ -307,7 +303,6 @@ func (client SyncMembersClient) ListBySyncGroup(ctx context.Context, resourceGro return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListBySyncGroupPreparer prepares the ListBySyncGroup request. func (client SyncMembersClient) ListBySyncGroupPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -331,7 +326,6 @@ func (client SyncMembersClient) ListBySyncGroupPreparer(ctx context.Context, res return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListBySyncGroupSender sends the ListBySyncGroup request. The method will close the // http.Response Body if it receives an error. func (client SyncMembersClient) ListBySyncGroupSender(req *http.Request) (*http.Response, error) { @@ -339,7 +333,6 @@ func (client SyncMembersClient) ListBySyncGroupSender(req *http.Request) (*http. azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListBySyncGroupResponder handles the response to the ListBySyncGroup request. The method always // closes the http.Response Body. func (client SyncMembersClient) ListBySyncGroupResponder(resp *http.Response) (result SyncMemberListResult, err error) { @@ -374,20 +367,20 @@ func (client SyncMembersClient) listBySyncGroupNextResults(lastResults SyncMembe return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListBySyncGroupComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncMembersClient) ListBySyncGroupComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncMemberListResultIterator, err error) { result.page, err = client.ListBySyncGroup(ctx, resourceGroupName, serverName, databaseName, syncGroupName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMemberSchemas gets a sync member database schema. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group on which the sync -// member is hosted. syncMemberName is the name of the sync member. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group on which the sync member is hosted. +// syncMemberName - the name of the sync member. func (client SyncMembersClient) ListMemberSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncFullSchemaPropertiesListResultPage, err error) { result.fn = client.listMemberSchemasNextResults req, err := client.ListMemberSchemasPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) @@ -411,7 +404,6 @@ func (client SyncMembersClient) ListMemberSchemas(ctx context.Context, resourceG return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMemberSchemasPreparer prepares the ListMemberSchemas request. func (client SyncMembersClient) ListMemberSchemasPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -436,7 +428,6 @@ func (client SyncMembersClient) ListMemberSchemasPreparer(ctx context.Context, r return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMemberSchemasSender sends the ListMemberSchemas request. The method will close the // http.Response Body if it receives an error. func (client SyncMembersClient) ListMemberSchemasSender(req *http.Request) (*http.Response, error) { @@ -444,7 +435,6 @@ func (client SyncMembersClient) ListMemberSchemasSender(req *http.Request) (*htt azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMemberSchemasResponder handles the response to the ListMemberSchemas request. The method always // closes the http.Response Body. func (client SyncMembersClient) ListMemberSchemasResponder(resp *http.Response) (result SyncFullSchemaPropertiesListResult, err error) { @@ -479,20 +469,20 @@ func (client SyncMembersClient) listMemberSchemasNextResults(lastResults SyncFul return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListMemberSchemasComplete enumerates all values, automatically crossing page boundaries as required. func (client SyncMembersClient) ListMemberSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncFullSchemaPropertiesListResultIterator, err error) { result.page, err = client.ListMemberSchemas(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshMemberSchema refreshes a sync member database schema. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group on which the sync -// member is hosted. syncMemberName is the name of the sync member. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group on which the sync member is hosted. +// syncMemberName - the name of the sync member. func (client SyncMembersClient) RefreshMemberSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMembersRefreshMemberSchemaFuture, err error) { req, err := client.RefreshMemberSchemaPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) if err != nil { @@ -509,7 +499,6 @@ func (client SyncMembersClient) RefreshMemberSchema(ctx context.Context, resourc return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshMemberSchemaPreparer prepares the RefreshMemberSchema request. func (client SyncMembersClient) RefreshMemberSchemaPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -534,23 +523,23 @@ func (client SyncMembersClient) RefreshMemberSchemaPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshMemberSchemaSender sends the RefreshMemberSchema request. The method will close the // http.Response Body if it receives an error. func (client SyncMembersClient) RefreshMemberSchemaSender(req *http.Request) (future SyncMembersRefreshMemberSchemaFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // RefreshMemberSchemaResponder handles the response to the RefreshMemberSchema request. The method always // closes the http.Response Body. func (client SyncMembersClient) RefreshMemberSchemaResponder(resp *http.Response) (result autorest.Response, err error) { @@ -563,14 +552,15 @@ func (client SyncMembersClient) RefreshMemberSchemaResponder(resp *http.Response return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Update updates an existing sync member. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database on which the sync group is hosted. syncGroupName is the name of the sync group on which the sync -// member is hosted. syncMemberName is the name of the sync member. parameters is the requested sync member -// resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database on which the sync group is hosted. +// syncGroupName - the name of the sync group on which the sync member is hosted. +// syncMemberName - the name of the sync member. +// parameters - the requested sync member resource state. func (client SyncMembersClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (result SyncMembersUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) if err != nil { @@ -587,7 +577,6 @@ func (client SyncMembersClient) Update(ctx context.Context, resourceGroupName st return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdatePreparer prepares the Update request. func (client SyncMembersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -614,23 +603,23 @@ func (client SyncMembersClient) UpdatePreparer(ctx context.Context, resourceGrou return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client SyncMembersClient) UpdateSender(req *http.Request) (future SyncMembersUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client SyncMembersClient) UpdateResponder(resp *http.Response) (result SyncMember, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go index d39006a3f60c9..2991d1317a394 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web // services that interact with Azure SQL Database services to manage your databases. The API enables you to create, // retrieve, update, and delete databases. @@ -32,26 +31,24 @@ type TransparentDataEncryptionActivitiesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewTransparentDataEncryptionActivitiesClient creates an instance of the TransparentDataEncryptionActivitiesClient // client. func NewTransparentDataEncryptionActivitiesClient(subscriptionID string) TransparentDataEncryptionActivitiesClient { return NewTransparentDataEncryptionActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewTransparentDataEncryptionActivitiesClientWithBaseURI creates an instance of the // TransparentDataEncryptionActivitiesClient client. func NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionActivitiesClient { return TransparentDataEncryptionActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByConfiguration returns a database's transparent data encryption operation result. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database for which the transparent data encryption applies. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database for which the transparent data encryption applies. func (client TransparentDataEncryptionActivitiesClient) ListByConfiguration(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) { req, err := client.ListByConfigurationPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -74,7 +71,6 @@ func (client TransparentDataEncryptionActivitiesClient) ListByConfiguration(ctx return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByConfigurationPreparer prepares the ListByConfiguration request. func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -98,7 +94,6 @@ func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationPrepa return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByConfigurationSender sends the ListByConfiguration request. The method will close the // http.Response Body if it receives an error. func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationSender(req *http.Request) (*http.Response, error) { @@ -106,7 +101,6 @@ func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationSende azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByConfigurationResponder handles the response to the ListByConfiguration request. The method always // closes the http.Response Body. func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationResponder(resp *http.Response) (result TransparentDataEncryptionActivityListResult, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go similarity index 79% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go index 8e6448c757342..c98d59a946259 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go @@ -24,7 +24,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // TransparentDataEncryptionsClient is the the Azure SQL Database management API provides a RESTful set of web services // that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, // update, and delete databases. @@ -32,25 +31,23 @@ type TransparentDataEncryptionsClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewTransparentDataEncryptionsClient creates an instance of the TransparentDataEncryptionsClient client. func NewTransparentDataEncryptionsClient(subscriptionID string) TransparentDataEncryptionsClient { return NewTransparentDataEncryptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewTransparentDataEncryptionsClientWithBaseURI creates an instance of the TransparentDataEncryptionsClient client. func NewTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionsClient { return TransparentDataEncryptionsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates a database's transparent data encryption configuration. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database for which setting the transparent data encryption applies. parameters is the required parameters -// for creating or updating transparent data encryption. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database for which setting the transparent data encryption applies. +// parameters - the required parameters for creating or updating transparent data encryption. func (client TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -73,7 +70,6 @@ func (client TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Contex return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client TransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -99,7 +95,6 @@ func (client TransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client TransparentDataEncryptionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { @@ -107,7 +102,6 @@ func (client TransparentDataEncryptionsClient) CreateOrUpdateSender(req *http.Re azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client TransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *http.Response) (result TransparentDataEncryption, err error) { @@ -121,12 +115,12 @@ func (client TransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *htt return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a database's transparent data encryption configuration. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. databaseName is the name of -// the database for which the transparent data encryption applies. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database for which the transparent data encryption applies. func (client TransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { @@ -149,7 +143,6 @@ func (client TransparentDataEncryptionsClient) Get(ctx context.Context, resource return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client TransparentDataEncryptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -173,7 +166,6 @@ func (client TransparentDataEncryptionsClient) GetPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client TransparentDataEncryptionsClient) GetSender(req *http.Request) (*http.Response, error) { @@ -181,7 +173,6 @@ func (client TransparentDataEncryptionsClient) GetSender(req *http.Request) (*ht azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client TransparentDataEncryptionsClient) GetResponder(resp *http.Response) (result TransparentDataEncryption, err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/version.go new file mode 100644 index 0000000000000..21b61983166ea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/version.go @@ -0,0 +1,30 @@ +package sql + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// 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.Number + " sql/2015-05-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/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go index 172f2b3a90b8a..957b02b25a480 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go @@ -25,7 +25,6 @@ import ( "net/http" ) -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // VirtualNetworkRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that // interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, // and delete databases. @@ -33,24 +32,23 @@ type VirtualNetworkRulesClient struct { BaseClient } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient client. func NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdate creates or updates an existing virtual network rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. virtualNetworkRuleName is -// the name of the virtual network rule. parameters is the requested virtual Network Rule Resource state. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. +// parameters - the requested virtual Network Rule Resource state. func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -74,7 +72,6 @@ func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, reso return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -99,23 +96,23 @@ func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, err error) { @@ -129,12 +126,12 @@ func (client VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Respo return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Delete deletes the virtual network rule with the given name. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. virtualNetworkRuleName is -// the name of the virtual network rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) if err != nil { @@ -151,7 +148,6 @@ func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGrou return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeletePreparer prepares the Delete request. func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -174,23 +170,23 @@ func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client VirtualNetworkRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { @@ -203,12 +199,12 @@ func (client VirtualNetworkRulesClient) DeleteResponder(resp *http.Response) (re return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // Get gets a virtual network rule. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. virtualNetworkRuleName is -// the name of the virtual network rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// virtualNetworkRuleName - the name of the virtual network rule. func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) if err != nil { @@ -231,7 +227,6 @@ func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupNa return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetPreparer prepares the Get request. func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -254,7 +249,6 @@ func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourc return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkRulesClient) GetSender(req *http.Request) (*http.Response, error) { @@ -262,7 +256,6 @@ func (client VirtualNetworkRulesClient) GetSender(req *http.Request) (*http.Resp azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { @@ -276,11 +269,11 @@ func (client VirtualNetworkRulesClient) GetResponder(resp *http.Response) (resul return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServer gets a list of virtual network rules in a server. -// -// resourceGroupName is the name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. serverName is the name of the server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { result.fn = client.listByServerNextResults req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) @@ -304,7 +297,6 @@ func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resour return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerPreparer prepares the ListByServer request. func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ @@ -326,7 +318,6 @@ func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { @@ -334,7 +325,6 @@ func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (* azure.DoRetryWithRegistration(client.Client)) } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { @@ -369,7 +359,6 @@ func (client VirtualNetworkRulesClient) listByServerNextResults(lastResults Virt return } -// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql instead. // ListByServerComplete enumerates all values, automatically crossing page boundaries as required. func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/linkedserver.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/linkedserver.go index 393872ad30ada..efef2fad0daf2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/linkedserver.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/linkedserver.go @@ -98,15 +98,17 @@ func (client LinkedServerClient) CreatePreparer(ctx context.Context, resourceGro // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/models.go index 4e10cd26d9fa0..0dbe32832c461 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/models.go @@ -241,12 +241,11 @@ func (cp CommonProperties) MarshalJSON() ([]byte, error) { // CreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type CreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future CreateFuture) Result(client Client) (rt ResourceType, err error) { +func (future *CreateFuture) Result(client Client) (rt ResourceType, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -254,34 +253,15 @@ func (future CreateFuture) Result(client Client) (rt ResourceType, err error) { return } if !done { - return rt, azure.NewAsyncOpIncompleteError("redis.CreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rt, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("redis.CreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", rt.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", resp, "Failure sending request") - return - } - rt, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", resp, "Failure responding to request") } return } @@ -420,12 +400,11 @@ func (cp CreateProperties) MarshalJSON() ([]byte, error) { // DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeleteFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *DeleteFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -433,47 +412,21 @@ func (future DeleteFuture) Result(client Client) (ar autorest.Response, err erro return } if !done { - return ar, azure.NewAsyncOpIncompleteError("redis.DeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.DeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("redis.DeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.DeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.DeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // ExportDataFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ExportDataFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExportDataFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *ExportDataFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -481,35 +434,10 @@ func (future ExportDataFuture) Result(client Client) (ar autorest.Response, err return } if !done { - return ar, azure.NewAsyncOpIncompleteError("redis.ExportDataFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.ExportDataResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ExportDataFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("redis.ExportDataFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ExportDataFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.ExportDataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ExportDataFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -765,12 +693,11 @@ type ForceRebootResponse struct { // ImportDataFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ImportDataFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ImportDataFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *ImportDataFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -778,35 +705,10 @@ func (future ImportDataFuture) Result(client Client) (ar autorest.Response, err return } if !done { - return ar, azure.NewAsyncOpIncompleteError("redis.ImportDataFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.ImportDataResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ImportDataFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ImportDataFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("redis.ImportDataFuture") return } - ar, err = client.ImportDataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ImportDataFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -827,12 +729,11 @@ type LinkedServer struct { // LinkedServerCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type LinkedServerCreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LinkedServerCreateFuture) Result(client LinkedServerClient) (lswp LinkedServerWithProperties, err error) { +func (future *LinkedServerCreateFuture) Result(client LinkedServerClient) (lswp LinkedServerWithProperties, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -840,34 +741,15 @@ func (future LinkedServerCreateFuture) Result(client LinkedServerClient) (lswp L return } if !done { - return lswp, azure.NewAsyncOpIncompleteError("redis.LinkedServerCreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lswp, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("redis.LinkedServerCreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", lswp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", resp, "Failure sending request") - return - } - lswp, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/redis.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/redis.go index f92814c2b1782..6f7d7a63e4d82 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/redis.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis/redis.go @@ -174,15 +174,17 @@ func (client Client) CreatePreparer(ctx context.Context, resourceGroupName strin // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -243,15 +245,17 @@ func (client Client) DeletePreparer(ctx context.Context, resourceGroupName strin // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -321,15 +325,17 @@ func (client Client) ExportDataPreparer(ctx context.Context, resourceGroupName s // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -536,15 +542,17 @@ func (client Client) ImportDataPreparer(ctx context.Context, resourceGroupName s // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/models.go index fc6eb79269b42..5a775156f0682 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/models.go @@ -805,12 +805,11 @@ type NamespaceProperties struct { // operation. type NamespacesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (n Namespace, err error) { +func (future *NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (n Namespace, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -818,34 +817,15 @@ func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (n return } if !done { - return n, azure.NewAsyncOpIncompleteError("relay.NamespacesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - n, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("relay.NamespacesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if n.Response.Response, err = future.GetResult(sender); err == nil && n.Response.Response.StatusCode != http.StatusNoContent { + n, err = client.CreateOrUpdateResponder(n.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "relay.NamespacesCreateOrUpdateFuture", "Result", n.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - n, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -853,12 +833,11 @@ func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (n // NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type NamespacesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { +func (future *NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -866,35 +845,10 @@ func (future NamespacesDeleteFuture) Result(client NamespacesClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("relay.NamespacesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("relay.NamespacesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/namespaces.go index f1dd78a83e272..25b1b98db90f4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/namespaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay/namespaces.go @@ -172,15 +172,17 @@ func (client NamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resou // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (future NamespacesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -340,15 +342,17 @@ func (client NamespacesClient) DeletePreparer(ctx context.Context, resourceGroup // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client NamespacesClient) DeleteSender(req *http.Request) (future NamespacesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/deployments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/deployments.go index df1779aff929b..d27a542c0f748 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/deployments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/deployments.go @@ -266,15 +266,17 @@ func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, reso // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -354,15 +356,17 @@ func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGrou // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/groups.go index ad361bc9d3c20..012de7818c653 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/groups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/groups.go @@ -241,15 +241,17 @@ func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client GroupsClient) DeleteSender(req *http.Request) (future GroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/models.go index 9e3263cf8ddc0..691edfa3597e6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/models.go @@ -83,12 +83,11 @@ type BasicDependency struct { // CreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. type CreateOrUpdateByIDFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { +func (future *CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -96,34 +95,15 @@ func (future CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateByIDFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.CreateOrUpdateByIDResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateByIDFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateByIDResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.CreateOrUpdateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", resp, "Failure responding to request") } return } @@ -131,12 +111,11 @@ func (future CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource // CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type CreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future CreateOrUpdateFuture) Result(client Client) (gr GenericResource, err error) { +func (future *CreateOrUpdateFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -144,34 +123,15 @@ func (future CreateOrUpdateFuture) Result(client Client) (gr GenericResource, er return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -185,12 +145,11 @@ type DebugSetting struct { // DeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeleteByIDFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeleteByIDFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *DeleteByIDFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -198,47 +157,21 @@ func (future DeleteByIDFuture) Result(client Client) (ar autorest.Response, err return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.DeleteByIDFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteByIDResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.DeleteByIDFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeleteFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *DeleteFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -246,35 +179,10 @@ func (future DeleteFuture) Result(client Client) (ar autorest.Response, err erro return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.DeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.DeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -603,12 +511,11 @@ type DeploymentPropertiesExtended struct { // operation. type DeploymentsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) (de DeploymentExtended, err error) { +func (future *DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) (de DeploymentExtended, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -616,34 +523,15 @@ func (future DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) ( return } if !done { - return de, azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - de, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateResponder(de.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - de, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -651,12 +539,11 @@ func (future DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) ( // DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeploymentsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { +func (future *DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -664,35 +551,10 @@ func (future DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autor return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -984,12 +846,11 @@ type GroupProperties struct { // GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type GroupsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Response, err error) { +func (future *GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -997,35 +858,10 @@ func (future GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Respon return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -1170,12 +1006,11 @@ type MoveInfo struct { // MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running operation. type MoveResourcesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future MoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *MoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1183,35 +1018,10 @@ func (future MoveResourcesFuture) Result(client Client) (ar autorest.Response, e return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.MoveResourcesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.MoveResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -1613,12 +1423,11 @@ type TemplateLink struct { // UpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. type UpdateByIDFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future UpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { +func (future *UpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1626,34 +1435,15 @@ func (future UpdateByIDFuture) Result(client Client) (gr GenericResource, err er return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.UpdateByIDResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.UpdateByIDResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.UpdateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", resp, "Failure responding to request") } return } @@ -1661,12 +1451,11 @@ func (future UpdateByIDFuture) Result(client Client) (gr GenericResource, err er // UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type UpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future UpdateFuture) Result(client Client) (gr GenericResource, err error) { +func (future *UpdateFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1674,34 +1463,15 @@ func (future UpdateFuture) Result(client Client) (gr GenericResource, err error) return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.UpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.UpdateResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1710,12 +1480,11 @@ func (future UpdateFuture) Result(client Client) (gr GenericResource, err error) // operation. type ValidateMoveResourcesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ValidateMoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *ValidateMoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1723,34 +1492,9 @@ func (future ValidateMoveResourcesFuture) Result(client Client) (ar autorest.Res return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.ValidateMoveResourcesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.ValidateMoveResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/resources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/resources.go index 5ea79e2684d37..bd8987cf1f649 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/resources.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources/resources.go @@ -250,15 +250,17 @@ func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupNa // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -328,15 +330,17 @@ func (client Client) CreateOrUpdateByIDPreparer(ctx context.Context, resourceID // CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the // http.Response Body if it receives an error. func (client Client) CreateOrUpdateByIDSender(req *http.Request) (future CreateOrUpdateByIDFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -412,15 +416,17 @@ func (client Client) DeletePreparer(ctx context.Context, resourceGroupName strin // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -479,15 +485,17 @@ func (client Client) DeleteByIDPreparer(ctx context.Context, resourceID string) // DeleteByIDSender sends the DeleteByID request. The method will close the // http.Response Body if it receives an error. func (client Client) DeleteByIDSender(req *http.Request) (future DeleteByIDFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -922,15 +930,17 @@ func (client Client) MoveResourcesPreparer(ctx context.Context, sourceResourceGr // MoveResourcesSender sends the MoveResources request. The method will close the // http.Response Body if it receives an error. func (client Client) MoveResourcesSender(req *http.Request) (future MoveResourcesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1007,15 +1017,17 @@ func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName strin // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1078,15 +1090,17 @@ func (client Client) UpdateByIDPreparer(ctx context.Context, resourceID string, // UpdateByIDSender sends the UpdateByID request. The method will close the // http.Response Body if it receives an error. func (client Client) UpdateByIDSender(req *http.Request) (future UpdateByIDFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1160,15 +1174,17 @@ func (client Client) ValidateMoveResourcesPreparer(ctx context.Context, sourceRe // ValidateMoveResourcesSender sends the ValidateMoveResources request. The method will close the // http.Response Body if it receives an error. func (client Client) ValidateMoveResourcesSender(req *http.Request) (future ValidateMoveResourcesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusConflict)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusConflict)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/jobcollections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/jobcollections.go index 70ea9c497f393..69420001a33d3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/jobcollections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/jobcollections.go @@ -153,15 +153,17 @@ func (client JobCollectionsClient) DeletePreparer(ctx context.Context, resourceG // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client JobCollectionsClient) DeleteSender(req *http.Request) (future JobCollectionsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -221,15 +223,17 @@ func (client JobCollectionsClient) DisablePreparer(ctx context.Context, resource // DisableSender sends the Disable request. The method will close the // http.Response Body if it receives an error. func (client JobCollectionsClient) DisableSender(req *http.Request) (future JobCollectionsDisableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -289,15 +293,17 @@ func (client JobCollectionsClient) EnablePreparer(ctx context.Context, resourceG // EnableSender sends the Enable request. The method will close the // http.Response Body if it receives an error. func (client JobCollectionsClient) EnableSender(req *http.Request) (future JobCollectionsEnableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/models.go index 05df9ac07583c..cdbaa23e2b605 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler/models.go @@ -760,12 +760,11 @@ type JobCollectionQuota struct { // JobCollectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type JobCollectionsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future JobCollectionsDeleteFuture) Result(client JobCollectionsClient) (ar autorest.Response, err error) { +func (future *JobCollectionsDeleteFuture) Result(client JobCollectionsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -773,35 +772,10 @@ func (future JobCollectionsDeleteFuture) Result(client JobCollectionsClient) (ar return } if !done { - return ar, azure.NewAsyncOpIncompleteError("scheduler.JobCollectionsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("scheduler.JobCollectionsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -809,12 +783,11 @@ func (future JobCollectionsDeleteFuture) Result(client JobCollectionsClient) (ar // operation. type JobCollectionsDisableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future JobCollectionsDisableFuture) Result(client JobCollectionsClient) (ar autorest.Response, err error) { +func (future *JobCollectionsDisableFuture) Result(client JobCollectionsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -822,47 +795,21 @@ func (future JobCollectionsDisableFuture) Result(client JobCollectionsClient) (a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("scheduler.JobCollectionsDisableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DisableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsDisableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("scheduler.JobCollectionsDisableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsDisableFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DisableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsDisableFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // JobCollectionsEnableFuture an abstraction for monitoring and retrieving the results of a long-running operation. type JobCollectionsEnableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future JobCollectionsEnableFuture) Result(client JobCollectionsClient) (ar autorest.Response, err error) { +func (future *JobCollectionsEnableFuture) Result(client JobCollectionsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -870,35 +817,10 @@ func (future JobCollectionsEnableFuture) Result(client JobCollectionsClient) (ar return } if !done { - return ar, azure.NewAsyncOpIncompleteError("scheduler.JobCollectionsEnableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.EnableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsEnableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("scheduler.JobCollectionsEnableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsEnableFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.EnableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsEnableFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/models.go index 15f10f1068bb6..69d2976bcb1a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/models.go @@ -408,12 +408,11 @@ type ServiceProperties struct { // operation. type ServicesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ServicesCreateOrUpdateFuture) Result(client ServicesClient) (s Service, err error) { +func (future *ServicesCreateOrUpdateFuture) Result(client ServicesClient) (s Service, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -421,34 +420,15 @@ func (future ServicesCreateOrUpdateFuture) Result(client ServicesClient) (s Serv return } if !done { - return s, azure.NewAsyncOpIncompleteError("search.ServicesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("search.ServicesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/services.go b/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/services.go index b7f1d5bd363e8..56ddc928d3002 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/services.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search/services.go @@ -195,15 +195,17 @@ func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourc // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/migrationconfigs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/migrationconfigs.go index cb865975dfda7..0849340f3520e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/migrationconfigs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/migrationconfigs.go @@ -183,15 +183,17 @@ func (client MigrationConfigsClient) CreateAndStartMigrationPreparer(ctx context // CreateAndStartMigrationSender sends the CreateAndStartMigration request. The method will close the // http.Response Body if it receives an error. func (client MigrationConfigsClient) CreateAndStartMigrationSender(req *http.Request) (future MigrationConfigsCreateAndStartMigrationFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/models.go index 11fb5f557b478..b65c94052a4da 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/models.go @@ -1018,12 +1018,11 @@ type MigrationConfigPropertiesProperties struct { // long-running operation. type MigrationConfigsCreateAndStartMigrationFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future MigrationConfigsCreateAndStartMigrationFuture) Result(client MigrationConfigsClient) (mcp MigrationConfigProperties, err error) { +func (future *MigrationConfigsCreateAndStartMigrationFuture) Result(client MigrationConfigsClient) (mcp MigrationConfigProperties, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1031,34 +1030,15 @@ func (future MigrationConfigsCreateAndStartMigrationFuture) Result(client Migrat return } if !done { - return mcp, azure.NewAsyncOpIncompleteError("servicebus.MigrationConfigsCreateAndStartMigrationFuture") - } - if future.PollingMethod() == azure.PollingLocation { - mcp, err = client.CreateAndStartMigrationResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("servicebus.MigrationConfigsCreateAndStartMigrationFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mcp.Response.Response, err = future.GetResult(sender); err == nil && mcp.Response.Response.StatusCode != http.StatusNoContent { + mcp, err = client.CreateAndStartMigrationResponder(mcp.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", mcp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", resp, "Failure sending request") - return - } - mcp, err = client.CreateAndStartMigrationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", resp, "Failure responding to request") } return } @@ -1067,12 +1047,11 @@ func (future MigrationConfigsCreateAndStartMigrationFuture) Result(client Migrat // operation. type NamespacesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (sn SBNamespace, err error) { +func (future *NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (sn SBNamespace, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1080,34 +1059,15 @@ func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (sn return } if !done { - return sn, azure.NewAsyncOpIncompleteError("servicebus.NamespacesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sn, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sn.Response.Response, err = future.GetResult(sender); err == nil && sn.Response.Response.StatusCode != http.StatusNoContent { + sn, err = client.CreateOrUpdateResponder(sn.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", sn.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sn, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1115,12 +1075,11 @@ func (future NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (sn // NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type NamespacesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { +func (future *NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1128,35 +1087,10 @@ func (future NamespacesDeleteFuture) Result(client NamespacesClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("servicebus.NamespacesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/namespaces.go index 6ff40a7ffb13c..1bbefa9b8a4e6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/namespaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus/namespaces.go @@ -167,15 +167,17 @@ func (client NamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resou // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (future NamespacesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -334,15 +336,17 @@ func (client NamespacesClient) DeletePreparer(ctx context.Context, resourceGroup // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client NamespacesClient) DeleteSender(req *http.Request) (future NamespacesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go index c1ffd6b6e0356..56dc300ec18f4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go @@ -186,15 +186,17 @@ func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupNa // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go index 9e31bb4e522de..c215a75c8e593 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go @@ -755,12 +755,11 @@ type AccountSasParameters struct { // AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AccountsCreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AccountsCreateFuture) Result(client AccountsClient) (a Account, err error) { +func (future *AccountsCreateFuture) Result(client AccountsClient) (a Account, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -768,34 +767,15 @@ func (future AccountsCreateFuture) Result(client AccountsClient) (a Account, err return } if !done { - return a, azure.NewAsyncOpIncompleteError("storage.AccountsCreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - a, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("storage.AccountsCreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", a.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", resp, "Failure sending request") - return - } - a, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/apps.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/apps.go index f79664516a725..414b7700fd44c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/apps.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/apps.go @@ -924,15 +924,17 @@ func (client AppsClient) CreateFunctionPreparer(ctx context.Context, resourceGro // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1009,15 +1011,17 @@ func (client AppsClient) CreateInstanceFunctionSlotPreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1091,15 +1095,17 @@ func (client AppsClient) CreateInstanceMSDeployOperationPreparer(ctx context.Con // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1175,15 +1181,17 @@ func (client AppsClient) CreateInstanceMSDeployOperationSlotPreparer(ctx context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1255,15 +1263,17 @@ func (client AppsClient) CreateMSDeployOperationPreparer(ctx context.Context, re // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1337,15 +1347,17 @@ func (client AppsClient) CreateMSDeployOperationSlotPreparer(ctx context.Context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1433,15 +1445,17 @@ func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGro // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -2547,15 +2561,17 @@ func (client AppsClient) CreateOrUpdateSlotPreparer(ctx context.Context, resourc // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -2627,15 +2643,17 @@ func (client AppsClient) CreateOrUpdateSourceControlPreparer(ctx context.Context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -2710,15 +2728,17 @@ func (client AppsClient) CreateOrUpdateSourceControlSlotPreparer(ctx context.Con // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -12530,15 +12550,17 @@ func (client AppsClient) InstallSiteExtensionPreparer(ctx context.Context, resou // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusTooManyRequests)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusTooManyRequests)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -12612,15 +12634,17 @@ func (client AppsClient) InstallSiteExtensionSlotPreparer(ctx context.Context, r // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusTooManyRequests)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusTooManyRequests)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -18665,15 +18689,17 @@ func (client AppsClient) ListPublishingCredentialsPreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -18745,15 +18771,17 @@ func (client AppsClient) ListPublishingCredentialsSlotPreparer(ctx context.Conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -21266,15 +21294,17 @@ func (client AppsClient) MigrateMySQLPreparer(ctx context.Context, resourceGroup // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -21353,15 +21383,17 @@ func (client AppsClient) MigrateStoragePreparer(ctx context.Context, subscriptio // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -21437,15 +21469,17 @@ func (client AppsClient) RecoverPreparer(ctx context.Context, resourceGroupName // RecoverSender sends the Recover request. The method will close the // http.Response Body if it receives an error. func (client AppsClient) RecoverSender(req *http.Request) (future AppsRecoverFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -21677,15 +21711,17 @@ func (client AppsClient) RecoverSlotPreparer(ctx context.Context, resourceGroupN // RecoverSlotSender sends the RecoverSlot request. The method will close the // http.Response Body if it receives an error. func (client AppsClient) RecoverSlotSender(req *http.Request) (future AppsRecoverSlotFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -22086,15 +22122,17 @@ func (client AppsClient) RestorePreparer(ctx context.Context, resourceGroupName // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -22176,15 +22214,17 @@ func (client AppsClient) RestoreSlotPreparer(ctx context.Context, resourceGroupN // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -23354,15 +23394,17 @@ func (client AppsClient) SwapSlotSlotPreparer(ctx context.Context, resourceGroup // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -23436,15 +23478,17 @@ func (client AppsClient) SwapSlotWithProductionPreparer(ctx context.Context, res // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appservicecertificateorders.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appservicecertificateorders.go index f78fcb530c1bb..ba9c790ce435a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appservicecertificateorders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appservicecertificateorders.go @@ -102,15 +102,17 @@ func (client AppServiceCertificateOrdersClient) CreateOrUpdatePreparer(ctx conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -184,15 +186,17 @@ func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificatePrepare // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceenvironments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceenvironments.go index 94aaabefff5d9..71e8670b63f2c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceenvironments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceenvironments.go @@ -102,15 +102,17 @@ func (client AppServiceEnvironmentsClient) CreateOrUpdatePreparer(ctx context.Co // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -182,15 +184,17 @@ func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolPreparer(c // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -264,15 +268,17 @@ func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolPreparer(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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -346,15 +352,17 @@ func (client AppServiceEnvironmentsClient) DeletePreparer(ctx context.Context, r // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -3337,15 +3345,17 @@ func (client AppServiceEnvironmentsClient) ResumePreparer(ctx context.Context, r // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -3391,7 +3401,6 @@ func (client AppServiceEnvironmentsClient) ResumeComplete(ctx context.Context, r var future AppServiceEnvironmentsResumeFuture future, err = client.Resume(ctx, resourceGroupName, name) result.Future = future.Future - result.req = future.req return } @@ -3447,15 +3456,17 @@ func (client AppServiceEnvironmentsClient) SuspendPreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -3501,7 +3512,6 @@ func (client AppServiceEnvironmentsClient) SuspendComplete(ctx context.Context, var future AppServiceEnvironmentsSuspendFuture future, err = client.Suspend(ctx, resourceGroupName, name) result.Future = future.Future - result.req = future.req return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceplans.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceplans.go index 626581873c2fd..9e55f7e36a22e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceplans.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/appserviceplans.go @@ -98,15 +98,17 @@ func (client AppServicePlansClient) CreateOrUpdatePreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/domains.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/domains.go index 6ddd2a46f3788..f3e13e7316893 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/domains.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/domains.go @@ -219,15 +219,17 @@ func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resource // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/models.go index 5572b29f4fded..64adf3543aa3c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web/models.go @@ -1712,12 +1712,11 @@ func (page ApplicationStackCollectionPage) Values() []ApplicationStack { // AppsCreateFunctionFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsCreateFunctionFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateFunctionFuture) Result(client AppsClient) (fe FunctionEnvelope, err error) { +func (future *AppsCreateFunctionFuture) Result(client AppsClient) (fe FunctionEnvelope, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1725,34 +1724,15 @@ func (future AppsCreateFunctionFuture) Result(client AppsClient) (fe FunctionEnv return } if !done { - return fe, azure.NewAsyncOpIncompleteError("web.AppsCreateFunctionFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fe, err = client.CreateFunctionResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateFunctionFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateFunctionFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateFunctionFuture", "Result", fe.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateFunctionFuture", "Result", resp, "Failure sending request") - return - } - fe, err = client.CreateFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateFunctionFuture", "Result", resp, "Failure responding to request") } return } @@ -1761,12 +1741,11 @@ func (future AppsCreateFunctionFuture) Result(client AppsClient) (fe FunctionEnv // operation. type AppsCreateInstanceFunctionSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateInstanceFunctionSlotFuture) Result(client AppsClient) (fe FunctionEnvelope, err error) { +func (future *AppsCreateInstanceFunctionSlotFuture) Result(client AppsClient) (fe FunctionEnvelope, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1774,34 +1753,15 @@ func (future AppsCreateInstanceFunctionSlotFuture) Result(client AppsClient) (fe return } if !done { - return fe, azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceFunctionSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fe, err = client.CreateInstanceFunctionSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceFunctionSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceFunctionSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceFunctionSlotFuture", "Result", fe.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceFunctionSlotFuture", "Result", resp, "Failure sending request") - return - } - fe, err = client.CreateInstanceFunctionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceFunctionSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -1810,12 +1770,11 @@ func (future AppsCreateInstanceFunctionSlotFuture) Result(client AppsClient) (fe // long-running operation. type AppsCreateInstanceMSDeployOperationFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateInstanceMSDeployOperationFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { +func (future *AppsCreateInstanceMSDeployOperationFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1823,34 +1782,15 @@ func (future AppsCreateInstanceMSDeployOperationFuture) Result(client AppsClient return } if !done { - return mds, azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceMSDeployOperationFuture") - } - if future.PollingMethod() == azure.PollingLocation { - mds, err = client.CreateInstanceMSDeployOperationResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceMSDeployOperationFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationFuture", "Result", mds.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationFuture", "Result", resp, "Failure sending request") - return - } - mds, err = client.CreateInstanceMSDeployOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationFuture", "Result", resp, "Failure responding to request") } return } @@ -1859,12 +1799,11 @@ func (future AppsCreateInstanceMSDeployOperationFuture) Result(client AppsClient // long-running operation. type AppsCreateInstanceMSDeployOperationSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateInstanceMSDeployOperationSlotFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { +func (future *AppsCreateInstanceMSDeployOperationSlotFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1872,34 +1811,15 @@ func (future AppsCreateInstanceMSDeployOperationSlotFuture) Result(client AppsCl return } if !done { - return mds, azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceMSDeployOperationSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - mds, err = client.CreateInstanceMSDeployOperationSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceMSDeployOperationSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationSlotFuture", "Result", mds.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationSlotFuture", "Result", resp, "Failure sending request") - return - } - mds, err = client.CreateInstanceMSDeployOperationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -1908,12 +1828,11 @@ func (future AppsCreateInstanceMSDeployOperationSlotFuture) Result(client AppsCl // operation. type AppsCreateMSDeployOperationFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateMSDeployOperationFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { +func (future *AppsCreateMSDeployOperationFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1921,34 +1840,15 @@ func (future AppsCreateMSDeployOperationFuture) Result(client AppsClient) (mds M return } if !done { - return mds, azure.NewAsyncOpIncompleteError("web.AppsCreateMSDeployOperationFuture") - } - if future.PollingMethod() == azure.PollingLocation { - mds, err = client.CreateMSDeployOperationResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateMSDeployOperationFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationFuture", "Result", mds.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationFuture", "Result", resp, "Failure sending request") - return - } - mds, err = client.CreateMSDeployOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationFuture", "Result", resp, "Failure responding to request") } return } @@ -1957,12 +1857,11 @@ func (future AppsCreateMSDeployOperationFuture) Result(client AppsClient) (mds M // operation. type AppsCreateMSDeployOperationSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateMSDeployOperationSlotFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { +func (future *AppsCreateMSDeployOperationSlotFuture) Result(client AppsClient) (mds MSDeployStatus, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1970,34 +1869,15 @@ func (future AppsCreateMSDeployOperationSlotFuture) Result(client AppsClient) (m return } if !done { - return mds, azure.NewAsyncOpIncompleteError("web.AppsCreateMSDeployOperationSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - mds, err = client.CreateMSDeployOperationSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateMSDeployOperationSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationSlotFuture", "Result", mds.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationSlotFuture", "Result", resp, "Failure sending request") - return - } - mds, err = client.CreateMSDeployOperationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -2005,12 +1885,11 @@ func (future AppsCreateMSDeployOperationSlotFuture) Result(client AppsClient) (m // AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateOrUpdateFuture) Result(client AppsClient) (s Site, err error) { +func (future *AppsCreateOrUpdateFuture) Result(client AppsClient) (s Site, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2018,34 +1897,15 @@ func (future AppsCreateOrUpdateFuture) Result(client AppsClient) (s Site, err er return } if !done { - return s, azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -2054,12 +1914,11 @@ func (future AppsCreateOrUpdateFuture) Result(client AppsClient) (s Site, err er // operation. type AppsCreateOrUpdateSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateOrUpdateSlotFuture) Result(client AppsClient) (s Site, err error) { +func (future *AppsCreateOrUpdateSlotFuture) Result(client AppsClient) (s Site, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2067,34 +1926,15 @@ func (future AppsCreateOrUpdateSlotFuture) Result(client AppsClient) (s Site, er return } if !done { - return s, azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSlotFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSlotFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -2103,12 +1943,11 @@ func (future AppsCreateOrUpdateSlotFuture) Result(client AppsClient) (s Site, er // operation. type AppsCreateOrUpdateSourceControlFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateOrUpdateSourceControlFuture) Result(client AppsClient) (ssc SiteSourceControl, err error) { +func (future *AppsCreateOrUpdateSourceControlFuture) Result(client AppsClient) (ssc SiteSourceControl, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2116,34 +1955,15 @@ func (future AppsCreateOrUpdateSourceControlFuture) Result(client AppsClient) (s return } if !done { - return ssc, azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSourceControlFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ssc, err = client.CreateOrUpdateSourceControlResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSourceControlFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlFuture", "Result", ssc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlFuture", "Result", resp, "Failure sending request") - return - } - ssc, err = client.CreateOrUpdateSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlFuture", "Result", resp, "Failure responding to request") } return } @@ -2152,12 +1972,11 @@ func (future AppsCreateOrUpdateSourceControlFuture) Result(client AppsClient) (s // long-running operation. type AppsCreateOrUpdateSourceControlSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsCreateOrUpdateSourceControlSlotFuture) Result(client AppsClient) (ssc SiteSourceControl, err error) { +func (future *AppsCreateOrUpdateSourceControlSlotFuture) Result(client AppsClient) (ssc SiteSourceControl, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2165,34 +1984,15 @@ func (future AppsCreateOrUpdateSourceControlSlotFuture) Result(client AppsClient return } if !done { - return ssc, azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSourceControlSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ssc, err = client.CreateOrUpdateSourceControlSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSourceControlSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlSlotFuture", "Result", ssc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlSlotFuture", "Result", resp, "Failure sending request") - return - } - ssc, err = client.CreateOrUpdateSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -2847,12 +2647,11 @@ func (asco AppServiceCertificateOrderProperties) MarshalJSON() ([]byte, error) { // results of a long-running operation. type AppServiceCertificateOrdersCreateOrUpdateCertificateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceCertificateOrdersCreateOrUpdateCertificateFuture) Result(client AppServiceCertificateOrdersClient) (ascr AppServiceCertificateResource, err error) { +func (future *AppServiceCertificateOrdersCreateOrUpdateCertificateFuture) Result(client AppServiceCertificateOrdersClient) (ascr AppServiceCertificateResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2860,34 +2659,15 @@ func (future AppServiceCertificateOrdersCreateOrUpdateCertificateFuture) Result( return } if !done { - return ascr, azure.NewAsyncOpIncompleteError("web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ascr, err = client.CreateOrUpdateCertificateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture", "Result", ascr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture", "Result", resp, "Failure sending request") - return - } - ascr, err = client.CreateOrUpdateCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture", "Result", resp, "Failure responding to request") } return } @@ -2896,12 +2676,11 @@ func (future AppServiceCertificateOrdersCreateOrUpdateCertificateFuture) Result( // long-running operation. type AppServiceCertificateOrdersCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceCertificateOrdersCreateOrUpdateFuture) Result(client AppServiceCertificateOrdersClient) (asco AppServiceCertificateOrder, err error) { +func (future *AppServiceCertificateOrdersCreateOrUpdateFuture) Result(client AppServiceCertificateOrdersClient) (asco AppServiceCertificateOrder, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2909,34 +2688,15 @@ func (future AppServiceCertificateOrdersCreateOrUpdateFuture) Result(client AppS return } if !done { - return asco, azure.NewAsyncOpIncompleteError("web.AppServiceCertificateOrdersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - asco, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceCertificateOrdersCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateFuture", "Result", asco.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - asco, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -3566,12 +3326,11 @@ func (aser *AppServiceEnvironmentResource) UnmarshalJSON(body []byte) error { // long-running operation. type AppServiceEnvironmentsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsCreateOrUpdateFuture) Result(client AppServiceEnvironmentsClient) (aser AppServiceEnvironmentResource, err error) { +func (future *AppServiceEnvironmentsCreateOrUpdateFuture) Result(client AppServiceEnvironmentsClient) (aser AppServiceEnvironmentResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3579,34 +3338,15 @@ func (future AppServiceEnvironmentsCreateOrUpdateFuture) Result(client AppServic return } if !done { - return aser, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - aser, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateFuture", "Result", aser.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - aser, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -3615,12 +3355,11 @@ func (future AppServiceEnvironmentsCreateOrUpdateFuture) Result(client AppServic // of a long-running operation. type AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture) Result(client AppServiceEnvironmentsClient) (wpr WorkerPoolResource, err error) { +func (future *AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture) Result(client AppServiceEnvironmentsClient) (wpr WorkerPoolResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3628,34 +3367,15 @@ func (future AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture) Result(cli return } if !done { - return wpr, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture") - } - if future.PollingMethod() == azure.PollingLocation { - wpr, err = client.CreateOrUpdateMultiRolePoolResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture", "Result", wpr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture", "Result", resp, "Failure sending request") - return - } - wpr, err = client.CreateOrUpdateMultiRolePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture", "Result", resp, "Failure responding to request") } return } @@ -3664,12 +3384,11 @@ func (future AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture) Result(cli // a long-running operation. type AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture) Result(client AppServiceEnvironmentsClient) (wpr WorkerPoolResource, err error) { +func (future *AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture) Result(client AppServiceEnvironmentsClient) (wpr WorkerPoolResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3677,34 +3396,15 @@ func (future AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture) Result(client return } if !done { - return wpr, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture") - } - if future.PollingMethod() == azure.PollingLocation { - wpr, err = client.CreateOrUpdateWorkerPoolResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture", "Result", wpr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture", "Result", resp, "Failure sending request") - return - } - wpr, err = client.CreateOrUpdateWorkerPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture", "Result", resp, "Failure responding to request") } return } @@ -3713,12 +3413,11 @@ func (future AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture) Result(client // operation. type AppServiceEnvironmentsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsDeleteFuture) Result(client AppServiceEnvironmentsClient) (ar autorest.Response, err error) { +func (future *AppServiceEnvironmentsDeleteFuture) Result(client AppServiceEnvironmentsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3726,35 +3425,10 @@ func (future AppServiceEnvironmentsDeleteFuture) Result(client AppServiceEnviron return } if !done { - return ar, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsDeleteFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsDeleteFuture") return } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -3762,12 +3436,11 @@ func (future AppServiceEnvironmentsDeleteFuture) Result(client AppServiceEnviron // operation. type AppServiceEnvironmentsResumeAllFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsResumeAllFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { +func (future *AppServiceEnvironmentsResumeAllFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3775,34 +3448,15 @@ func (future AppServiceEnvironmentsResumeAllFuture) Result(client AppServiceEnvi return } if !done { - return acp, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsResumeAllFuture") - } - if future.PollingMethod() == azure.PollingLocation { - acp, err = client.ResumeResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeAllFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsResumeAllFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeAllFuture", "Result", acp.ac.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeAllFuture", "Result", resp, "Failure sending request") - return - } - acp, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeAllFuture", "Result", resp, "Failure responding to request") } return } @@ -3811,12 +3465,11 @@ func (future AppServiceEnvironmentsResumeAllFuture) Result(client AppServiceEnvi // operation. type AppServiceEnvironmentsResumeFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsResumeFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { +func (future *AppServiceEnvironmentsResumeFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3824,34 +3477,15 @@ func (future AppServiceEnvironmentsResumeFuture) Result(client AppServiceEnviron return } if !done { - return acp, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsResumeFuture") - } - if future.PollingMethod() == azure.PollingLocation { - acp, err = client.ResumeResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsResumeFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeFuture", "Result", acp.ac.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeFuture", "Result", resp, "Failure sending request") - return - } - acp, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeFuture", "Result", resp, "Failure responding to request") } return } @@ -3860,12 +3494,11 @@ func (future AppServiceEnvironmentsResumeFuture) Result(client AppServiceEnviron // long-running operation. type AppServiceEnvironmentsSuspendAllFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsSuspendAllFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { +func (future *AppServiceEnvironmentsSuspendAllFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3873,34 +3506,15 @@ func (future AppServiceEnvironmentsSuspendAllFuture) Result(client AppServiceEnv return } if !done { - return acp, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsSuspendAllFuture") - } - if future.PollingMethod() == azure.PollingLocation { - acp, err = client.SuspendResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendAllFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsSuspendAllFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendAllFuture", "Result", acp.ac.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendAllFuture", "Result", resp, "Failure sending request") - return - } - acp, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendAllFuture", "Result", resp, "Failure responding to request") } return } @@ -3909,12 +3523,11 @@ func (future AppServiceEnvironmentsSuspendAllFuture) Result(client AppServiceEnv // operation. type AppServiceEnvironmentsSuspendFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServiceEnvironmentsSuspendFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { +func (future *AppServiceEnvironmentsSuspendFuture) Result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3922,34 +3535,15 @@ func (future AppServiceEnvironmentsSuspendFuture) Result(client AppServiceEnviro return } if !done { - return acp, azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsSuspendFuture") - } - if future.PollingMethod() == azure.PollingLocation { - acp, err = client.SuspendResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsSuspendFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendFuture", "Result", acp.ac.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendFuture", "Result", resp, "Failure sending request") - return - } - acp, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendFuture", "Result", resp, "Failure responding to request") } return } @@ -4370,12 +3964,11 @@ type AppServicePlanProperties struct { // operation. type AppServicePlansCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppServicePlansCreateOrUpdateFuture) Result(client AppServicePlansClient) (asp AppServicePlan, err error) { +func (future *AppServicePlansCreateOrUpdateFuture) Result(client AppServicePlansClient) (asp AppServicePlan, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4383,34 +3976,15 @@ func (future AppServicePlansCreateOrUpdateFuture) Result(client AppServicePlansC return } if !done { - return asp, azure.NewAsyncOpIncompleteError("web.AppServicePlansCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - asp, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppServicePlansCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppServicePlansCreateOrUpdateFuture", "Result", asp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - asp, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -4419,12 +3993,11 @@ func (future AppServicePlansCreateOrUpdateFuture) Result(client AppServicePlansC // operation. type AppsInstallSiteExtensionFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsInstallSiteExtensionFuture) Result(client AppsClient) (sei SiteExtensionInfo, err error) { +func (future *AppsInstallSiteExtensionFuture) Result(client AppsClient) (sei SiteExtensionInfo, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4432,34 +4005,15 @@ func (future AppsInstallSiteExtensionFuture) Result(client AppsClient) (sei Site return } if !done { - return sei, azure.NewAsyncOpIncompleteError("web.AppsInstallSiteExtensionFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sei, err = client.InstallSiteExtensionResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsInstallSiteExtensionFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionFuture", "Result", sei.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionFuture", "Result", resp, "Failure sending request") - return - } - sei, err = client.InstallSiteExtensionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionFuture", "Result", resp, "Failure responding to request") } return } @@ -4468,12 +4022,11 @@ func (future AppsInstallSiteExtensionFuture) Result(client AppsClient) (sei Site // operation. type AppsInstallSiteExtensionSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsInstallSiteExtensionSlotFuture) Result(client AppsClient) (sei SiteExtensionInfo, err error) { +func (future *AppsInstallSiteExtensionSlotFuture) Result(client AppsClient) (sei SiteExtensionInfo, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4481,34 +4034,15 @@ func (future AppsInstallSiteExtensionSlotFuture) Result(client AppsClient) (sei return } if !done { - return sei, azure.NewAsyncOpIncompleteError("web.AppsInstallSiteExtensionSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sei, err = client.InstallSiteExtensionSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsInstallSiteExtensionSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionSlotFuture", "Result", sei.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionSlotFuture", "Result", resp, "Failure sending request") - return - } - sei, err = client.InstallSiteExtensionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -4517,12 +4051,11 @@ func (future AppsInstallSiteExtensionSlotFuture) Result(client AppsClient) (sei // operation. type AppsListPublishingCredentialsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsListPublishingCredentialsFuture) Result(client AppsClient) (u User, err error) { +func (future *AppsListPublishingCredentialsFuture) Result(client AppsClient) (u User, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4530,34 +4063,15 @@ func (future AppsListPublishingCredentialsFuture) Result(client AppsClient) (u U return } if !done { - return u, azure.NewAsyncOpIncompleteError("web.AppsListPublishingCredentialsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - u, err = client.ListPublishingCredentialsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsListPublishingCredentialsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsFuture", "Result", u.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsFuture", "Result", resp, "Failure sending request") - return - } - u, err = client.ListPublishingCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsFuture", "Result", resp, "Failure responding to request") } return } @@ -4566,12 +4080,11 @@ func (future AppsListPublishingCredentialsFuture) Result(client AppsClient) (u U // long-running operation. type AppsListPublishingCredentialsSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsListPublishingCredentialsSlotFuture) Result(client AppsClient) (u User, err error) { +func (future *AppsListPublishingCredentialsSlotFuture) Result(client AppsClient) (u User, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4579,34 +4092,15 @@ func (future AppsListPublishingCredentialsSlotFuture) Result(client AppsClient) return } if !done { - return u, azure.NewAsyncOpIncompleteError("web.AppsListPublishingCredentialsSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - u, err = client.ListPublishingCredentialsSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsListPublishingCredentialsSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsSlotFuture", "Result", u.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsSlotFuture", "Result", resp, "Failure sending request") - return - } - u, err = client.ListPublishingCredentialsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -4614,12 +4108,11 @@ func (future AppsListPublishingCredentialsSlotFuture) Result(client AppsClient) // AppsMigrateMySQLFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsMigrateMySQLFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsMigrateMySQLFuture) Result(client AppsClient) (o Operation, err error) { +func (future *AppsMigrateMySQLFuture) Result(client AppsClient) (o Operation, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4627,34 +4120,15 @@ func (future AppsMigrateMySQLFuture) Result(client AppsClient) (o Operation, err return } if !done { - return o, azure.NewAsyncOpIncompleteError("web.AppsMigrateMySQLFuture") - } - if future.PollingMethod() == azure.PollingLocation { - o, err = client.MigrateMySQLResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsMigrateMySQLFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsMigrateMySQLFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsMigrateMySQLFuture", "Result", o.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsMigrateMySQLFuture", "Result", resp, "Failure sending request") - return - } - o, err = client.MigrateMySQLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsMigrateMySQLFuture", "Result", resp, "Failure responding to request") } return } @@ -4662,12 +4136,11 @@ func (future AppsMigrateMySQLFuture) Result(client AppsClient) (o Operation, err // AppsMigrateStorageFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsMigrateStorageFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsMigrateStorageFuture) Result(client AppsClient) (smr StorageMigrationResponse, err error) { +func (future *AppsMigrateStorageFuture) Result(client AppsClient) (smr StorageMigrationResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4675,34 +4148,15 @@ func (future AppsMigrateStorageFuture) Result(client AppsClient) (smr StorageMig return } if !done { - return smr, azure.NewAsyncOpIncompleteError("web.AppsMigrateStorageFuture") - } - if future.PollingMethod() == azure.PollingLocation { - smr, err = client.MigrateStorageResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsMigrateStorageFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsMigrateStorageFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.AppsMigrateStorageFuture", "Result", smr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsMigrateStorageFuture", "Result", resp, "Failure sending request") - return - } - smr, err = client.MigrateStorageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsMigrateStorageFuture", "Result", resp, "Failure responding to request") } return } @@ -4710,12 +4164,11 @@ func (future AppsMigrateStorageFuture) Result(client AppsClient) (smr StorageMig // AppsRecoverFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsRecoverFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsRecoverFuture) Result(client AppsClient) (ar autorest.Response, err error) { +func (future *AppsRecoverFuture) Result(client AppsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4723,47 +4176,21 @@ func (future AppsRecoverFuture) Result(client AppsClient) (ar autorest.Response, return } if !done { - return ar, azure.NewAsyncOpIncompleteError("web.AppsRecoverFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.RecoverResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRecoverFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRecoverFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("web.AppsRecoverFuture") return } - ar, err = client.RecoverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRecoverFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // AppsRecoverSlotFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsRecoverSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsRecoverSlotFuture) Result(client AppsClient) (ar autorest.Response, err error) { +func (future *AppsRecoverSlotFuture) Result(client AppsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4771,47 +4198,21 @@ func (future AppsRecoverSlotFuture) Result(client AppsClient) (ar autorest.Respo return } if !done { - return ar, azure.NewAsyncOpIncompleteError("web.AppsRecoverSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.RecoverSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRecoverSlotFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRecoverSlotFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("web.AppsRecoverSlotFuture") return } - ar, err = client.RecoverSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRecoverSlotFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // AppsRestoreFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsRestoreFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsRestoreFuture) Result(client AppsClient) (rr RestoreResponse, err error) { +func (future *AppsRestoreFuture) Result(client AppsClient) (rr RestoreResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4819,34 +4220,15 @@ func (future AppsRestoreFuture) Result(client AppsClient) (rr RestoreResponse, e return } if !done { - return rr, azure.NewAsyncOpIncompleteError("web.AppsRestoreFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rr, err = client.RestoreResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRestoreFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rr.Response.Response, err = future.GetResult(sender); err == nil && rr.Response.Response.StatusCode != http.StatusNoContent { + rr, err = client.RestoreResponder(rr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "web.AppsRestoreFuture", "Result", rr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRestoreFuture", "Result", resp, "Failure sending request") - return - } - rr, err = client.RestoreResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRestoreFuture", "Result", resp, "Failure responding to request") } return } @@ -4854,12 +4236,11 @@ func (future AppsRestoreFuture) Result(client AppsClient) (rr RestoreResponse, e // AppsRestoreSlotFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsRestoreSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsRestoreSlotFuture) Result(client AppsClient) (rr RestoreResponse, err error) { +func (future *AppsRestoreSlotFuture) Result(client AppsClient) (rr RestoreResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4867,34 +4248,15 @@ func (future AppsRestoreSlotFuture) Result(client AppsClient) (rr RestoreRespons return } if !done { - return rr, azure.NewAsyncOpIncompleteError("web.AppsRestoreSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rr, err = client.RestoreSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRestoreSlotFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreSlotFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rr.Response.Response, err = future.GetResult(sender); err == nil && rr.Response.Response.StatusCode != http.StatusNoContent { + rr, err = client.RestoreSlotResponder(rr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "web.AppsRestoreSlotFuture", "Result", rr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRestoreSlotFuture", "Result", resp, "Failure sending request") - return - } - rr, err = client.RestoreSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsRestoreSlotFuture", "Result", resp, "Failure responding to request") } return } @@ -4902,12 +4264,11 @@ func (future AppsRestoreSlotFuture) Result(client AppsClient) (rr RestoreRespons // AppsSwapSlotSlotFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsSwapSlotSlotFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsSwapSlotSlotFuture) Result(client AppsClient) (ar autorest.Response, err error) { +func (future *AppsSwapSlotSlotFuture) Result(client AppsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4915,35 +4276,10 @@ func (future AppsSwapSlotSlotFuture) Result(client AppsClient) (ar autorest.Resp return } if !done { - return ar, azure.NewAsyncOpIncompleteError("web.AppsSwapSlotSlotFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.SwapSlotSlotResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsSwapSlotSlotFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsSwapSlotSlotFuture", "Result", resp, "Failure sending request") + err = azure.NewAsyncOpIncompleteError("web.AppsSwapSlotSlotFuture") return } - ar, err = client.SwapSlotSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsSwapSlotSlotFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -4951,12 +4287,11 @@ func (future AppsSwapSlotSlotFuture) Result(client AppsClient) (ar autorest.Resp // operation. type AppsSwapSlotWithProductionFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AppsSwapSlotWithProductionFuture) Result(client AppsClient) (ar autorest.Response, err error) { +func (future *AppsSwapSlotWithProductionFuture) Result(client AppsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4964,35 +4299,10 @@ func (future AppsSwapSlotWithProductionFuture) Result(client AppsClient) (ar aut return } if !done { - return ar, azure.NewAsyncOpIncompleteError("web.AppsSwapSlotWithProductionFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.SwapSlotWithProductionResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsSwapSlotWithProductionFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.AppsSwapSlotWithProductionFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsSwapSlotWithProductionFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.SwapSlotWithProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsSwapSlotWithProductionFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -9199,12 +8509,11 @@ type DomainRecommendationSearchParameters struct { // operation. type DomainsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DomainsCreateOrUpdateFuture) Result(client DomainsClient) (d Domain, err error) { +func (future *DomainsCreateOrUpdateFuture) Result(client DomainsClient) (d Domain, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9212,34 +8521,15 @@ func (future DomainsCreateOrUpdateFuture) Result(client DomainsClient) (d Domain return } if !done { - return d, azure.NewAsyncOpIncompleteError("web.DomainsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - d, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("web.DomainsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "web.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - d, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md b/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md index 49e48cdf1efac..459b45831c0e3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md @@ -1,9 +1,13 @@ # Azure Storage SDK for Go (Preview) :exclamation: IMPORTANT: This package is in maintenance only and will be deprecated in the -future. Consider using the new package for blobs currently in preview at -[github.com/Azure/azure-storage-blob-go](https://github.com/Azure/azure-storage-blob-go). -New Table, Queue and File packages are also in development. +future. Please use one of the following packages instead. + +| Service | Import Path/Repo | +|---------|------------------| +| Storage - Blobs | [github.com/Azure/azure-storage-blob-go](https://github.com/Azure/azure-storage-blob-go) | +| Storage - Files | [github.com/Azure/azure-storage-file-go](https://github.com/Azure/azure-storage-file-go) | +| Storage - Queues | [github.com/Azure/azure-storage-queue-go](https://github.com/Azure/azure-storage-queue-go) | The `github.com/Azure/azure-sdk-for-go/storage` package is used to manage [Azure Storage](https://docs.microsoft.com/en-us/azure/storage/) data plane diff --git a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go index 0bf03ceee37f2..fe6c1f7b48f6b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go @@ -18,4 +18,4 @@ package version // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Number contains the semantic version of this SDK. -const Number = "v16.2.1" +const Number = "v17.4.0" diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go index f570d540a623c..bee5e61ddb2c0 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go @@ -26,10 +26,10 @@ const ( // OAuthConfig represents the endpoints needed // in OAuth operations type OAuthConfig struct { - AuthorityEndpoint url.URL - AuthorizeEndpoint url.URL - TokenEndpoint url.URL - DeviceCodeEndpoint url.URL + AuthorityEndpoint url.URL `json:"authorityEndpoint"` + AuthorizeEndpoint url.URL `json:"authorizeEndpoint"` + TokenEndpoint url.URL `json:"tokenEndpoint"` + DeviceCodeEndpoint url.URL `json:"deviceCodeEndpoint"` } // IsZero returns true if the OAuthConfig object is zero-initialized. 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 67c5a0b0ba507..c17ad24746166 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go @@ -22,8 +22,10 @@ import ( "crypto/x509" "encoding/base64" "encoding/json" + "errors" "fmt" "io/ioutil" + "math" "net" "net/http" "net/url" @@ -136,6 +138,12 @@ func (t *Token) OAuthToken() string { return t.AccessToken } +// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form +// that is submitted when acquiring an oAuth token. +type ServicePrincipalSecret interface { + SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error +} + // ServicePrincipalNoSecret represents a secret type that contains no secret // meaning it is not valid for fetching a fresh token. This is used by Manual type ServicePrincipalNoSecret struct { @@ -147,15 +155,19 @@ func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePr return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") } -// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form -// that is submitted when acquiring an oAuth token. -type ServicePrincipalSecret interface { - SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error +// MarshalJSON implements the json.Marshaler interface. +func (noSecret ServicePrincipalNoSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalNoSecret", + }) } // ServicePrincipalTokenSecret implements ServicePrincipalSecret for client_secret type authorization. type ServicePrincipalTokenSecret struct { - ClientSecret string + ClientSecret string `json:"value"` } // SetAuthenticationValues is a method of the interface ServicePrincipalSecret. @@ -165,49 +177,24 @@ func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *Ser return nil } +// MarshalJSON implements the json.Marshaler interface. +func (tokenSecret ServicePrincipalTokenSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Value string `json:"value"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalTokenSecret", + Value: tokenSecret.ClientSecret, + }) +} + // ServicePrincipalCertificateSecret implements ServicePrincipalSecret for generic RSA cert auth with signed JWTs. type ServicePrincipalCertificateSecret struct { Certificate *x509.Certificate PrivateKey *rsa.PrivateKey } -// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. -type ServicePrincipalMSISecret struct { -} - -// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth. -type ServicePrincipalUsernamePasswordSecret struct { - Username string - Password string -} - -// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth. -type ServicePrincipalAuthorizationCodeSecret struct { - ClientSecret string - AuthorizationCode string - RedirectURI string -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("code", secret.AuthorizationCode) - v.Set("client_secret", secret.ClientSecret) - v.Set("redirect_uri", secret.RedirectURI) - return nil -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("username", secret.Username) - v.Set("password", secret.Password) - return nil -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - return nil -} - // SignJwt returns the JWT signed with the certificate's private key. func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { hasher := sha1.New() @@ -228,9 +215,9 @@ func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalTo token := jwt.New(jwt.SigningMethodRS256) token.Header["x5t"] = thumbprint token.Claims = jwt.MapClaims{ - "aud": spt.oauthConfig.TokenEndpoint.String(), - "iss": spt.clientID, - "sub": spt.clientID, + "aud": spt.inner.OauthConfig.TokenEndpoint.String(), + "iss": spt.inner.ClientID, + "sub": spt.inner.ClientID, "jti": base64.URLEncoding.EncodeToString(jti), "nbf": time.Now().Unix(), "exp": time.Now().Add(time.Hour * 24).Unix(), @@ -253,21 +240,151 @@ func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *Se return nil } +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalCertificateSecret) MarshalJSON() ([]byte, error) { + return nil, errors.New("marshalling ServicePrincipalCertificateSecret is not supported") +} + +// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. +type ServicePrincipalMSISecret struct { +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (msiSecret ServicePrincipalMSISecret) MarshalJSON() ([]byte, error) { + return nil, errors.New("marshalling ServicePrincipalMSISecret is not supported") +} + +// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth. +type ServicePrincipalUsernamePasswordSecret struct { + Username string `json:"username"` + Password string `json:"password"` +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("username", secret.Username) + v.Set("password", secret.Password) + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalUsernamePasswordSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Username string `json:"username"` + Password string `json:"password"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalUsernamePasswordSecret", + Username: secret.Username, + Password: secret.Password, + }) +} + +// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth. +type ServicePrincipalAuthorizationCodeSecret struct { + ClientSecret string `json:"value"` + AuthorizationCode string `json:"authCode"` + RedirectURI string `json:"redirect"` +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("code", secret.AuthorizationCode) + v.Set("client_secret", secret.ClientSecret) + v.Set("redirect_uri", secret.RedirectURI) + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalAuthorizationCodeSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Value string `json:"value"` + AuthCode string `json:"authCode"` + Redirect string `json:"redirect"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalAuthorizationCodeSecret", + Value: secret.ClientSecret, + AuthCode: secret.AuthorizationCode, + Redirect: secret.RedirectURI, + }) +} + // ServicePrincipalToken encapsulates a Token created for a Service Principal. type ServicePrincipalToken struct { - token Token - secret ServicePrincipalSecret - oauthConfig OAuthConfig - clientID string - resource string - autoRefresh bool - refreshLock *sync.RWMutex - refreshWithin time.Duration - sender Sender - + inner servicePrincipalToken + refreshLock *sync.RWMutex + sender Sender refreshCallbacks []TokenRefreshCallback } +// MarshalTokenJSON returns the marshalled inner token. +func (spt ServicePrincipalToken) MarshalTokenJSON() ([]byte, error) { + return json.Marshal(spt.inner.Token) +} + +// SetRefreshCallbacks replaces any existing refresh callbacks with the specified callbacks. +func (spt *ServicePrincipalToken) SetRefreshCallbacks(callbacks []TokenRefreshCallback) { + spt.refreshCallbacks = callbacks +} + +// MarshalJSON implements the json.Marshaler interface. +func (spt ServicePrincipalToken) MarshalJSON() ([]byte, error) { + return json.Marshal(spt.inner) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error { + // need to determine the token type + raw := map[string]interface{}{} + err := json.Unmarshal(data, &raw) + if err != nil { + return err + } + secret := raw["secret"].(map[string]interface{}) + switch secret["type"] { + case "ServicePrincipalNoSecret": + spt.inner.Secret = &ServicePrincipalNoSecret{} + case "ServicePrincipalTokenSecret": + spt.inner.Secret = &ServicePrincipalTokenSecret{} + case "ServicePrincipalCertificateSecret": + return errors.New("unmarshalling ServicePrincipalCertificateSecret is not supported") + case "ServicePrincipalMSISecret": + return errors.New("unmarshalling ServicePrincipalMSISecret is not supported") + case "ServicePrincipalUsernamePasswordSecret": + spt.inner.Secret = &ServicePrincipalUsernamePasswordSecret{} + case "ServicePrincipalAuthorizationCodeSecret": + spt.inner.Secret = &ServicePrincipalAuthorizationCodeSecret{} + default: + return fmt.Errorf("unrecognized token type '%s'", secret["type"]) + } + err = json.Unmarshal(data, &spt.inner) + if err != nil { + return err + } + spt.refreshLock = &sync.RWMutex{} + spt.sender = &http.Client{} + return nil +} + +// internal type used for marshalling/unmarshalling +type servicePrincipalToken struct { + Token Token `json:"token"` + Secret ServicePrincipalSecret `json:"secret"` + OauthConfig OAuthConfig `json:"oauth"` + ClientID string `json:"clientID"` + Resource string `json:"resource"` + AutoRefresh bool `json:"autoRefresh"` + RefreshWithin time.Duration `json:"refreshWithin"` +} + func validateOAuthConfig(oac OAuthConfig) error { if oac.IsZero() { return fmt.Errorf("parameter 'oauthConfig' cannot be zero-initialized") @@ -290,13 +407,15 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso return nil, fmt.Errorf("parameter 'secret' cannot be nil") } spt := &ServicePrincipalToken{ - oauthConfig: oauthConfig, - secret: secret, - clientID: id, - resource: resource, - autoRefresh: true, + inner: servicePrincipalToken{ + OauthConfig: oauthConfig, + Secret: secret, + ClientID: id, + Resource: resource, + AutoRefresh: true, + RefreshWithin: defaultRefresh, + }, refreshLock: &sync.RWMutex{}, - refreshWithin: defaultRefresh, sender: &http.Client{}, refreshCallbacks: callbacks, } @@ -327,7 +446,39 @@ func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID s return nil, err } - spt.token = token + spt.inner.Token = token + + return spt, nil +} + +// NewServicePrincipalTokenFromManualTokenSecret creates a ServicePrincipalToken using the supplied token and secret +func NewServicePrincipalTokenFromManualTokenSecret(oauthConfig OAuthConfig, clientID string, resource string, token Token, secret ServicePrincipalSecret, 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 secret == nil { + return nil, fmt.Errorf("parameter 'secret' cannot be nil") + } + if token.IsZero() { + return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized") + } + spt, err := NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + secret, + callbacks...) + if err != nil { + return nil, err + } + + spt.inner.Token = token return spt, nil } @@ -495,20 +646,22 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedI msiEndpointURL.RawQuery = v.Encode() spt := &ServicePrincipalToken{ - oauthConfig: OAuthConfig{ - TokenEndpoint: *msiEndpointURL, + inner: servicePrincipalToken{ + OauthConfig: OAuthConfig{ + TokenEndpoint: *msiEndpointURL, + }, + Secret: &ServicePrincipalMSISecret{}, + Resource: resource, + AutoRefresh: true, + RefreshWithin: defaultRefresh, }, - secret: &ServicePrincipalMSISecret{}, - resource: resource, - autoRefresh: true, refreshLock: &sync.RWMutex{}, - refreshWithin: defaultRefresh, sender: &http.Client{}, refreshCallbacks: callbacks, } if userAssignedID != nil { - spt.clientID = *userAssignedID + spt.inner.ClientID = *userAssignedID } return spt, nil @@ -543,12 +696,12 @@ func (spt *ServicePrincipalToken) EnsureFresh() error { // EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by // RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error { - if spt.autoRefresh && spt.token.WillExpireIn(spt.refreshWithin) { + if spt.inner.AutoRefresh && spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) { // take the write lock then check to see if the token was already refreshed spt.refreshLock.Lock() defer spt.refreshLock.Unlock() - if spt.token.WillExpireIn(spt.refreshWithin) { - return spt.refreshInternal(ctx, spt.resource) + if spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) { + return spt.refreshInternal(ctx, spt.inner.Resource) } } return nil @@ -558,7 +711,7 @@ func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) er func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { if spt.refreshCallbacks != nil { for _, callback := range spt.refreshCallbacks { - err := callback(spt.token) + err := callback(spt.inner.Token) if err != nil { return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) } @@ -578,7 +731,7 @@ func (spt *ServicePrincipalToken) Refresh() error { func (spt *ServicePrincipalToken) RefreshWithContext(ctx context.Context) error { spt.refreshLock.Lock() defer spt.refreshLock.Unlock() - return spt.refreshInternal(ctx, spt.resource) + return spt.refreshInternal(ctx, spt.inner.Resource) } // RefreshExchange refreshes the token, but for a different resource. @@ -596,7 +749,7 @@ func (spt *ServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context } func (spt *ServicePrincipalToken) getGrantType() string { - switch spt.secret.(type) { + switch spt.inner.Secret.(type) { case *ServicePrincipalUsernamePasswordSecret: return OAuthGrantTypeUserPass case *ServicePrincipalAuthorizationCodeSecret: @@ -615,22 +768,30 @@ func isIMDS(u url.URL) bool { } func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource string) error { - req, err := http.NewRequest(http.MethodPost, spt.oauthConfig.TokenEndpoint.String(), nil) + req, err := http.NewRequest(http.MethodPost, spt.inner.OauthConfig.TokenEndpoint.String(), nil) if err != nil { return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err) } req = req.WithContext(ctx) - if !isIMDS(spt.oauthConfig.TokenEndpoint) { + if !isIMDS(spt.inner.OauthConfig.TokenEndpoint) { v := url.Values{} - v.Set("client_id", spt.clientID) + v.Set("client_id", spt.inner.ClientID) v.Set("resource", resource) - if spt.token.RefreshToken != "" { + if spt.inner.Token.RefreshToken != "" { v.Set("grant_type", OAuthGrantTypeRefreshToken) - v.Set("refresh_token", spt.token.RefreshToken) + v.Set("refresh_token", spt.inner.Token.RefreshToken) + // web apps must specify client_secret when refreshing tokens + // see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code#refreshing-the-access-tokens + if spt.getGrantType() == OAuthGrantTypeAuthorizationCode { + err := spt.inner.Secret.SetAuthenticationValues(spt, &v) + if err != nil { + return err + } + } } else { v.Set("grant_type", spt.getGrantType()) - err := spt.secret.SetAuthenticationValues(spt, &v) + err := spt.inner.Secret.SetAuthenticationValues(spt, &v) if err != nil { return err } @@ -643,14 +804,14 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource req.Body = body } - if _, ok := spt.secret.(*ServicePrincipalMSISecret); ok { + if _, ok := spt.inner.Secret.(*ServicePrincipalMSISecret); ok { req.Method = http.MethodGet req.Header.Set(metadataHeader, "true") } var resp *http.Response - if isIMDS(spt.oauthConfig.TokenEndpoint) { - resp, err = retry(spt.sender, req) + if isIMDS(spt.inner.OauthConfig.TokenEndpoint) { + resp, err = retryForIMDS(spt.sender, req) } else { resp, err = spt.sender.Do(req) } @@ -684,12 +845,14 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource return fmt.Errorf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb)) } - spt.token = token + spt.inner.Token = token return spt.InvokeRefreshCallbacks(token) } -func retry(sender Sender, req *http.Request) (resp *http.Response, err error) { +// retry logic specific to retrieving a token from the IMDS endpoint +func retryForIMDS(sender Sender, req *http.Request) (resp *http.Response, err error) { + // copied from client.go due to circular dependency retries := []int{ http.StatusRequestTimeout, // 408 http.StatusTooManyRequests, // 429 @@ -698,8 +861,10 @@ func retry(sender Sender, req *http.Request) (resp *http.Response, err error) { http.StatusServiceUnavailable, // 503 http.StatusGatewayTimeout, // 504 } - // Extra retry status codes requered - retries = append(retries, http.StatusNotFound, + // extra retry status codes specific to IMDS + retries = append(retries, + http.StatusNotFound, + http.StatusGone, // all remaining 5xx http.StatusNotImplemented, http.StatusHTTPVersionNotSupported, @@ -709,36 +874,53 @@ func retry(sender Sender, req *http.Request) (resp *http.Response, err error) { http.StatusNotExtended, http.StatusNetworkAuthenticationRequired) + // see https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/how-to-use-vm-token#retry-guidance + + const maxAttempts int = 5 + const maxDelay time.Duration = 60 * time.Second + attempt := 0 - maxAttempts := 5 + delay := time.Duration(0) for attempt < maxAttempts { resp, err = sender.Do(req) // retry on temporary network errors, e.g. transient network failures. - if (err != nil && !isTemporaryNetworkError(err)) || resp.StatusCode == http.StatusOK || !containsInt(retries, resp.StatusCode) { + // if we don't receive a response then assume we can't connect to the + // endpoint so we're likely not running on an Azure VM so don't retry. + if (err != nil && !isTemporaryNetworkError(err)) || resp == nil || resp.StatusCode == http.StatusOK || !containsInt(retries, resp.StatusCode) { return } - if !delay(resp, req.Context().Done()) { - select { - case <-time.After(time.Second): - attempt++ - case <-req.Context().Done(): - err = req.Context().Err() - return - } + // perform exponential backoff with a cap. + // must increment attempt before calculating delay. + attempt++ + // the base value of 2 is the "delta backoff" as specified in the guidance doc + delay += (time.Duration(math.Pow(2, float64(attempt))) * time.Second) + if delay > maxDelay { + delay = maxDelay + } + + select { + case <-time.After(delay): + // intentionally left blank + case <-req.Context().Done(): + err = req.Context().Err() + return } } return } +// returns true if the specified error is a temporary network error or false if it's not. +// if the error doesn't implement the net.Error interface the return value is true. func isTemporaryNetworkError(err error) bool { - if netErr, ok := err.(net.Error); ok && netErr.Temporary() { + if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { return true } return false } +// returns true if slice ints contains the value n func containsInt(ints []int, n int) bool { for _, i := range ints { if i == n { @@ -748,31 +930,15 @@ func containsInt(ints []int, n int) bool { return false } -func delay(resp *http.Response, cancel <-chan struct{}) bool { - if resp == nil { - return false - } - retryAfter, _ := strconv.Atoi(resp.Header.Get("Retry-After")) - if resp.StatusCode == http.StatusTooManyRequests && retryAfter > 0 { - select { - case <-time.After(time.Duration(retryAfter) * time.Second): - return true - case <-cancel: - return false - } - } - return false -} - // SetAutoRefresh enables or disables automatic refreshing of stale tokens. func (spt *ServicePrincipalToken) SetAutoRefresh(autoRefresh bool) { - spt.autoRefresh = autoRefresh + spt.inner.AutoRefresh = autoRefresh } // SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will // refresh the token. func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { - spt.refreshWithin = d + spt.inner.RefreshWithin = d return } @@ -784,12 +950,12 @@ func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s } func (spt *ServicePrincipalToken) OAuthToken() string { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() - return spt.token.OAuthToken() + return spt.inner.Token.OAuthToken() } // Token returns a copy of the current token. func (spt *ServicePrincipalToken) Token() Token { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() - return spt.token + return spt.inner.Token } diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go index a58e5ef3f1c98..cda1e180acf90 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go @@ -21,11 +21,11 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strings" "time" "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" ) const ( @@ -44,84 +44,85 @@ var pollingCodes = [...]int{http.StatusNoContent, http.StatusAccepted, http.Stat // Future provides a mechanism to access the status and results of an asynchronous request. // Since futures are stateful they should be passed by value to avoid race conditions. type Future struct { - req *http.Request - resp *http.Response - ps pollingState + req *http.Request // legacy + pt pollingTracker } // NewFuture returns a new Future object initialized with the specified request. +// Deprecated: Please use NewFutureFromResponse instead. func NewFuture(req *http.Request) Future { return Future{req: req} } -// Response returns the last HTTP response or nil if there isn't one. +// NewFutureFromResponse returns a new Future object initialized +// with the initial response from an asynchronous operation. +func NewFutureFromResponse(resp *http.Response) (Future, error) { + pt, err := createPollingTracker(resp) + if err != nil { + return Future{}, err + } + return Future{pt: pt}, nil +} + +// Response returns the last HTTP response. func (f Future) Response() *http.Response { - return f.resp + if f.pt == nil { + return nil + } + return f.pt.latestResponse() } // Status returns the last status message of the operation. func (f Future) Status() string { - if f.ps.State == "" { - return "Unknown" + if f.pt == nil { + return "" } - return f.ps.State + return f.pt.pollingStatus() } // PollingMethod returns the method used to monitor the status of the asynchronous operation. func (f Future) PollingMethod() PollingMethodType { - return f.ps.PollingMethod + if f.pt == nil { + return PollingUnknown + } + return f.pt.pollingMethod() } // Done queries the service to see if the operation has completed. func (f *Future) Done(sender autorest.Sender) (bool, error) { - // exit early if this future has terminated - if f.ps.hasTerminated() { - return true, f.errorInfo() + // support for legacy Future implementation + if f.req != nil { + resp, err := sender.Do(f.req) + if err != nil { + return false, err + } + pt, err := createPollingTracker(resp) + if err != nil { + return false, err + } + f.pt = pt + f.req = nil } - resp, err := sender.Do(f.req) - f.resp = resp - if err != nil { + // end legacy + if f.pt == nil { + return false, autorest.NewError("Future", "Done", "future is not initialized") + } + if f.pt.hasTerminated() { + return true, f.pt.pollingError() + } + if err := f.pt.pollForStatus(sender); err != nil { return false, err } - - if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) { - // check response body for error content - if resp.Body != nil { - type respErr struct { - ServiceError ServiceError `json:"error"` - } - re := respErr{} - - defer resp.Body.Close() - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return false, err - } - err = json.Unmarshal(b, &re) - if err != nil { - return false, err - } - return false, re.ServiceError - } - - // try to return something meaningful - return false, ServiceError{ - Code: fmt.Sprintf("%v", resp.StatusCode), - Message: resp.Status, - } + if err := f.pt.checkForErrors(); err != nil { + return f.pt.hasTerminated(), err } - - err = updatePollingState(resp, &f.ps) - if err != nil { + if err := f.pt.updatePollingState(f.pt.provisioningStateApplicable()); err != nil { return false, err } - - if f.ps.hasTerminated() { - return true, f.errorInfo() + if err := f.pt.updateHeaders(); err != nil { + return false, err } - - f.req, err = newPollingRequest(f.ps) - return false, err + return f.pt.hasTerminated(), f.pt.pollingError() } // GetPollingDelay returns a duration the application should wait before checking @@ -129,11 +130,15 @@ func (f *Future) Done(sender autorest.Sender) (bool, error) { // the service via the Retry-After response header. If the header wasn't returned // then the function returns the zero-value time.Duration and false. func (f Future) GetPollingDelay() (time.Duration, bool) { - if f.resp == nil { + if f.pt == nil { + return 0, false + } + resp := f.pt.latestResponse() + if resp == nil { return 0, false } - retry := f.resp.Header.Get(autorest.HeaderRetryAfter) + retry := resp.Header.Get(autorest.HeaderRetryAfter) if retry == "" { return 0, false } @@ -150,14 +155,22 @@ func (f Future) GetPollingDelay() (time.Duration, bool) { // running operation has completed, the provided context is cancelled, or the client's // polling duration has been exceeded. It will retry failed polling attempts based on // the retry value defined in the client up to the maximum retry attempts. +// Deprecated: Please use WaitForCompletionRef() instead. func (f Future) WaitForCompletion(ctx context.Context, client autorest.Client) error { + return f.WaitForCompletionRef(ctx, client) +} + +// WaitForCompletionRef will return when one of the following conditions is met: the long +// running operation has completed, the provided context is cancelled, or the client's +// polling duration has been exceeded. It will retry failed polling attempts based on +// the retry value defined in the client up to the maximum retry attempts. +func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Client) error { ctx, cancel := context.WithTimeout(ctx, client.PollingDuration) defer cancel() - done, err := f.Done(client) for attempts := 0; !done; done, err = f.Done(client) { if attempts >= client.RetryAttempts { - return autorest.NewErrorWithError(err, "azure", "WaitForCompletion", f.resp, "the number of retries has been exceeded") + return autorest.NewErrorWithError(err, "Future", "WaitForCompletion", f.pt.latestResponse(), "the number of retries has been exceeded") } // we want delayAttempt to be zero in the non-error case so // that DelayForBackoff doesn't perform exponential back-off @@ -181,317 +194,709 @@ func (f Future) WaitForCompletion(ctx context.Context, client autorest.Client) e // wait until the delay elapses or the context is cancelled delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, ctx.Done()) if !delayElapsed { - return autorest.NewErrorWithError(ctx.Err(), "azure", "WaitForCompletion", f.resp, "context has been cancelled") + return autorest.NewErrorWithError(ctx.Err(), "Future", "WaitForCompletion", f.pt.latestResponse(), "context has been cancelled") } } return err } -// if the operation failed the polling state will contain -// error information and implements the error interface -func (f *Future) errorInfo() error { - if !f.ps.hasSucceeded() { - return f.ps - } - return nil -} - // MarshalJSON implements the json.Marshaler interface. func (f Future) MarshalJSON() ([]byte, error) { - return json.Marshal(&f.ps) + return json.Marshal(f.pt) } // UnmarshalJSON implements the json.Unmarshaler interface. func (f *Future) UnmarshalJSON(data []byte) error { - err := json.Unmarshal(data, &f.ps) + // unmarshal into JSON object to determine the tracker type + obj := map[string]interface{}{} + err := json.Unmarshal(data, &obj) if err != nil { return err } - f.req, err = newPollingRequest(f.ps) - return err + if obj["method"] == nil { + return autorest.NewError("Future", "UnmarshalJSON", "missing 'method' property") + } + method := obj["method"].(string) + switch strings.ToUpper(method) { + case http.MethodDelete: + f.pt = &pollingTrackerDelete{} + case http.MethodPatch: + f.pt = &pollingTrackerPatch{} + case http.MethodPost: + f.pt = &pollingTrackerPost{} + case http.MethodPut: + f.pt = &pollingTrackerPut{} + default: + return autorest.NewError("Future", "UnmarshalJSON", "unsupoorted method '%s'", method) + } + // now unmarshal into the tracker + return json.Unmarshal(data, &f.pt) } // PollingURL returns the URL used for retrieving the status of the long-running operation. -// For LROs that use the Location header the final URL value is used to retrieve the result. func (f Future) PollingURL() string { - return f.ps.URI + if f.pt == nil { + return "" + } + return f.pt.pollingURL() +} + +// GetResult should be called once polling has completed successfully. +// It makes the final GET call to retrieve the resultant payload. +func (f Future) GetResult(sender autorest.Sender) (*http.Response, error) { + if f.pt.finalGetURL() == "" { + // we can end up in this situation if the async operation returns a 200 + // with no polling URLs. in that case return the response which should + // contain the JSON payload (only do this for successful terminal cases). + if lr := f.pt.latestResponse(); lr != nil && f.pt.hasSucceeded() { + return lr, nil + } + return nil, autorest.NewError("Future", "GetResult", "missing URL for retrieving result") + } + req, err := http.NewRequest(http.MethodGet, f.pt.finalGetURL(), nil) + if err != nil { + return nil, err + } + return sender.Do(req) } -// DoPollForAsynchronous returns a SendDecorator that polls if the http.Response is for an Azure -// long-running operation. It will delay between requests for the duration specified in the -// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by -// closing the optional channel on the http.Request. -func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator { - return func(s autorest.Sender) autorest.Sender { - return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - resp, err = s.Do(r) - if err != nil { - return resp, err - } - if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) { - return resp, nil - } +type pollingTracker interface { + // these methods can differ per tracker - ps := pollingState{} - for err == nil { - err = updatePollingState(resp, &ps) - if err != nil { - break - } - if ps.hasTerminated() { - if !ps.hasSucceeded() { - err = ps - } - break - } + // checks the response headers and status code to determine the polling mechanism + updateHeaders() error - r, err = newPollingRequest(ps) - if err != nil { - return resp, err - } - r = r.WithContext(resp.Request.Context()) + // checks the response for tracker-specific error conditions + checkForErrors() error - delay = autorest.GetRetryAfter(resp, delay) - resp, err = autorest.SendWithSender(s, r, - autorest.AfterDelay(delay)) - } + // returns true if provisioning state should be checked + provisioningStateApplicable() bool - return resp, err - }) - } + // methods common to all trackers + + // initializes the tracker's internal state, call this when the tracker is created + initializeState() error + + // makes an HTTP request to check the status of the LRO + pollForStatus(sender autorest.Sender) error + + // updates internal tracker state, call this after each call to pollForStatus + updatePollingState(provStateApl bool) error + + // returns the error response from the service, can be nil + pollingError() error + + // returns the polling method being used + pollingMethod() PollingMethodType + + // returns the state of the LRO as returned from the service + pollingStatus() string + + // returns the URL used for polling status + pollingURL() string + + // returns the URL used for the final GET to retrieve the resource + finalGetURL() string + + // returns true if the LRO is in a terminal state + hasTerminated() bool + + // returns true if the LRO is in a failed terminal state + hasFailed() bool + + // returns true if the LRO is in a successful terminal state + hasSucceeded() bool + + // returns the cached HTTP response after a call to pollForStatus(), can be nil + latestResponse() *http.Response } -func getAsyncOperation(resp *http.Response) string { - return resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation)) +type pollingTrackerBase struct { + // resp is the last response, either from the submission of the LRO or from polling + resp *http.Response + + // method is the HTTP verb, this is needed for deserialization + Method string `json:"method"` + + // rawBody is the raw JSON response body + rawBody map[string]interface{} + + // denotes if polling is using async-operation or location header + Pm PollingMethodType `json:"pollingMethod"` + + // the URL to poll for status + URI string `json:"pollingURI"` + + // the state of the LRO as returned from the service + State string `json:"lroState"` + + // the URL to GET for the final result + FinalGetURI string `json:"resultURI"` + + // used to hold an error object returned from the service + Err *ServiceError `json:"error,omitempty"` } -func hasSucceeded(state string) bool { - return strings.EqualFold(state, operationSucceeded) +func (pt *pollingTrackerBase) initializeState() error { + // determine the initial polling state based on response body and/or HTTP status + // code. this is applicable to the initial LRO response, not polling responses! + pt.Method = pt.resp.Request.Method + if err := pt.updateRawBody(); err != nil { + return err + } + switch pt.resp.StatusCode { + case http.StatusOK: + if ps := pt.getProvisioningState(); ps != nil { + pt.State = *ps + } else { + pt.State = operationSucceeded + } + case http.StatusCreated: + if ps := pt.getProvisioningState(); ps != nil { + pt.State = *ps + } else { + pt.State = operationInProgress + } + case http.StatusAccepted: + pt.State = operationInProgress + case http.StatusNoContent: + pt.State = operationSucceeded + default: + pt.State = operationFailed + pt.updateErrorFromResponse() + } + return nil } -func hasTerminated(state string) bool { - return strings.EqualFold(state, operationCanceled) || strings.EqualFold(state, operationFailed) || strings.EqualFold(state, operationSucceeded) +func (pt pollingTrackerBase) getProvisioningState() *string { + if pt.rawBody != nil && pt.rawBody["properties"] != nil { + p := pt.rawBody["properties"].(map[string]interface{}) + if ps := p["provisioningState"]; ps != nil { + s := ps.(string) + return &s + } + } + return nil } -func hasFailed(state string) bool { - return strings.EqualFold(state, operationFailed) +func (pt *pollingTrackerBase) updateRawBody() error { + pt.rawBody = map[string]interface{}{} + if pt.resp.ContentLength != 0 { + defer pt.resp.Body.Close() + b, err := ioutil.ReadAll(pt.resp.Body) + if err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to read response body") + } + // put the body back so it's available to other callers + pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b)) + if err = json.Unmarshal(b, &pt.rawBody); err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to unmarshal response body") + } + } + return nil } -type provisioningTracker interface { - state() string - hasSucceeded() bool - hasTerminated() bool +func (pt *pollingTrackerBase) pollForStatus(sender autorest.Sender) error { + req, err := http.NewRequest(http.MethodGet, pt.URI, nil) + if err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to create HTTP request") + } + // attach the context from the original request if available (it will be absent for deserialized futures) + if pt.resp != nil { + req = req.WithContext(pt.resp.Request.Context()) + } + pt.resp, err = sender.Do(req) + if err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to send HTTP request") + } + if autorest.ResponseHasStatusCode(pt.resp, pollingCodes[:]...) { + // reset the service error on success case + pt.Err = nil + err = pt.updateRawBody() + } else { + // check response body for error content + pt.updateErrorFromResponse() + } + return err } -type operationResource struct { - // Note: - // The specification states services should return the "id" field. However some return it as - // "operationId". - ID string `json:"id"` - OperationID string `json:"operationId"` - Name string `json:"name"` - Status string `json:"status"` - Properties map[string]interface{} `json:"properties"` - OperationError ServiceError `json:"error"` - StartTime date.Time `json:"startTime"` - EndTime date.Time `json:"endTime"` - PercentComplete float64 `json:"percentComplete"` +// attempts to unmarshal a ServiceError type from the response body. +// if that fails then make a best attempt at creating something meaningful. +func (pt *pollingTrackerBase) updateErrorFromResponse() { + var err error + if pt.resp.ContentLength != 0 { + type respErr struct { + ServiceError *ServiceError `json:"error"` + } + re := respErr{} + defer pt.resp.Body.Close() + var b []byte + b, err = ioutil.ReadAll(pt.resp.Body) + if err != nil { + goto Default + } + if err = json.Unmarshal(b, &re); err != nil { + goto Default + } + // unmarshalling the error didn't yield anything, try unwrapped error + if re.ServiceError == nil { + err = json.Unmarshal(b, &re.ServiceError) + if err != nil { + goto Default + } + } + if re.ServiceError != nil { + pt.Err = re.ServiceError + return + } + } +Default: + se := &ServiceError{ + Code: fmt.Sprintf("HTTP status code %v", pt.resp.StatusCode), + Message: pt.resp.Status, + } + if err != nil { + se.InnerError = make(map[string]interface{}) + se.InnerError["unmarshalError"] = err.Error() + } + pt.Err = se } -func (or operationResource) state() string { - return or.Status +func (pt *pollingTrackerBase) updatePollingState(provStateApl bool) error { + if pt.Pm == PollingAsyncOperation && pt.rawBody["status"] != nil { + pt.State = pt.rawBody["status"].(string) + } else { + if pt.resp.StatusCode == http.StatusAccepted { + pt.State = operationInProgress + } else if provStateApl { + if ps := pt.getProvisioningState(); ps != nil { + pt.State = *ps + } else { + pt.State = operationSucceeded + } + } else { + return autorest.NewError("pollingTrackerBase", "updatePollingState", "the response from the async operation has an invalid status code") + } + } + // if the operation has failed update the error state + if pt.hasFailed() { + pt.updateErrorFromResponse() + } + return nil } -func (or operationResource) hasSucceeded() bool { - return hasSucceeded(or.state()) +func (pt pollingTrackerBase) pollingError() error { + if pt.Err == nil { + return nil + } + return pt.Err } -func (or operationResource) hasTerminated() bool { - return hasTerminated(or.state()) +func (pt pollingTrackerBase) pollingMethod() PollingMethodType { + return pt.Pm } -type provisioningProperties struct { - ProvisioningState string `json:"provisioningState"` +func (pt pollingTrackerBase) pollingStatus() string { + return pt.State } -type provisioningStatus struct { - Properties provisioningProperties `json:"properties,omitempty"` - ProvisioningError ServiceError `json:"error,omitempty"` +func (pt pollingTrackerBase) pollingURL() string { + return pt.URI } -func (ps provisioningStatus) state() string { - return ps.Properties.ProvisioningState +func (pt pollingTrackerBase) finalGetURL() string { + return pt.FinalGetURI } -func (ps provisioningStatus) hasSucceeded() bool { - return hasSucceeded(ps.state()) +func (pt pollingTrackerBase) hasTerminated() bool { + return strings.EqualFold(pt.State, operationCanceled) || strings.EqualFold(pt.State, operationFailed) || strings.EqualFold(pt.State, operationSucceeded) } -func (ps provisioningStatus) hasTerminated() bool { - return hasTerminated(ps.state()) +func (pt pollingTrackerBase) hasFailed() bool { + return strings.EqualFold(pt.State, operationCanceled) || strings.EqualFold(pt.State, operationFailed) } -func (ps provisioningStatus) hasProvisioningError() bool { - // code and message are required fields so only check them - return len(ps.ProvisioningError.Code) > 0 || - len(ps.ProvisioningError.Message) > 0 +func (pt pollingTrackerBase) hasSucceeded() bool { + return strings.EqualFold(pt.State, operationSucceeded) } -// PollingMethodType defines a type used for enumerating polling mechanisms. -type PollingMethodType string +func (pt pollingTrackerBase) latestResponse() *http.Response { + return pt.resp +} -const ( - // PollingAsyncOperation indicates the polling method uses the Azure-AsyncOperation header. - PollingAsyncOperation PollingMethodType = "AsyncOperation" +// error checking common to all trackers +func (pt pollingTrackerBase) baseCheckForErrors() error { + // for Azure-AsyncOperations the response body cannot be nil or empty + if pt.Pm == PollingAsyncOperation { + if pt.resp.Body == nil || pt.resp.ContentLength == 0 { + return autorest.NewError("pollingTrackerBase", "baseCheckForErrors", "for Azure-AsyncOperation response body cannot be nil") + } + if pt.rawBody["status"] == nil { + return autorest.NewError("pollingTrackerBase", "baseCheckForErrors", "missing status property in Azure-AsyncOperation response body") + } + } + return nil +} - // PollingLocation indicates the polling method uses the Location header. - PollingLocation PollingMethodType = "Location" +// DELETE - // PollingUnknown indicates an unknown polling method and is the default value. - PollingUnknown PollingMethodType = "" -) +type pollingTrackerDelete struct { + pollingTrackerBase +} -type pollingState struct { - PollingMethod PollingMethodType `json:"pollingMethod"` - URI string `json:"uri"` - State string `json:"state"` - ServiceError *ServiceError `json:"error,omitempty"` +func (pt *pollingTrackerDelete) updateHeaders() error { + // for 201 the Location header is required + if pt.resp.StatusCode == http.StatusCreated { + if lh, err := getURLFromLocationHeader(pt.resp); err != nil { + return err + } else if lh == "" { + return autorest.NewError("pollingTrackerDelete", "updateHeaders", "missing Location header in 201 response") + } else { + pt.URI = lh + } + pt.Pm = PollingLocation + pt.FinalGetURI = pt.URI + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + // if the Location header is invalid and we already have a polling URL + // then we don't care if the Location header URL is malformed. + if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { + return err + } else if lh != "" { + if ao == "" { + pt.URI = lh + pt.Pm = PollingLocation + } + // when both headers are returned we use the value in the Location header for the final GET + pt.FinalGetURI = lh + } + // make sure a polling URL was found + if pt.URI == "" { + return autorest.NewError("pollingTrackerPost", "updateHeaders", "didn't get any suitable polling URLs in 202 response") + } + } + return nil } -func (ps pollingState) hasSucceeded() bool { - return hasSucceeded(ps.State) +func (pt pollingTrackerDelete) checkForErrors() error { + return pt.baseCheckForErrors() } -func (ps pollingState) hasTerminated() bool { - return hasTerminated(ps.State) +func (pt pollingTrackerDelete) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusNoContent } -func (ps pollingState) hasFailed() bool { - return hasFailed(ps.State) +// PATCH + +type pollingTrackerPatch struct { + pollingTrackerBase } -func (ps pollingState) Error() string { - s := fmt.Sprintf("Long running operation terminated with status '%s'", ps.State) - if ps.ServiceError != nil { - s = fmt.Sprintf("%s: %+v", s, *ps.ServiceError) +func (pt *pollingTrackerPatch) updateHeaders() error { + // by default we can use the original URL for polling and final GET + if pt.URI == "" { + pt.URI = pt.resp.Request.URL.String() + } + if pt.FinalGetURI == "" { + pt.FinalGetURI = pt.resp.Request.URL.String() } - return s + if pt.Pm == PollingUnknown { + pt.Pm = PollingRequestURI + } + // for 201 it's permissible for no headers to be returned + if pt.resp.StatusCode == http.StatusCreated { + if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + // note the absense of the "final GET" mechanism for PATCH + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + if ao == "" { + if lh, err := getURLFromLocationHeader(pt.resp); err != nil { + return err + } else if lh == "" { + return autorest.NewError("pollingTrackerPatch", "updateHeaders", "didn't get any suitable polling URLs in 202 response") + } else { + pt.URI = lh + pt.Pm = PollingLocation + } + } + } + return nil } -// updatePollingState maps the operation status -- retrieved from either a provisioningState -// field, the status field of an OperationResource, or inferred from the HTTP status code -- -// into a well-known states. Since the process begins from the initial request, the state -// always comes from either a the provisioningState returned or is inferred from the HTTP -// status code. Subsequent requests will read an Azure OperationResource object if the -// service initially returned the Azure-AsyncOperation header. The responseFormat field notes -// the expected response format. -func updatePollingState(resp *http.Response, ps *pollingState) error { - // Determine the response shape - // -- The first response will always be a provisioningStatus response; only the polling requests, - // depending on the header returned, may be something otherwise. - var pt provisioningTracker - if ps.PollingMethod == PollingAsyncOperation { - pt = &operationResource{} - } else { - pt = &provisioningStatus{} - } +func (pt pollingTrackerPatch) checkForErrors() error { + return pt.baseCheckForErrors() +} - // If this is the first request (that is, the polling response shape is unknown), determine how - // to poll and what to expect - if ps.PollingMethod == PollingUnknown { - req := resp.Request - if req == nil { - return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Original HTTP request is missing") - } +func (pt pollingTrackerPatch) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusCreated +} + +// POST + +type pollingTrackerPost struct { + pollingTrackerBase +} - // Prefer the Azure-AsyncOperation header - ps.URI = getAsyncOperation(resp) - if ps.URI != "" { - ps.PollingMethod = PollingAsyncOperation +func (pt *pollingTrackerPost) updateHeaders() error { + // 201 requires Location header + if pt.resp.StatusCode == http.StatusCreated { + if lh, err := getURLFromLocationHeader(pt.resp); err != nil { + return err + } else if lh == "" { + return autorest.NewError("pollingTrackerPost", "updateHeaders", "missing Location header in 201 response") } else { - ps.PollingMethod = PollingLocation + pt.URI = lh + pt.FinalGetURI = lh + pt.Pm = PollingLocation } - - // Else, use the Location header - if ps.URI == "" { - ps.URI = autorest.GetLocation(resp) + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation } - - // Lastly, requests against an existing resource, use the last request URI - if ps.URI == "" { - m := strings.ToUpper(req.Method) - if m == http.MethodPatch || m == http.MethodPut || m == http.MethodGet { - ps.URI = req.URL.String() + // if the Location header is invalid and we already have a polling URL + // then we don't care if the Location header URL is malformed. + if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { + return err + } else if lh != "" { + if ao == "" { + pt.URI = lh + pt.Pm = PollingLocation } + // when both headers are returned we use the value in the Location header for the final GET + pt.FinalGetURI = lh + } + // make sure a polling URL was found + if pt.URI == "" { + return autorest.NewError("pollingTrackerPost", "updateHeaders", "didn't get any suitable polling URLs in 202 response") } } + return nil +} - // Read and interpret the response (saving the Body in case no polling is necessary) - b := &bytes.Buffer{} - err := autorest.Respond(resp, - autorest.ByCopying(b), - autorest.ByUnmarshallingJSON(pt), - autorest.ByClosing()) - resp.Body = ioutil.NopCloser(b) - if err != nil { - return err - } +func (pt pollingTrackerPost) checkForErrors() error { + return pt.baseCheckForErrors() +} - // Interpret the results - // -- Terminal states apply regardless - // -- Unknown states are per-service inprogress states - // -- Otherwise, infer state from HTTP status code - if pt.hasTerminated() { - ps.State = pt.state() - } else if pt.state() != "" { - ps.State = operationInProgress - } else { - switch resp.StatusCode { - case http.StatusAccepted: - ps.State = operationInProgress +func (pt pollingTrackerPost) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusNoContent +} - case http.StatusNoContent, http.StatusCreated, http.StatusOK: - ps.State = operationSucceeded +// PUT - default: - ps.State = operationFailed - } - } +type pollingTrackerPut struct { + pollingTrackerBase +} - if strings.EqualFold(ps.State, operationInProgress) && ps.URI == "" { - return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Unable to obtain polling URI for %s %s", resp.Request.Method, resp.Request.URL) +func (pt *pollingTrackerPut) updateHeaders() error { + // by default we can use the original URL for polling and final GET + if pt.URI == "" { + pt.URI = pt.resp.Request.URL.String() } - - // For failed operation, check for error code and message in - // -- Operation resource - // -- Response - // -- Otherwise, Unknown - if ps.hasFailed() { - if or, ok := pt.(*operationResource); ok { - ps.ServiceError = &or.OperationError - } else if p, ok := pt.(*provisioningStatus); ok && p.hasProvisioningError() { - ps.ServiceError = &p.ProvisioningError - } else { - ps.ServiceError = &ServiceError{ - Code: "Unknown", - Message: "None", + if pt.FinalGetURI == "" { + pt.FinalGetURI = pt.resp.Request.URL.String() + } + if pt.Pm == PollingUnknown { + pt.Pm = PollingRequestURI + } + // for 201 it's permissible for no headers to be returned + if pt.resp.StatusCode == http.StatusCreated { + if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + // if the Location header is invalid and we already have a polling URL + // then we don't care if the Location header URL is malformed. + if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { + return err + } else if lh != "" { + if ao == "" { + pt.URI = lh + pt.Pm = PollingLocation } + // when both headers are returned we use the value in the Location header for the final GET + pt.FinalGetURI = lh + } + // make sure a polling URL was found + if pt.URI == "" { + return autorest.NewError("pollingTrackerPut", "updateHeaders", "didn't get any suitable polling URLs in 202 response") } } return nil } -func newPollingRequest(ps pollingState) (*http.Request, error) { - reqPoll, err := autorest.Prepare(&http.Request{}, - autorest.AsGet(), - autorest.WithBaseURL(ps.URI)) +func (pt pollingTrackerPut) checkForErrors() error { + err := pt.baseCheckForErrors() if err != nil { - return nil, autorest.NewErrorWithError(err, "azure", "newPollingRequest", nil, "Failure creating poll request to %s", ps.URI) + return err + } + // if there are no LRO headers then the body cannot be empty + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } + lh, err := getURLFromLocationHeader(pt.resp) + if err != nil { + return err + } + if ao == "" && lh == "" && len(pt.rawBody) == 0 { + return autorest.NewError("pollingTrackerPut", "checkForErrors", "the response did not contain a body") } + return nil +} + +func (pt pollingTrackerPut) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusCreated +} + +// creates a polling tracker based on the verb of the original request +func createPollingTracker(resp *http.Response) (pollingTracker, error) { + var pt pollingTracker + switch strings.ToUpper(resp.Request.Method) { + case http.MethodDelete: + pt = &pollingTrackerDelete{pollingTrackerBase: pollingTrackerBase{resp: resp}} + case http.MethodPatch: + pt = &pollingTrackerPatch{pollingTrackerBase: pollingTrackerBase{resp: resp}} + case http.MethodPost: + pt = &pollingTrackerPost{pollingTrackerBase: pollingTrackerBase{resp: resp}} + case http.MethodPut: + pt = &pollingTrackerPut{pollingTrackerBase: pollingTrackerBase{resp: resp}} + default: + return nil, autorest.NewError("azure", "createPollingTracker", "unsupported HTTP method %s", resp.Request.Method) + } + if err := pt.initializeState(); err != nil { + return pt, err + } + // this initializes the polling header values, we do this during creation in case the + // initial response send us invalid values; this way the API call will return a non-nil + // error (not doing this means the error shows up in Future.Done) + return pt, pt.updateHeaders() +} + +// gets the polling URL from the Azure-AsyncOperation header. +// ensures the URL is well-formed and absolute. +func getURLFromAsyncOpHeader(resp *http.Response) (string, error) { + s := resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation)) + if s == "" { + return "", nil + } + if !isValidURL(s) { + return "", autorest.NewError("azure", "getURLFromAsyncOpHeader", "invalid polling URL '%s'", s) + } + return s, nil +} - return reqPoll, nil +// gets the polling URL from the Location header. +// ensures the URL is well-formed and absolute. +func getURLFromLocationHeader(resp *http.Response) (string, error) { + s := resp.Header.Get(http.CanonicalHeaderKey(autorest.HeaderLocation)) + if s == "" { + return "", nil + } + if !isValidURL(s) { + return "", autorest.NewError("azure", "getURLFromLocationHeader", "invalid polling URL '%s'", s) + } + return s, nil +} + +// verify that the URL is valid and absolute +func isValidURL(s string) bool { + u, err := url.Parse(s) + return err == nil && u.IsAbs() } +// DoPollForAsynchronous returns a SendDecorator that polls if the http.Response is for an Azure +// long-running operation. It will delay between requests for the duration specified in the +// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled via +// the context associated with the http.Request. +// Deprecated: Prefer using Futures to allow for non-blocking async operations. +func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator { + return func(s autorest.Sender) autorest.Sender { + return autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err != nil { + return resp, err + } + if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) { + return resp, nil + } + future, err := NewFutureFromResponse(resp) + if err != nil { + return resp, err + } + // retry until either the LRO completes or we receive an error + var done bool + for done, err = future.Done(s); !done && err == nil; done, err = future.Done(s) { + // check for Retry-After delay, if not present use the specified polling delay + if pd, ok := future.GetPollingDelay(); ok { + delay = pd + } + // wait until the delay elapses or the context is cancelled + if delayElapsed := autorest.DelayForBackoff(delay, 0, r.Context().Done()); !delayElapsed { + return future.Response(), + autorest.NewErrorWithError(r.Context().Err(), "azure", "DoPollForAsynchronous", future.Response(), "context has been cancelled") + } + } + return future.Response(), err + }) + } +} + +// PollingMethodType defines a type used for enumerating polling mechanisms. +type PollingMethodType string + +const ( + // PollingAsyncOperation indicates the polling method uses the Azure-AsyncOperation header. + PollingAsyncOperation PollingMethodType = "AsyncOperation" + + // PollingLocation indicates the polling method uses the Location header. + PollingLocation PollingMethodType = "Location" + + // PollingRequestURI indicates the polling method uses the original request URI. + PollingRequestURI PollingMethodType = "RequestURI" + + // PollingUnknown indicates an unknown polling method and is the default value. + PollingUnknown PollingMethodType = "" +) + // AsyncOpIncompleteError is the type that's returned from a future that has not completed. type AsyncOpIncompleteError struct { // FutureType is the name of the type composed of a azure.Future. diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go index 18d029526ff5e..a702ffe751721 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go @@ -279,16 +279,29 @@ func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator { resp.Body = ioutil.NopCloser(&b) if decodeErr != nil { return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr) - } else if e.ServiceError == nil { + } + if e.ServiceError == nil { // Check if error is unwrapped ServiceError - if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil || e.ServiceError.Message == "" { - e.ServiceError = &ServiceError{ - Code: "Unknown", - Message: "Unknown service error", - } + if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil { + return err } } - + if e.ServiceError.Message == "" { + // if we're here it means the returned error wasn't OData v4 compliant. + // try to unmarshal the body as raw JSON in hopes of getting something. + rawBody := map[string]interface{}{} + if err := json.Unmarshal(b.Bytes(), &rawBody); err != nil { + return err + } + e.ServiceError = &ServiceError{ + Code: "Unknown", + Message: "Unknown service error", + } + if len(rawBody) > 0 { + e.ServiceError.Details = []map[string]interface{}{rawBody} + } + } + e.Response = resp e.RequestID = ExtractRequestID(resp) if e.StatusCode == nil { e.StatusCode = resp.StatusCode diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go index 3e226fe9b265b..b62bf03baceb5 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go @@ -38,6 +38,13 @@ type Subscription struct { Name string `json:"name"` State string `json:"state"` TenantID string `json:"tenantId"` + User *User `json:"user"` +} + +// User represents a User from the Azure CLI +type User struct { + Name string `json:"name"` + Type string `json:"type"` } // ProfilePath returns the path where the Azure Profile is stored from the Azure CLI diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go index 65ad0afc82d37..bd34f0ed5a581 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go @@ -64,7 +64,7 @@ func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator { } } } - return resp, fmt.Errorf("failed request: %s", err) + return resp, err }) } } diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go index f3a42bfc268d0..bfddd90b5bfa4 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/utility.go +++ b/vendor/github.com/Azure/go-autorest/autorest/utility.go @@ -218,9 +218,10 @@ func IsTokenRefreshError(err error) bool { return false } -// IsTemporaryNetworkError returns true if the specified error is a temporary network error. +// IsTemporaryNetworkError returns true if the specified error is a temporary network error or false +// if it's not. If the error doesn't implement the net.Error interface the return value is true. func IsTemporaryNetworkError(err error) bool { - if netErr, ok := err.(net.Error); ok && netErr.Temporary() { + if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { return true } return false diff --git a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go index d886e0b3fbfc9..ae987f8fae600 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go @@ -136,29 +136,29 @@ func validatePtr(x reflect.Value, v Constraint) error { func validateInt(x reflect.Value, v Constraint) error { i := x.Int() - r, ok := v.Rule.(int) + r, ok := toInt64(v.Rule) if !ok { return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) } switch v.Name { case MultipleOf: - if i%int64(r) != 0 { + if i%r != 0 { return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r)) } case ExclusiveMinimum: - if i <= int64(r) { + if i <= r { return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) } case ExclusiveMaximum: - if i >= int64(r) { + if i >= r { return createError(x, v, fmt.Sprintf("value must be less than %v", r)) } case InclusiveMinimum: - if i < int64(r) { + if i < r { return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) } case InclusiveMaximum: - if i > int64(r) { + if i > r { return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) } default: @@ -388,6 +388,17 @@ func createError(x reflect.Value, v Constraint, err string) error { v.Target, v.Name, getInterfaceValue(x), err) } +func toInt64(v interface{}) (int64, bool) { + if i64, ok := v.(int64); ok { + return i64, true + } + // older generators emit max constants as int, so if int64 fails fall back to int + if i32, ok := v.(int); ok { + return int64(i32), true + } + return 0, false +} + // NewErrorWithValidationError appends package type and method name in // validation error. // diff --git a/vendor/github.com/Azure/go-autorest/autorest/version.go b/vendor/github.com/Azure/go-autorest/autorest/version.go index d265055f51fb8..200bc0beb0025 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/version.go +++ b/vendor/github.com/Azure/go-autorest/autorest/version.go @@ -16,5 +16,5 @@ package autorest // Version returns the semantic version (see http://semver.org). func Version() string { - return "v10.8.1" + return "v10.11.4" } diff --git a/vendor/vendor.json b/vendor/vendor.json index da5ebdcdeb2da..9aefe3c695c23 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -3,372 +3,380 @@ "ignore": "test", "package": [ { - "checksumSHA1": "I1O9w4/hn+3DtQFbJrgwau5VOXI=", + "checksumSHA1": "v4/I1q4GGrkPUIcI0EDJgZp22bE=", "path": "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" - }, - { - "checksumSHA1": "jf0lz1wRA07ILyDujw/NzoU3kMA=", - "path": "github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2015-07-01/authorization", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "cL5VuAorqkBbkDvfOpB8Mh8Mm48=", "path": "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "jNqFdbZdsFgDH9xhq3fXNIk1+eM=", - "path": "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-04-02/cdn", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "qVMpxe1n/pINpOpjfaZDDtKpOO0=", + "path": "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "kM2PZfGUZRmE9wFeHAFjHFPepzk=", "path": "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "17kDQcToCpJ8yGuAd7nP1QkOO6M=", - "path": "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-02-01-preview/containerinstance", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "a/mbRxz450lwbacAUuG77DpKKJU=", + "path": "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-04-01/containerinstance", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "Uafz6z4ARTszbiN4lBDe9XzLvpc=", + "checksumSHA1": "A4GmPiUDP7xdTUYkvmO/Y3LPCZU=", "path": "github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "OS98xAxprza/yF/IQZqgM8QHf30=", - "path": "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2017-09-30/containerservice", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "YeeOckwfu556W2qPAIiulzeyelg=", + "path": "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2018-03-31/containerservice", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "xPqRAsuso4gp81HrMH1RnhbzfCk=", + "checksumSHA1": "BwC5MjJVKWsuReAvdMR4Fk1JNh0=", "path": "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" - }, - { - "checksumSHA1": "cdSthV7hZqJYRvbNwWuC0VFzn14=", - "path": "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "MsygGK8s34NdTsbkzvaqHgPLs6I=", + "checksumSHA1": "koKSQ4PgeyIgykEPNEeE2tzRm18=", "path": "github.com/Azure/azure-sdk-for-go/services/datalake/store/mgmt/2016-11-01/account", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "NieGKPVYPaCrPLxkzS+fEMidE3M=", - "path": "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "mdwBbEgubHb6UnwDspop+43Sx8k=", + "path": "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "wVJTMg87mLWoBmlniu/UA/YmVe4=", + "checksumSHA1": "5wH3Co0j2XLF+Tnml7Ky++Ves+s=", "path": "github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "x9ceW8JE2/FgODRSywClj0fRlh8=", "path": "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "XCm0kJwkGqkv1VL2gUNTU7PIK6o=", + "checksumSHA1": "D8B7LqvFSvImhWlkuv6tKbGrWPk=", "path": "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2017-07-01/devices", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "o1oH4ofWhXB67MoFvPDl5sl65j4=", + "checksumSHA1": "usYk7dQDADCaSYFlrjXtczH0/tA=", "path": "github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "IT8QxbA8sPbbCR79wiG9UxyRGEw=", + "checksumSHA1": "V8yVJJDoKLdBxvAHshfWc0N6oeA=", "path": "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "vAkF/ng9NforhX2dTdVfNWMZmKo=", - "path": "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2017-05-01-preview/insights", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "E+QgVQ3X1EvmDta96Xa2aPHrkt4=", + "path": "github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2018-03-01/insights", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "l5LiS1E96VhqOILV/TKh37eYbeg=", - "path": "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-04-30-preview/mysql", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "Juw5Pl5qUEN8CTEgDf+wgRfoYdc=", + "path": "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "wRmQ+EBPmpsb6NvjlBXE8Y/JSZA=", - "path": "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "Yw5zUEwDCvSlsnX4CQ36l6CjzPA=", + "path": "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "DzVfhx2cwj/AgX9m6fvrecc7VyU=", - "path": "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "8LqtzWEGPooyQjmmalXjJvdRGvE=", + "path": "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "0ubEDR8ye1PhBuUd5aVsGa3GLJs=", - "path": "github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "checksumSHA1": "e4hCajXDSuWNkUvwA35jMHGm20E=", + "path": "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "d0AbZFEWBxTD9kTLApajDviAra8=", - "path": "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql", + "checksumSHA1": "P+LV8DmKhBG0/ABMx1zrcRasYy4=", + "path": "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns", "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" + }, + { + "checksumSHA1": "QT7LrDyti+qDCjhxerYb8PwLfew=", + "path": "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" + }, + { + "checksumSHA1": "igbi1podNhH6Q6u4fiSG35bWVbg=", + "path": "github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" + }, + { + "checksumSHA1": "ZKp5VA/YRkH75e8KjQ90X7mKJMs=", + "path": "github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" + }, + { + "checksumSHA1": "jLzkSZFf/yBGECyJHTVOHN2oI2k=", + "path": "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql", + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "UWSnIzZywuEpEevbPfbPNLk1dFk=", "path": "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2016-06-01/recoveryservices", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "H9FyJDYC9FApeVyIl7eBnPusRlw=", + "checksumSHA1": "i/Nusgj1Ol8GAQKU3yCcVXQiBlg=", "path": "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "/Tlgqs81ToI+zz4miZcfu5yvZYU=", + "checksumSHA1": "hqDu8DOWFgIe/CHCGPdslDaOZu0=", "path": "github.com/Azure/azure-sdk-for-go/services/relay/mgmt/2017-04-01/relay", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "DJY5zDEcGa82/Hbfud8lgHCuvU4=", "path": "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "DQuP9Nzul8I8SN5fBg0NqWn124Q=", "path": "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "pn550P6giSwxXck8lRRaNOPwxaQ=", "path": "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-12-01/policy", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "G0pRv7MqqQwOFOg6IIaIoSWYwvY=", + "checksumSHA1": "q28aA1gZhbOTuhsePT1I39mnh2Y=", "path": "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "mIu5+RFHKL8U4H/6cQRiP2rUg9Q=", + "checksumSHA1": "kjEY8W+KrvGpfj5940Rbo2e4qwY=", "path": "github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "D6gwM+shQnzYSGV0EnvH+uduzIg=", + "checksumSHA1": "tEyc+LldSLEcCtr4nekzlLu6Mu0=", "path": "github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "47wZjqF3UfIT1Xs56kXJ11zpCNc=", + "checksumSHA1": "p9OIjwfjc8GARnzRcEoKbnXL//g=", "path": "github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "9CF6+vlasWn5NLNO3WGhLAFqp2w=", - "path": "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2015-05-01-preview/sql", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" - }, - { - "checksumSHA1": "Gtq0yrNJHVALuWjOKpHgLRvvgxA=", + "checksumSHA1": "ySkjHczHi2zN8B1TuWfvKVLGetw=", "path": "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { "checksumSHA1": "HhbwyLbz+/pbGSWb2cp+fAp6YsI=", "path": "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2017-05-01/trafficmanager", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "SuQHgkFuOrdDvajcGAImyzyb6+E=", + "checksumSHA1": "oG1Gtnb9nwoV/kOaZQQqxogbR2I=", "path": "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "NAkdZOb1m8R72Av84tCFDXxmD2Q=", + "checksumSHA1": "m3K3q/zhkmRtlIGWqMWgqzWR6C4=", "path": "github.com/Azure/azure-sdk-for-go/storage", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "E0PGco6Wn0cOyCgy9G2dC5O+yfs=", + "checksumSHA1": "Qm+SkjiiVK374BDnrC+CO2B08no=", "path": "github.com/Azure/azure-sdk-for-go/version", - "revision": "4650843026a7fdec254a8d9cf893693a254edd0b", - "revisionTime": "2018-05-04T19:14:26Z", - "version": "v16.2.1", - "versionExact": "v16.2.1" + "revision": "7971189ecf5a584b9211f2527737f94bb979644e", + "revisionTime": "2018-06-19T23:05:49Z", + "version": "=v17.4.0", + "versionExact": "v17.4.0" }, { - "checksumSHA1": "sQy6zpkumGcXs0QZLhYs8An1vlI=", + "checksumSHA1": "sSq0Y8TfUeQfTb9Xcah5cZWKxlY=", "path": "github.com/Azure/go-autorest/autorest", - "revision": "eaa7994b2278094c904d31993d26f56324db3052", - "revisionTime": "2018-05-02T23:02:43Z", - "version": "v10.8.1", - "versionExact": "v10.8.1" + "revision": "e6d2a85bbb5cd2a3162e4942594e1e520e442b0b", + "revisionTime": "2018-06-21T21:09:28Z", + "version": "=v10.11.4", + "versionExact": "v10.11.4" }, { - "checksumSHA1": "Xu6BOMnd2rZzabW6ld1yUrVjBQw=", + "checksumSHA1": "8Le1cIKIwLl6AIB7IxHZsm70HYI=", "path": "github.com/Azure/go-autorest/autorest/adal", - "revision": "eaa7994b2278094c904d31993d26f56324db3052", - "revisionTime": "2018-05-02T23:02:43Z", - "version": "v10.8.1", - "versionExact": "v10.8.1" + "revision": "e6d2a85bbb5cd2a3162e4942594e1e520e442b0b", + "revisionTime": "2018-06-21T21:09:28Z", + "version": "=v10.11.4", + "versionExact": "v10.11.4" }, { - "checksumSHA1": "vUHo41PG/G6Qq+vqD65l9KHFxUs=", + "checksumSHA1": "NT4tlDNlszWmb7gCXnYCkcvQxhs=", "path": "github.com/Azure/go-autorest/autorest/azure", - "revision": "eaa7994b2278094c904d31993d26f56324db3052", - "revisionTime": "2018-05-02T23:02:43Z", - "version": "v10.8.1", - "versionExact": "v10.8.1" + "revision": "e6d2a85bbb5cd2a3162e4942594e1e520e442b0b", + "revisionTime": "2018-06-21T21:09:28Z", + "version": "=v10.11.4", + "versionExact": "v10.11.4" }, { - "checksumSHA1": "+nXRwVB/JVEGe+oLsFhCmSkKPuI=", + "checksumSHA1": "Fkezj7ch01wYNvXzQZdhmeSf/mk=", "path": "github.com/Azure/go-autorest/autorest/azure/cli", - "revision": "eaa7994b2278094c904d31993d26f56324db3052", - "revisionTime": "2018-05-02T23:02:43Z", - "version": "v10.8.1", - "versionExact": "v10.8.1" + "revision": "e6d2a85bbb5cd2a3162e4942594e1e520e442b0b", + "revisionTime": "2018-06-21T21:09:28Z", + "version": "=v10.11.4", + "versionExact": "v10.11.4" }, { "checksumSHA1": "9nXCi9qQsYjxCeajJKWttxgEt0I=", "path": "github.com/Azure/go-autorest/autorest/date", - "revision": "eaa7994b2278094c904d31993d26f56324db3052", - "revisionTime": "2018-05-02T23:02:43Z", - "version": "v10.8.1", - "versionExact": "v10.8.1" + "revision": "e6d2a85bbb5cd2a3162e4942594e1e520e442b0b", + "revisionTime": "2018-06-21T21:09:28Z", + "version": "=v10.11.4", + "versionExact": "v10.11.4" }, { "checksumSHA1": "SbBb2GcJNm5GjuPKGL2777QywR4=", "path": "github.com/Azure/go-autorest/autorest/to", - "revision": "eaa7994b2278094c904d31993d26f56324db3052", - "revisionTime": "2018-05-02T23:02:43Z", - "version": "v10.8.1", - "versionExact": "v10.8.1" + "revision": "e6d2a85bbb5cd2a3162e4942594e1e520e442b0b", + "revisionTime": "2018-06-21T21:09:28Z", + "version": "=v10.11.4", + "versionExact": "v10.11.4" }, { - "checksumSHA1": "5UH4IFIB/98iowPCzzVs4M4MXiQ=", + "checksumSHA1": "HjdLfAF3oA2In8F3FKh/Y+BPyXk=", "path": "github.com/Azure/go-autorest/autorest/validation", - "revision": "eaa7994b2278094c904d31993d26f56324db3052", - "revisionTime": "2018-05-02T23:02:43Z", - "version": "v10.8.1", - "versionExact": "v10.8.1" + "revision": "e6d2a85bbb5cd2a3162e4942594e1e520e442b0b", + "revisionTime": "2018-06-21T21:09:28Z", + "version": "=v10.11.4", + "versionExact": "v10.11.4" }, { "checksumSHA1": "jQh1fnoKPKMURvKkpdRjN695nAQ=", diff --git a/website/azurerm.erb b/website/azurerm.erb index 6af6e02ffd276..8bb6e699f48ab 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -300,10 +300,14 @@ azurerm_image - > + > azurerm_virtual_machine + > + azurerm_virtual_machine_data_disk_attachment + + > azurerm_virtual_machine_extension @@ -433,6 +437,10 @@ azurerm_dns_aaaa_record + > + azurerm_dns_caa_record + + > azurerm_dns_cname_record @@ -741,10 +749,15 @@ > Scheduler Resources + > diff --git a/website/docs/d/app_service.html.markdown b/website/docs/d/app_service.html.markdown index d8c24f8ad2fe1..b8343f9cead68 100644 --- a/website/docs/d/app_service.html.markdown +++ b/website/docs/d/app_service.html.markdown @@ -47,8 +47,6 @@ output "app_service_id" { * `https_only` - Can the App Service only be accessed via HTTPS? -* `ip_restriction` - A `ip_restriction` block as defined below. - * `site_config` - A `site_config` block as defined below. * `tags` - A mapping of tags to assign to the resource. @@ -65,14 +63,6 @@ output "app_service_id" { --- -`ip_restriction` exports the following: - -* `ip_address` - The IP Address used for this IP Restriction. - -* `subnet_mask` - The Subnet mask used for this IP Restriction. - ---- - `site_config` supports the following: * `always_on` - Is the app be loaded at all times? @@ -83,6 +73,8 @@ output "app_service_id" { * `http2_enabled` - Is HTTP2 Enabled on this App Service? +* `ip_restriction` - One or more `ip_restriction` blocks as defined below. + * `java_version` - The version of Java in use. * `java_container` - The Java Container in use. @@ -106,3 +98,11 @@ output "app_service_id" { * `use_32_bit_worker_process` - Does the App Service run in 32 bit mode, rather than 64 bit mode? * `websockets_enabled` - Are WebSockets enabled for this App Service? + +--- + +`ip_restriction` exports the following: + +* `ip_address` - The IP Address used for this IP Restriction. + +* `subnet_mask` - The Subnet mask used for this IP Restriction. diff --git a/website/docs/d/cosmosdb_account.html.markdown b/website/docs/d/cosmosdb_account.html.markdown index f54923fb92174..2ded09f0608f7 100644 --- a/website/docs/d/cosmosdb_account.html.markdown +++ b/website/docs/d/cosmosdb_account.html.markdown @@ -49,6 +49,8 @@ The following attributes are exported: * `enable_automatic_failover` - If automatic failover is enabled for this CosmosDB Account. +* `capabilities` - Capabilities enabled on this Cosmos DB account. + `consistency_policy` The current consistency Settings for this CosmosDB account with the following properties: * `consistency_level` - The Consistency Level used by this CosmosDB Account. diff --git a/website/docs/d/dns_zone.html.markdown b/website/docs/d/dns_zone.html.markdown index 02f097d3b1caf..fee64f51e02cc 100644 --- a/website/docs/d/dns_zone.html.markdown +++ b/website/docs/d/dns_zone.html.markdown @@ -38,4 +38,7 @@ in your subscription that matches `name` will be returned. * `max_number_of_record_sets` - Maximum number of Records in the zone. * `number_of_record_sets` - The number of records already in the zone. * `name_servers` - A list of values that make up the NS record for the zone. +* `zone_type` - The type of this DNS zone, such as `Public` or `Private`. +* `registration_virtual_network_ids` - A list of Virtual Network ID's that register hostnames in this DNS zone. +* `resolution_virtual_network_ids` - A list of Virtual Network ID's that resolve records in this DNS zone. * `tags` - A mapping of tags to assign to the EventHub Namespace. diff --git a/website/docs/d/key_vault_access_policy.html.markdown b/website/docs/d/key_vault_access_policy.html.markdown index ca2f2908b6ee7..c9fd217359095 100644 --- a/website/docs/d/key_vault_access_policy.html.markdown +++ b/website/docs/d/key_vault_access_policy.html.markdown @@ -24,7 +24,7 @@ output "access_policy_key_permissions" { ## Argument Reference -* `name` - (Required) Specifies the name of the Management Tempalte. Possible values are: `Key Management`, +* `name` - (Required) Specifies the name of the Management Template. Possible values are: `Key Management`, `Secret Management`, `Certificate Management`, `Key & Secret Management`, `Key & Certificate Management`, `Secret & Certificate Management`, `Key, Secret, & Certificate Management` diff --git a/website/docs/d/scheduler_job_collection.html.markdown b/website/docs/d/scheduler_job_collection.html.markdown index 83727ba78864b..896c2c7ed8aa9 100644 --- a/website/docs/d/scheduler_job_collection.html.markdown +++ b/website/docs/d/scheduler_job_collection.html.markdown @@ -1,7 +1,7 @@ --- layout: "azurerm" page_title: "Azure Resource Manager: azurerm_scheduler_job_collection" -sidebar_current: "docs-azurerm-datasource-scheduler_job_collection" +sidebar_current: "docs-azurerm-datasource-scheduler-job-collection" description: |- Get information about the specified scheduler job collection. --- diff --git a/website/docs/d/storage_account.html.markdown b/website/docs/d/storage_account.html.markdown index ee1c5c6767208..340dc1c43322d 100644 --- a/website/docs/d/storage_account.html.markdown +++ b/website/docs/d/storage_account.html.markdown @@ -35,13 +35,13 @@ output "storage_account_tier" { * `location` - The Azure location where the Storage Account exists -* `account_kind` - Defines the Kind of account, either `BlobStorage` or `Storage`. +* `account_kind` - The Kind of account. -* `account_tier` - Defines the Tier of this storage account. +* `account_tier` - The Tier of this storage account. -* `account_replication_type` - Defines the type of replication used for this storage account. +* `account_replication_type` - The type of replication used for this storage account. -* `access_tier` - Defines the access tier for `BlobStorage` accounts. +* `access_tier` - The access tier for `BlobStorage` accounts. * `enable_blob_encryption` - Are Encryption Services are enabled for Blob storage? See [here](https://azure.microsoft.com/en-us/documentation/articles/storage-service-encryption/) for more information. diff --git a/website/docs/d/storage_account_sas.html.markdown b/website/docs/d/storage_account_sas.html.markdown index 0a1951c130dd7..fa9d1390ef85b 100644 --- a/website/docs/d/storage_account_sas.html.markdown +++ b/website/docs/d/storage_account_sas.html.markdown @@ -65,7 +65,7 @@ data "azurerm_storage_account_sas" "test" { } output "sas_url_query_string" { - value = "${data.azurerm_storage_account_sas.sas}" + value = "${data.azurerm_storage_account_sas.test.sas}" } ``` @@ -73,7 +73,7 @@ output "sas_url_query_string" { * `connection_string` - (Required) The connection string for the storage account to which this SAS applies. Typically directly from the `primary_connection_string` attribute of a terraform created `azurerm_storage_account` resource. * `https_only` - (Optional) Only permit `https` access. If `false`, both `http` and `https` are permitted. Defaults to `true`. -* `resouce_types` - (Required) A `resource_types` block as defined below. +* `resource_types` - (Required) A `resource_types` block as defined below. * `services` - (Required) A `services` block as defined below. * `start` - (Required) The starting time and date of validity of this SAS. Must be a valid ISO-8601 format time/date string. * `expiry` - (Required) The expiration time and date of this SAS. Must be a valid ISO-8601 format time/date string. diff --git a/website/docs/d/subscriptions.html.markdown b/website/docs/d/subscriptions.html.markdown index 2faf4755deadc..3cc6393522705 100644 --- a/website/docs/d/subscriptions.html.markdown +++ b/website/docs/d/subscriptions.html.markdown @@ -6,9 +6,9 @@ description: |- Get information about the available subscriptions. --- -# Data Source: azurerm_subscription +# Data Source: azurerm_subscriptions -Use this data source to access a list of all Azure subscription currently available. +Use this data source to access a list of all Azure subscriptions currently available. ## Example Usage diff --git a/website/docs/r/app_service.html.markdown b/website/docs/r/app_service.html.markdown index 98a344a6a61b9..798939f8d0b42 100644 --- a/website/docs/r/app_service.html.markdown +++ b/website/docs/r/app_service.html.markdown @@ -127,8 +127,6 @@ The following arguments are supported: * `https_only` - (Optional) Can the App Service only be accessed via HTTPS? Defaults to `false`. -* `ip_restriction` - (Optional) A `ip_restriction` block as defined below. - * `site_config` - (Optional) A `site_config` block as defined below. * `tags` - (Optional) A mapping of tags to assign to the resource. @@ -153,20 +151,13 @@ The following arguments are supported: --- -`ip_restriction` supports the following: - -* `ip_address` - (Required) 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`. - ---- - `site_config` supports the following: * `always_on` - (Optional) Should the app be loaded at all times? Defaults to `false`. * `default_documents` - (Optional) The ordering of default documents to load, if an address isn't specified. -* `dotnet_framework_version` - (Optional) The version of the .net framework's CLR used in this App Service. Possible values are `v2.0` (which will use the latest version of the .net framework for the .net CLR v2 - currently `.net 3.5`) and `v4.0` (which corresponds to the latest version of the .net CLR v4 - which at the time of writing is `.net 4.7.1`). [For more information on which .net CLR version to use based on the .net framework you're targetting - please see this table](https://en.wikipedia.org/wiki/.NET_Framework_version_history#Overview). Defaults to `v4.0`. +* `dotnet_framework_version` - (Optional) The version of the .net framework's CLR used in this App Service. Possible values are `v2.0` (which will use the latest version of the .net framework for the .net CLR v2 - currently `.net 3.5`) and `v4.0` (which corresponds to the latest version of the .net CLR v4 - which at the time of writing is `.net 4.7.1`). [For more information on which .net CLR version to use based on the .net framework you're targeting - please see this table](https://en.wikipedia.org/wiki/.NET_Framework_version_history#Overview). Defaults to `v4.0`. * `http2_enabled` - (Optional) Is HTTP2 Enabled on this App Service? Defaults to `false`. +* `ip_restriction` - (Optional) One or more `ip_restriction` blocks as defined below. * `java_version` - (Optional) The version of Java to use. If specified `java_container` and `java_container_version` must also be specified. Possible values are `1.7` and `1.8`. * `java_container` - (Optional) The Java Container to use. If specified `java_version` and `java_container_version` must also be specified. Possible values are `JETTY` and `TOMCAT`. * `java_container_version` - (Optional) The version of the Java Container to use. If specified `java_version` and `java_container` must also be specified. @@ -189,6 +180,14 @@ The following arguments are supported: ~> **NOTE:** Additional Source Control types will be added in the future, once support for them has been added in the Azure SDK for Go. +--- + +`ip_restriction` supports the following: + +* `ip_address` - (Required) 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: @@ -213,6 +212,8 @@ The following attributes are exported: * `tenant_id` - The Tenant ID for the Service Principal associated with the Managed Service Identity of this App Service. +-> You can access the Principal ID via `${azurerm_app_service.test.identity.0.principal_id}` and the Tenant ID via `${azurerm_app_service.test.identity.0.principal_id}` + --- `site_credential` exports the following: diff --git a/website/docs/r/app_service_slot.html.markdown b/website/docs/r/app_service_slot.html.markdown index f53326f69871a..c918bbde5cdbb 100644 --- a/website/docs/r/app_service_slot.html.markdown +++ b/website/docs/r/app_service_slot.html.markdown @@ -182,8 +182,9 @@ The following arguments are supported: * `always_on` - (Optional) Should the app be loaded at all times? Defaults to `false`. * `default_documents` - (Optional) The ordering of default documents to load, if an address isn't specified. -* `dotnet_framework_version` - (Optional) The version of the .net framework's CLR used in this App Service Slot. Possible values are `v2.0` (which will use the latest version of the .net framework for the .net CLR v2 - currently `.net 3.5`) and `v4.0` (which corresponds to the latest version of the .net CLR v4 - which at the time of writing is `.net 4.7.1`). [For more information on which .net CLR version to use based on the .net framework you're targetting - please see this table](https://en.wikipedia.org/wiki/.NET_Framework_version_history#Overview). Defaults to `v4.0`. +* `dotnet_framework_version` - (Optional) The version of the .net framework's CLR used in this App Service Slot. Possible values are `v2.0` (which will use the latest version of the .net framework for the .net CLR v2 - currently `.net 3.5`) and `v4.0` (which corresponds to the latest version of the .net CLR v4 - which at the time of writing is `.net 4.7.1`). [For more information on which .net CLR version to use based on the .net framework you're targeting - please see this table](https://en.wikipedia.org/wiki/.NET_Framework_version_history#Overview). Defaults to `v4.0`. * `http2_enabled` - (Optional) Is HTTP2 Enabled on this App Service? Defaults to `false`. +* `ip_restriction` - (Optional) One or more `ip_restriction` blocks as defined below. * `java_version` - (Optional) The version of Java to use. If specified `java_container` and `java_container_version` must also be specified. Possible values are `1.7` and `1.8`. * `java_container` - (Optional) The Java Container to use. If specified `java_version` and `java_container_version` must also be specified. Possible values are `JETTY` and `TOMCAT`. * `java_container_version` - (Optional) The version of the Java Container to use. If specified `java_version` and `java_container` must also be specified. @@ -203,6 +204,14 @@ The following arguments are supported: * `websockets_enabled` - (Optional) Should WebSockets be enabled? +--- + +`ip_restriction` supports the following: + +* `ip_address` - (Required) 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/application_gateway.html.markdown b/website/docs/r/application_gateway.html.markdown index 86410247fd49f..035c6edfc94f8 100644 --- a/website/docs/r/application_gateway.html.markdown +++ b/website/docs/r/application_gateway.html.markdown @@ -1,14 +1,14 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_application_gateway" +page_title: "Azure Resource Manager: azurerm_application_gateway" sidebar_current: "docs-azurerm-resource-application-gateway" description: |- - Creates a new application gateway based on a previously created virtual network with configured subnets. + Manages a application gateway based on a previously created virtual network with configured subnets. --- # azurerm_application_gateway -Creates a new application gateway based on a previously created virtual network with configured subnets. +Manages a application gateway based on a previously created virtual network with configured subnets. ## Example Usage @@ -217,8 +217,8 @@ The `backend_http_settings` block supports: * `probe_name` - (Optional) Reference to URL probe. * `authentication_certificate` - (Optional) - A list of `authentication_certificate` references for the `backend_http_setting` to use. Each element consists of: - - * `name` (Required) + + * `name` (Required) * `id` (Calculated) The `http_listener` block supports: @@ -262,6 +262,11 @@ The `probe` block supports: * `unhealthy_threshold` - (Required) Probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Minimum 1 second and Maximum 20. +* `match` - (Optional) Probe health response match. + + * `body` - (Optional) Body that must be contained in the health response. Defaults to "*" + * `status_code` - (Optional) Allowed health response status codes. + The `request_routing_rule` block supports: * `name` - (Required) User defined name for a request routing rule. diff --git a/website/docs/r/application_insights.html.markdown b/website/docs/r/application_insights.html.markdown index 4f82de909c59d..69041b5c420a0 100644 --- a/website/docs/r/application_insights.html.markdown +++ b/website/docs/r/application_insights.html.markdown @@ -6,7 +6,7 @@ description: |- Create an Application Insights component. --- -# azurerm\_application\_insights +# azurerm_application_insights Create an Application Insights component. diff --git a/website/docs/r/automation_account.html.markdown b/website/docs/r/automation_account.html.markdown index 3609a58145255..7e64e472290a3 100644 --- a/website/docs/r/automation_account.html.markdown +++ b/website/docs/r/automation_account.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_automation_account" sidebar_current: "docs-azurerm-resource-automation-account" description: |- - Creates a new Automation Account. + Manages a Automation Account. --- -# azurerm\_automation\_account +# azurerm_automation_account -Creates a new Automation Account. +Manages a Automation Account. ## Example Usage diff --git a/website/docs/r/automation_credential.html.markdown b/website/docs/r/automation_credential.html.markdown index ed2ebcdedf4a7..e1811c13731b3 100644 --- a/website/docs/r/automation_credential.html.markdown +++ b/website/docs/r/automation_credential.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_automation_credential" sidebar_current: "docs-azurerm-resource-automation-credential" description: |- - Creates a new Automation Credential. + Manages a Automation Credential. --- -# azurerm\_automation\_credential +# azurerm_automation_credential -Creates a new Automation Credential. +Manages a Automation Credential. ## Example Usage diff --git a/website/docs/r/automation_runbook.html.markdown b/website/docs/r/automation_runbook.html.markdown index 80303da114b29..4ee9e8d512a47 100644 --- a/website/docs/r/automation_runbook.html.markdown +++ b/website/docs/r/automation_runbook.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_automation_runbook" sidebar_current: "docs-azurerm-resource-automation-runbook" description: |- - Creates a new Automation Runbook. + Manages a Automation Runbook. --- -# azurerm\_automation\_runbook +# azurerm_automation_runbook -Creates a new Automation Runbook. +Manages a Automation Runbook. ## Example Usage diff --git a/website/docs/r/automation_schedule.html.markdown b/website/docs/r/automation_schedule.html.markdown index 26ddfbc0f8873..0d0180ecaf1a0 100644 --- a/website/docs/r/automation_schedule.html.markdown +++ b/website/docs/r/automation_schedule.html.markdown @@ -3,23 +3,23 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_automation_schedule" sidebar_current: "docs-azurerm-resource-automation-schedule" description: |- - Creates a new Automation Schedule. + Manages a Automation Schedule. --- -# azurerm\_automation\_schedule +# azurerm_automation_schedule -Creates a new Automation Schedule. +Manages a Automation Schedule. ## Example Usage ```hcl resource "azurerm_resource_group" "example" { - name = "resourceGroup1" + name = "tfex-automation-account" location = "West Europe" } resource "azurerm_automation_account" "example" { - name = "account1" + name = "tfex-automation-account" location = "${azurerm_resource_group.example.location}" resource_group_name = "${azurerm_resource_group.example.name}" sku { @@ -28,13 +28,14 @@ resource "azurerm_automation_account" "example" { } resource "azurerm_automation_schedule" "example" { - name = "schedule1" - resource_group_name = "${azurerm_resource_group.example.name}" - account_name = "${azurerm_automation_account.example.name}" - frequency = "OneTime" - timezone = "Central Europe Standard Time" - start_time = "2014-04-15T18:00:15+02:00" - description = "This is an example schedule" + name = "tfex-automation-schedule" + resource_group_name = "${azurerm_resource_group.example.name}" + automation_account_name = "${azurerm_automation_account.example.name}" + frequency = "Hour" + interval = 1 + timezone = "Central Europe Standard Time" + start_time = "2014-04-15T18:00:15+02:00" + description = "This is an example schedule" } ``` @@ -46,17 +47,19 @@ The following arguments are supported: * `resource_group_name` - (Required) The name of the resource group in which the Schedule is created. Changing this forces a new resource to be created. -* `account_name` - (Required) The name of the automation account in which the Schedule is created. Changing this forces a new resource to be created. +* `automation_account_name` - (Required) The name of the automation account in which the Schedule is created. Changing this forces a new resource to be created. + +* `frequency` - (Required) The frequency of the schedule. - can be either `OneTime`, `Day`, `Hour`, `Week`, or `Month`. * `description` - (Optional) A description for this Schedule. -* `start_time` - (Required) Start time of the schedule. Must be at least five minutes in the future. +* `interval` - (Optional) The number of `frequency`s between runs. Only valid for `Day`, `Hour`, `Week`, or `Month` and defaults to `1`. -* `expiry_time` - (Optional) The end time of the schedule. +* `start_time` - (Optional) Start time of the schedule. Must be at least five minutes in the future. Defaults to seven minutes in the future from the time the resource is created. -* `frequency` - (Required) The frequency of the schedule. - can be either `OneTime`, `Day`, `Hour`, `Week`, or `Month`. +* `expiry_time` - (Optional) The end time of the schedule. -* `timezone` - (Optional) The timezone of the start time. For possible values see: https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx +* `timezone` - (Optional) The timezone of the start time. Defaults to `UTC`. For possible values see: https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx ## Attributes Reference diff --git a/website/docs/r/cdn_profile.html.markdown b/website/docs/r/cdn_profile.html.markdown index 3dff6de7826c8..ae7369d873a6d 100644 --- a/website/docs/r/cdn_profile.html.markdown +++ b/website/docs/r/cdn_profile.html.markdown @@ -6,7 +6,7 @@ description: |- Create a CDN Profile to create a collection of CDN Endpoints. --- -# azurerm\_cdn\_profile +# azurerm_cdn_profile Create a CDN Profile to create a collection of CDN Endpoints. @@ -43,7 +43,7 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -* `sku` - (Required) The pricing related information of current CDN profile. Accepted values are `Standard_Verizon`, `Standard_Akamai` or `Premium_Verizon`. +* `sku` - (Required) The pricing related information of current CDN profile. Accepted values are `Standard_Akamai`, `Standard_ChinaCdn`, `Standard_Microsoft`, `Standard_Verizon` or `Premium_Verizon`. * `tags` - (Optional) A mapping of tags to assign to the resource. diff --git a/website/docs/r/container_group.html.markdown b/website/docs/r/container_group.html.markdown index ed844d63f11c8..2f98942e95a9b 100644 --- a/website/docs/r/container_group.html.markdown +++ b/website/docs/r/container_group.html.markdown @@ -6,7 +6,7 @@ description: |- Create as an Azure Container Group instance. --- -# azurerm\_container\_group +# azurerm_container_group Create as an Azure Container Group instance. diff --git a/website/docs/r/container_registry.html.markdown b/website/docs/r/container_registry.html.markdown index 950dc5f53410f..34cb23d6f5570 100644 --- a/website/docs/r/container_registry.html.markdown +++ b/website/docs/r/container_registry.html.markdown @@ -3,12 +3,13 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_container_registry" sidebar_current: "docs-azurerm-resource-container-registry" description: |- - Create as an Azure Container Registry instance. + Manages an Azure Container Registry. + --- -# azurerm\_container\_registry +# azurerm_container_registry -Create as an Azure Container Registry instance. +Manages an Azure Container Registry. ~> **Note:** All arguments including the access key will be stored in the raw state as plain-text. [Read more about sensitive data in state](/docs/state/sensitive-data.html). @@ -43,11 +44,9 @@ resource "azurerm_container_registry" "test" { The following arguments are supported: -* `name` - (Required) Specifies the name of the Container Registry. Changing this forces a - new resource to be created. +* `name` - (Required) Specifies the name of the Container Registry. Changing this forces a new resource to be created. -* `resource_group_name` - (Required) The name of the resource group in which to - create the Container Registry. +* `resource_group_name` - (Required) The name of the resource group in which to create the Container Registry. 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. diff --git a/website/docs/r/container_service.html.markdown b/website/docs/r/container_service.html.markdown index 3bb626b8e33f9..26c6bec3da545 100644 --- a/website/docs/r/container_service.html.markdown +++ b/website/docs/r/container_service.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_container_service" sidebar_current: "docs-azurerm-resource-container-service" description: |- - Creates an Azure Container Service instance. + Manages an Azure Container Service instance. --- -# azurerm\_container\_service +# azurerm_container_service -Creates an Azure Container Service Instance +Manages an Azure Container Service Instance ~> **Note:** All arguments including the client secret will be stored in the raw state as plain-text. [Read more about sensitive data in state](/docs/state/sensitive-data.html). diff --git a/website/docs/r/cosmosdb_account.html.markdown b/website/docs/r/cosmosdb_account.html.markdown index becd31c93e0e9..2e25536cc37aa 100644 --- a/website/docs/r/cosmosdb_account.html.markdown +++ b/website/docs/r/cosmosdb_account.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_cosmosdb_account" sidebar_current: "docs-azurerm-resource-cosmosdb-account" description: |- - Creates a new CosmosDB (formally DocumentDB) Account. + Manages a CosmosDB (formally DocumentDB) Account. --- -# azurerm\_cosmos\_db\_account +# azurerm_cosmos_db_account -Creates a new CosmosDB (formally DocumentDB) Account. +Manages a CosmosDB (formally DocumentDB) Account. ## Example Usage @@ -75,6 +75,8 @@ The following arguments are supported: * `enable_automatic_failover` - (Optional) Enable automatic fail over for this Cosmos DB account. +* `capabilities` - (Optional) Enable capabilities for this Cosmos DB account. Possible values are `EnableTable` and `EnableGremlin`. + `consistency_policy` 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`. @@ -85,7 +87,7 @@ The following arguments are supported: `geo_location` Configures the geographic locations the data is replicated to and supports the following: -* `prefix` - (Optional) The string used to generate the document enpoints for this region. If not specified it defaults to `${cosmosdb_account.name}-${location}`. Changing this causes the location to be deleted and re-provisioned and cannot be changed for the location with failover priority `0`. +* `prefix` - (Optional) The string used to generate the document endpoints for this region. If not specified it defaults to `${cosmosdb_account.name}-${location}`. Changing this causes the location to be deleted and re-provisioned and cannot be changed for the location with failover priority `0`. * `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`. diff --git a/website/docs/r/data_lake_store.html.markdown b/website/docs/r/data_lake_store.html.markdown index c7b09aec68541..6c7213c664505 100644 --- a/website/docs/r/data_lake_store.html.markdown +++ b/website/docs/r/data_lake_store.html.markdown @@ -49,7 +49,7 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -* `tier` - (Optional) The monnthly commitment tier for Data Lake Store. Accepted values are `Consumption`, `Commitment_1TB`, `Commitment_10TB`, `Commitment_100TB`, `Commitment_500TB`, `Commitment_1PB` or `Commitment_5PB`. +* `tier` - (Optional) The monthly commitment tier for Data Lake Store. Accepted values are `Consumption`, `Commitment_1TB`, `Commitment_10TB`, `Commitment_100TB`, `Commitment_500TB`, `Commitment_1PB` or `Commitment_5PB`. * `tags` - (Optional) A mapping of tags to assign to the resource. diff --git a/website/docs/r/dns_a_record.html.markdown b/website/docs/r/dns_a_record.html.markdown index 1b932530d4e7e..7c91781ec84ea 100644 --- a/website/docs/r/dns_a_record.html.markdown +++ b/website/docs/r/dns_a_record.html.markdown @@ -6,7 +6,7 @@ description: |- Create a DNS A Record. --- -# azurerm\_dns\_a\_record +# azurerm_dns_a_record Enables you to manage DNS A Records within Azure DNS. diff --git a/website/docs/r/dns_aaaa_record.html.markdown b/website/docs/r/dns_aaaa_record.html.markdown index 0b226b14002ec..bdbcc94fe03ee 100644 --- a/website/docs/r/dns_aaaa_record.html.markdown +++ b/website/docs/r/dns_aaaa_record.html.markdown @@ -6,7 +6,7 @@ description: |- Create a DNS AAAA Record. --- -# azurerm\_dns\_aaaa\_record +# azurerm_dns_aaaa_record Enables you to manage DNS AAAA Records within Azure DNS. diff --git a/website/docs/r/dns_caa_record.html.markdown b/website/docs/r/dns_caa_record.html.markdown new file mode 100644 index 0000000000000..ccb6c31ad5fa0 --- /dev/null +++ b/website/docs/r/dns_caa_record.html.markdown @@ -0,0 +1,97 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_dns_caa_record" +sidebar_current: "docs-azurerm-resource-dns-caa-record" +description: |- + Manage a DNS CAA Record. +--- + +# azurerm_dns_caa_record + +Enables you to manage DNS CAA Records within Azure DNS. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "test" { + name = "acceptanceTestResourceGroup1" + location = "West US" +} + +resource "azurerm_dns_zone" "test" { + name = "mydomain.com" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dns_caa_record" "test" { + name = "test" + zone_name = "${azurerm_dns_zone.test.name}" + resource_group_name = "${azurerm_resource_group.test.name}" + ttl = 300 + + record { + flags = 0 + tag = "issue" + value = "example.com" + } + + record { + flags = 0 + tag = "issue" + value = "example.net" + } + + record { + flags = 0 + tag = "issuewild" + value = ";" + } + + record { + flags = 0 + tag = "iodef" + value = "mailto:terraform@nonexisting.tld" + } + + tags { + Environment = "Production" + } +} +``` +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the DNS CAA Record. + +* `resource_group_name` - (Required) Specifies the resource group where the resource exists. Changing this forces a new resource to be created. + +* `zone_name` - (Required) Specifies the 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. + +* `record` - (Required) A list of values that make up the CAA record. Each `record` block supports fields documented below. + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +The `record` block supports: + +* `flags` - (Required) Extensible CAA flags, currently only 1 is implemented to set the issuer critical flag. + +* `tag` - (Required) A property tag, options are issue, issuewild and iodef. + +* `value` - (Required) A property value such as a registrar domain. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The DNS CAA Record ID. + +## Import + +CAA records can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_dns_caa_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/CAA/myrecord1 +``` diff --git a/website/docs/r/dns_cname_record.html.markdown b/website/docs/r/dns_cname_record.html.markdown index 2dff886f9f98e..ffbed2c4014d8 100644 --- a/website/docs/r/dns_cname_record.html.markdown +++ b/website/docs/r/dns_cname_record.html.markdown @@ -6,7 +6,7 @@ description: |- Create a DNS CNAME Record. --- -# azurerm\_dns\_cname\_record +# azurerm_dns_cname_record Enables you to manage DNS CNAME Records within Azure DNS. diff --git a/website/docs/r/dns_mx_record.html.markdown b/website/docs/r/dns_mx_record.html.markdown index b96549bcf3b93..fb4e0c365809c 100644 --- a/website/docs/r/dns_mx_record.html.markdown +++ b/website/docs/r/dns_mx_record.html.markdown @@ -6,7 +6,7 @@ description: |- Manage a DNS MX Record. --- -# azurerm\_dns\_mx\_record +# azurerm_dns_mx_record Enables you to manage DNS MX Records within Azure DNS. @@ -56,7 +56,7 @@ The following arguments are supported: * `ttl` - (Required) The Time To Live (TTL) of the DNS record. -* `record` - (Required) A list of values that make up the SRV record. Each `record` block supports fields documented below. +* `record` - (Required) A list of values that make up the MX record. Each `record` block supports fields documented below. * `tags` - (Optional) A mapping of tags to assign to the resource. diff --git a/website/docs/r/dns_ns_record.html.markdown b/website/docs/r/dns_ns_record.html.markdown index 2a8b8f0f1f092..f877dd2dc8492 100644 --- a/website/docs/r/dns_ns_record.html.markdown +++ b/website/docs/r/dns_ns_record.html.markdown @@ -6,7 +6,7 @@ description: |- Create a DNS NS Record. --- -# azurerm\_dns\_ns\_record +# azurerm_dns_ns_record Enables you to manage DNS NS Records within Azure DNS. @@ -29,13 +29,7 @@ resource "azurerm_dns_ns_record" "test" { resource_group_name = "${azurerm_resource_group.test.name}" ttl = 300 - record { - nsdname = "ns1.contoso.com" - } - - record { - nsdname = "ns2.contoso.com" - } + records = ["ns1.contoso.com", "ns2.contoso.com"] tags { Environment = "Production" @@ -54,7 +48,9 @@ The following arguments are supported: * `ttl` - (Required) The Time To Live (TTL) of the DNS record. -* `record` - (Required) A list of values that make up the NS record. Each `record` block supports fields documented below. +* `records` - (Optional) A list of values that make up the NS record. *WARNING*: Either `records` or `record` is required. + +* `record` - (Optional) A list of values that make up the NS record. Each `record` block supports fields documented below. This field has been deprecated and will be removed in a future release. * `tags` - (Optional) A mapping of tags to assign to the resource. diff --git a/website/docs/r/dns_ptr_record.html.markdown b/website/docs/r/dns_ptr_record.html.markdown index d0dd172209cb2..c87294f440714 100644 --- a/website/docs/r/dns_ptr_record.html.markdown +++ b/website/docs/r/dns_ptr_record.html.markdown @@ -6,7 +6,7 @@ description: |- Create a DNS PTR Record. --- -# azurerm\_dns\_ptr\_record +# azurerm_dns_ptr_record Enables you to manage DNS PTR Records within Azure DNS. diff --git a/website/docs/r/dns_srv_record.html.markdown b/website/docs/r/dns_srv_record.html.markdown index f2d63ef723956..944c725c31208 100644 --- a/website/docs/r/dns_srv_record.html.markdown +++ b/website/docs/r/dns_srv_record.html.markdown @@ -6,7 +6,7 @@ description: |- Manage a DNS SRV Record. --- -# azurerm\_dns\_srv\_record +# azurerm_dns_srv_record Enables you to manage DNS SRV Records within Azure DNS. diff --git a/website/docs/r/dns_txt_record.html.markdown b/website/docs/r/dns_txt_record.html.markdown index 35af3834ed3ba..de198b2ac3c7c 100644 --- a/website/docs/r/dns_txt_record.html.markdown +++ b/website/docs/r/dns_txt_record.html.markdown @@ -6,7 +6,7 @@ description: |- Create a DNS TXT Record. --- -# azurerm\_dns\_txt\_record +# azurerm_dns_txt_record Enables you to manage DNS TXT Records within Azure DNS. diff --git a/website/docs/r/dns_zone.html.markdown b/website/docs/r/dns_zone.html.markdown index 2b0514351162d..baa2d357d913f 100644 --- a/website/docs/r/dns_zone.html.markdown +++ b/website/docs/r/dns_zone.html.markdown @@ -6,7 +6,7 @@ description: |- Create a DNS Zone. --- -# azurerm\_dns\_zone +# azurerm_dns_zone Enables you to manage DNS zones within Azure DNS. These zones are hosted on Azure's name servers to which you can delegate the zone from the parent domain. @@ -21,6 +21,13 @@ resource "azurerm_resource_group" "test" { resource "azurerm_dns_zone" "test" { name = "mydomain.com" resource_group_name = "${azurerm_resource_group.test.name}" + zone_type = "Public" +} + +resource "azurerm_dns_zone" "test_private" { + name = "mydomain.com" + resource_group_name = "${azurerm_resource_group.test.name}" + zone_type = "Private" } ``` ## Argument Reference @@ -31,6 +38,12 @@ The following arguments are supported: * `resource_group_name` - (Required) Specifies the resource group where the resource exists. Changing this forces a new resource to be created. +* `zone_type` - (Required) Specifies the type of this DNS zone. Possible values are `Public` or `Private` (Defaults to `Public`). + +* `registration_virtual_network_ids` - (Optional) A list of Virtual Network ID's that register hostnames in this DNS zone. This field can only be set when `zone_type` is set to `Private`. + +* `resolution_virtual_network_ids` - (Optional) A list of Virtual Network ID's that resolve records in this DNS zone. This field can only be set when `zone_type` is set to `Private`. + * `tags` - (Optional) A mapping of tags to assign to the resource. ## Attributes Reference diff --git a/website/docs/r/eventgrid_topic.html.markdown b/website/docs/r/eventgrid_topic.html.markdown index 2493c51436519..2884a91df3cb1 100644 --- a/website/docs/r/eventgrid_topic.html.markdown +++ b/website/docs/r/eventgrid_topic.html.markdown @@ -7,7 +7,7 @@ description: |- --- -# azurerm\_eventgrid\_topic +# azurerm_eventgrid_topic Manages an EventGrid Topic diff --git a/website/docs/r/eventhub.html.markdown b/website/docs/r/eventhub.html.markdown index d231eccce3572..e8d1ed16b1ec6 100644 --- a/website/docs/r/eventhub.html.markdown +++ b/website/docs/r/eventhub.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_eventhub" sidebar_current: "docs-azurerm-resource-eventhub" description: |- - Creates a new Event Hubs as a nested resource within an Event Hubs namespace. + Manages a Event Hubs as a nested resource within an Event Hubs namespace. --- # azurerm_eventhub -Creates a new Event Hubs as a nested resource within a Event Hubs namespace. +Manages a Event Hubs as a nested resource within a Event Hubs namespace. ## Example Usage diff --git a/website/docs/r/eventhub_authorization_rule.html.markdown b/website/docs/r/eventhub_authorization_rule.html.markdown index 1a544267eec9b..20e1f2a0878ba 100644 --- a/website/docs/r/eventhub_authorization_rule.html.markdown +++ b/website/docs/r/eventhub_authorization_rule.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_eventhub_authorization_rule" sidebar_current: "docs-azurerm-resource-eventhub-authorization-rule" description: |- - Creates a new Event Hubs authorization Rule within an Event Hub. + Manages a Event Hubs authorization Rule within an Event Hub. --- -# azurerm\_eventhub\_authorization\_rule +# azurerm_eventhub_authorization_rule -Creates a new Event Hubs authorization Rule within an Event Hub. +Manages a Event Hubs authorization Rule within an Event Hub. ## Example Usage diff --git a/website/docs/r/eventhub_consumer_group.html.markdown b/website/docs/r/eventhub_consumer_group.html.markdown index 7a03c5c0bed0d..2e0f1dc0c50ce 100644 --- a/website/docs/r/eventhub_consumer_group.html.markdown +++ b/website/docs/r/eventhub_consumer_group.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_eventhub_consumer_group" sidebar_current: "docs-azurerm-resource-eventhub-consumer-group" description: |- - Creates a new Event Hubs Consumer Group as a nested resource within an Event Hub. + Manages a Event Hubs Consumer Group as a nested resource within an Event Hub. --- -# azurerm\_eventhub\_consumer\_group +# azurerm_eventhub_consumer_group -Creates a new Event Hubs Consumer Group as a nested resource within an Event Hub. +Manages a Event Hubs Consumer Group as a nested resource within an Event Hub. ## Example Usage diff --git a/website/docs/r/eventhub_namespace.html.markdown b/website/docs/r/eventhub_namespace.html.markdown index 8d7b959eb3e1f..282d9d01a6f82 100644 --- a/website/docs/r/eventhub_namespace.html.markdown +++ b/website/docs/r/eventhub_namespace.html.markdown @@ -6,7 +6,7 @@ description: |- Create an EventHub Namespace. --- -# azurerm\_eventhub\_namespace +# azurerm_eventhub_namespace Create an EventHub Namespace. diff --git a/website/docs/r/express_route_circuit_authorization.html.markdown b/website/docs/r/express_route_circuit_authorization.html.markdown index baa13d0ae6667..c866a9689703f 100644 --- a/website/docs/r/express_route_circuit_authorization.html.markdown +++ b/website/docs/r/express_route_circuit_authorization.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_express_route_circuit_authorization" sidebar_current: "docs-azurerm-resource-network-express-route-circuit-authorization" description: |- - Creates an ExpressRoute Circuit Authorization. + Manages an ExpressRoute Circuit Authorization. --- # azurerm_express_route_circuit_authorization -Creates an ExpressRoute Circuit Authorization. +Manages an ExpressRoute Circuit Authorization. ## Example Usage diff --git a/website/docs/r/express_route_circuit_peering.html.markdown b/website/docs/r/express_route_circuit_peering.html.markdown index 26aced162fe91..80fa178006d57 100644 --- a/website/docs/r/express_route_circuit_peering.html.markdown +++ b/website/docs/r/express_route_circuit_peering.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_express_route_circuit_peering" sidebar_current: "docs-azurerm-resource-network-express-route-circuit-peering" description: |- - Creates an ExpressRoute Circuit Peering. + Manages an ExpressRoute Circuit Peering. --- # azurerm_express_route_circuit_peering -Creates an ExpressRoute Circuit Peering. +Manages an ExpressRoute Circuit Peering. ## Example Usage (Creating a Microsoft Peering) diff --git a/website/docs/r/function_app.html.markdown b/website/docs/r/function_app.html.markdown index a6f8011726f7f..574d26d9c3bef 100644 --- a/website/docs/r/function_app.html.markdown +++ b/website/docs/r/function_app.html.markdown @@ -111,6 +111,8 @@ The following arguments are supported: * `site_config` - (Optional) A `site_config` object as defined below. +* `identity` - (Optional) An `identity` block as defined below. + * `tags` - (Optional) A mapping of tags to assign to the resource. --- @@ -132,6 +134,13 @@ The following arguments are supported: * `websockets_enabled` - (Optional) Should WebSockets be enabled? +--- + +`identity` supports the following: + +* `type` - (Required) Specifies the identity type of the App Service. At this time the only allowed value is `SystemAssigned`. + + ## Attributes Reference The following attributes are exported: @@ -142,6 +151,17 @@ The following attributes are exported: * `outbound_ip_addresses` - A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12` +* `identity` - An `identity` block as defined below, which contains the Managed Service Identity information for this App Service. + +--- + +`identity` exports the following: + +* `principal_id` - The Principal ID for the Service Principal associated with the Managed Service Identity of this App Service. + +* `tenant_id` - The Tenant ID for the Service Principal associated with the Managed Service Identity of this App Service. + + ## Import Function Apps can be imported using the `resource id`, e.g. diff --git a/website/docs/r/image.html.markdown b/website/docs/r/image.html.markdown index 3a1ecb31b1a4d..5b7bc26e024bd 100644 --- a/website/docs/r/image.html.markdown +++ b/website/docs/r/image.html.markdown @@ -6,7 +6,7 @@ description: |- Create a custom virtual machine image that can be used to create virtual machines. --- -# azurerm\_image +# azurerm_image Create a custom virtual machine image that can be used to create virtual machines. diff --git a/website/docs/r/iothub.html.markdown b/website/docs/r/iothub.html.markdown index 42cc4540efa56..bb21f9b64beed 100644 --- a/website/docs/r/iothub.html.markdown +++ b/website/docs/r/iothub.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_iothub" sidebar_current: "docs-azurerm-resource-iothub" description: |- - Creates a new IotHub resource + Manages a IotHub resource --- # azurerm_iothub -Creates a new IotHub +Manages a IotHub ## Example Usage diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 0be4d53c6f7e9..57750dce6c223 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_kubernetes_cluster" sidebar_current: "docs-azurerm-resource-container-kubernetes-cluster" description: |- - Creates a managed Kubernetes Cluster (AKS) + Manages a managed Kubernetes Cluster (AKS) --- # azurerm_kubernetes_cluster -Creates a managed Kubernetes Cluster (AKS) +Manages a managed Kubernetes Cluster (AKS) ~> **Note:** All arguments including the client secret will be stored in the raw state as plain-text. [Read more about sensitive data in state](/docs/state/sensitive-data.html). @@ -39,7 +39,7 @@ resource "azurerm_kubernetes_cluster" "test" { agent_pool_profile { name = "default" count = 1 - vm_size = "Standard_A0" + vm_size = "Standard_D1_v2" os_type = "Linux" os_disk_size_gb = 30 } @@ -89,7 +89,7 @@ The following arguments are supported: * `resource_group_name` - (Required) Specifies the resource group where the resource exists. Changing this forces a new resource to be created. -* `dns_prefix` - (Optional) DNS prefix specified when creating the managed cluster. +* `dns_prefix` - (Required) DNS prefix specified when creating the managed cluster. * `kubernetes_version` - (Optional) Version of Kubernetes specified when creating the AKS managed cluster. If not specified, the latest recommended version will be used at provisioning time (but won't auto-upgrade). @@ -119,8 +119,6 @@ The following arguments are supported: * `os_type` - (Optional) The Operating System used for the Agents. Possible values are `Linux` and `Windows`. Changing this forces a new resource to be created. Defaults to `Linux`. * `vnet_subnet_id` - (Optional) The ID of the Subnet where the Agents in the Pool should be provisioned. Changing this forces a new resource to be created. -~> **NOTE:** There's a known issue where Agents connected to an Internal Network (e.g. on a Subnet) have their network routing configured incorrectly; such that Pods cannot communicate across nodes. This is a bug in the Azure API - and will be fixed there in the future. - `service_principal` supports the following: * `client_id` - (Required) The Client ID for the Service Principal. diff --git a/website/docs/r/loadbalancer.html.markdown b/website/docs/r/loadbalancer.html.markdown index 6cec31b2d9e57..04a18311c9775 100644 --- a/website/docs/r/loadbalancer.html.markdown +++ b/website/docs/r/loadbalancer.html.markdown @@ -6,7 +6,7 @@ description: |- Create a LoadBalancer Resource. --- -# azurerm\_lb +# azurerm_lb Create a LoadBalancer Resource. diff --git a/website/docs/r/loadbalancer_backend_address_pool.html.markdown b/website/docs/r/loadbalancer_backend_address_pool.html.markdown index f463b45b76899..4761d9f4507c3 100644 --- a/website/docs/r/loadbalancer_backend_address_pool.html.markdown +++ b/website/docs/r/loadbalancer_backend_address_pool.html.markdown @@ -6,7 +6,7 @@ description: |- Create a LoadBalancer Backend Address Pool. --- -# azurerm\_lb\_backend\_address\_pool +# azurerm_lb_backend_address_pool Create a LoadBalancer Backend Address Pool. diff --git a/website/docs/r/loadbalancer_nat_pool.html.markdown b/website/docs/r/loadbalancer_nat_pool.html.markdown index 4bbb5338be5fd..c48f43af9a4c2 100644 --- a/website/docs/r/loadbalancer_nat_pool.html.markdown +++ b/website/docs/r/loadbalancer_nat_pool.html.markdown @@ -6,7 +6,7 @@ description: |- Create a LoadBalancer NAT Pool. --- -# azurerm\_lb\_nat\_pool +# azurerm_lb_nat_pool Create a LoadBalancer NAT pool. diff --git a/website/docs/r/loadbalancer_nat_rule.html.markdown b/website/docs/r/loadbalancer_nat_rule.html.markdown index 7bed9d2f90ca2..19f56d2d18dbb 100644 --- a/website/docs/r/loadbalancer_nat_rule.html.markdown +++ b/website/docs/r/loadbalancer_nat_rule.html.markdown @@ -6,7 +6,7 @@ description: |- Create a LoadBalancer NAT Rule. --- -# azurerm\_lb\_nat\_rule +# azurerm_lb_nat_rule Create a LoadBalancer NAT Rule. diff --git a/website/docs/r/loadbalancer_probe.html.markdown b/website/docs/r/loadbalancer_probe.html.markdown index 1bfc6f3179a19..934729ee71057 100644 --- a/website/docs/r/loadbalancer_probe.html.markdown +++ b/website/docs/r/loadbalancer_probe.html.markdown @@ -6,7 +6,7 @@ description: |- Create a LoadBalancer Probe Resource. --- -# azurerm\_lb\_probe +# azurerm_lb_probe Create a LoadBalancer Probe Resource. diff --git a/website/docs/r/loadbalancer_rule.html.markdown b/website/docs/r/loadbalancer_rule.html.markdown index 380fbd7c37096..a41da3145b5c0 100644 --- a/website/docs/r/loadbalancer_rule.html.markdown +++ b/website/docs/r/loadbalancer_rule.html.markdown @@ -6,7 +6,7 @@ description: |- Create a LoadBalancer Rule. --- -# azurerm\_lb\_rule +# azurerm_lb_rule Create a LoadBalancer Rule. diff --git a/website/docs/r/local_network_gateway.html.markdown b/website/docs/r/local_network_gateway.html.markdown index aa70030af2814..96922c091192f 100644 --- a/website/docs/r/local_network_gateway.html.markdown +++ b/website/docs/r/local_network_gateway.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_local_network_gateway" sidebar_current: "docs-azurerm-resource-network-local-network-gateway" description: |- - Creates a new local network gateway connection over which specific connections can be configured. + Manages a local network gateway connection over which specific connections can be configured. --- -# azurerm\_local\_network\_gateway +# azurerm_local_network_gateway -Creates a new local network gateway connection over which specific connections can be configured. +Manages a local network gateway connection over which specific connections can be configured. ## Example Usage @@ -38,7 +38,7 @@ The following arguments are supported: * `resource_group_name` - (Required) The name of the resource group in which to create the local network gateway. -* `location` - (Required) The location/region where the local network gatway is +* `location` - (Required) The location/region where the local network gateway is created. Changing this forces a new resource to be created. * `gateway_address` - (Required) The IP address of the gateway to which to diff --git a/website/docs/r/log_analytics_solution.html.markdown b/website/docs/r/log_analytics_solution.html.markdown index 6738b1b719a11..4f34441883890 100644 --- a/website/docs/r/log_analytics_solution.html.markdown +++ b/website/docs/r/log_analytics_solution.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_log_analytics_solution" sidebar_current: "docs-azurerm-resource-oms-log-analytics-solution" description: |- - Creates a new Log Analytics (formally Operational Insights) Solution. + Manages a Log Analytics (formally Operational Insights) Solution. --- # azurerm_log_analytics_solution -Creates a new Log Analytics (formally Operational Insights) Solution. +Manages a Log Analytics (formally Operational Insights) Solution. ## Example Usage diff --git a/website/docs/r/log_analytics_workspace.html.markdown b/website/docs/r/log_analytics_workspace.html.markdown index 690856f653c7f..6f9bd609441ca 100644 --- a/website/docs/r/log_analytics_workspace.html.markdown +++ b/website/docs/r/log_analytics_workspace.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_log_analytics_workspace" sidebar_current: "docs-azurerm-resource-oms-log-analytics-workspace" description: |- - Creates a new Log Analytics (formally Operational Insights) Workspace. + Manages a Log Analytics (formally Operational Insights) Workspace. --- # azurerm_log_analytics_workspace -Creates a new Log Analytics (formally Operational Insights) Workspace. +Manages a Log Analytics (formally Operational Insights) Workspace. ## Example Usage @@ -37,7 +37,9 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -* `sku` - (Required) Specifies the Sku of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone` and `Unlimited.` +* `sku` - (Required) Specifies the Sku of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, and `PerGB2018` (new Sku as of `2018-04-03`). + +~> **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 SKU's defined above. More information about [the Pricing SKU's is available at the following URI](http://aka.ms/PricingTierWarning). * `retention_in_days` - (Optional) The workspace data retention in days. Possible values range between 30 and 730. diff --git a/website/docs/r/managed_disk.html.markdown b/website/docs/r/managed_disk.html.markdown index 32f772106a467..5791deb0dc33f 100644 --- a/website/docs/r/managed_disk.html.markdown +++ b/website/docs/r/managed_disk.html.markdown @@ -6,7 +6,7 @@ description: |- Create a Managed Disk. --- -# azurerm\_managed\_disk +# azurerm_managed_disk Create a managed disk. @@ -14,7 +14,7 @@ Create a managed disk. ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US 2" } @@ -36,7 +36,7 @@ resource "azurerm_managed_disk" "test" { ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US 2" } diff --git a/website/docs/r/mysql_configuration.html.markdown b/website/docs/r/mysql_configuration.html.markdown index 33b82417d6b5c..abe8ecb6cb381 100644 --- a/website/docs/r/mysql_configuration.html.markdown +++ b/website/docs/r/mysql_configuration.html.markdown @@ -24,15 +24,21 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 5120 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "psqladminun" administrator_login_password = "H@Sh1CoR3!" version = "5.7" - storage_mb = "51200" ssl_enforcement = "Enabled" } diff --git a/website/docs/r/mysql_database.html.markdown b/website/docs/r/mysql_database.html.markdown index 5b11c0c105fe6..aecd88df531ec 100644 --- a/website/docs/r/mysql_database.html.markdown +++ b/website/docs/r/mysql_database.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_mysql_database" sidebar_current: "docs-azurerm-resource-database-mysql-database" description: |- - Creates a MySQL Database within a MySQL Server. + Manages a MySQL Database within a MySQL Server. --- # azurerm_mysql_database -Creates a MySQL Database within a MySQL Server +Manages a MySQL Database within a MySQL Server ## Example Usage @@ -24,15 +24,21 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 5120 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "mysqladminun" administrator_login_password = "H@Sh1CoR3!" version = "5.7" - storage_mb = "51200" ssl_enforcement = "Enabled" } diff --git a/website/docs/r/mysql_firewall_rule.html.markdown b/website/docs/r/mysql_firewall_rule.html.markdown index 20988719ffd97..4126aaf9b942d 100644 --- a/website/docs/r/mysql_firewall_rule.html.markdown +++ b/website/docs/r/mysql_firewall_rule.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_mysql_firewall_rule" sidebar_current: "docs-azurerm-resource-database-mysql-firewall-rule" description: |- - Creates a Firewall Rule for a MySQL Server. + Manages a Firewall Rule for a MySQL Server. --- # azurerm_mysql_firewall_rule -Creates a Firewall Rule for a MySQL Server +Manages a Firewall Rule for a MySQL Server ## Example Usage (Single IP Address) diff --git a/website/docs/r/mysql_server.html.markdown b/website/docs/r/mysql_server.html.markdown index 33bfe6b101abf..c7ae7289558cd 100644 --- a/website/docs/r/mysql_server.html.markdown +++ b/website/docs/r/mysql_server.html.markdown @@ -25,15 +25,21 @@ resource "azurerm_mysql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "MYSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 5120 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "mysqladminun" administrator_login_password = "H@Sh1CoR3!" version = "5.7" - storage_mb = "51200" ssl_enforcement = "Enabled" } ``` @@ -50,45 +56,39 @@ The following arguments are supported: * `sku` - (Required) A `sku` block as defined below. +* `storage_profile` - (Required) A `storage_profile` block as defined below. + * `administrator_login` - (Required) The Administrator Login for the MySQL Server. Changing this forces a new resource to be created. * `administrator_login_password` - (Required) The Password associated with the `administrator_login` for the MySQL Server. * `version` - (Required) Specifies the version of MySQL to use. Valid values are `5.6` and `5.7`. Changing this forces a new resource to be created. -* `storage_mb` - (Required) Specifies the amount of storage for the MySQL Server in Megabytes. Possible values are shown below. Changing this forces a new resource to be created. - -Possible values for `storage_mb` when using a SKU Name of `Basic` are: -- `51200` (50GB) -- `179200` (175GB) -- `307200` (300GB) -- `435200` (425GB) -- `563200` (550GB) -- `691200` (675GB) -- `819200` (800GB) -- `947200` (925GB) - -Possible values for `storage_mb` when using a SKU Name of `Standard` are: -- `128000` (125GB) -- `256000` (256GB) -- `384000` (384GB) -- `512000` (512GB) -- `640000` (640GB) -- `768000` (768GB) -- `896000` (896GB) -- `1024000` (1TB) - * `ssl_enforcement` - (Required) Specifies if SSL should be enforced on connections. Possible values are `Enforced` and `Disabled`. * `tags` - (Optional) A mapping of tags to assign to the resource. --- -* `sku` supports the following: +`sku` supports the following: + +* `name` - (Required) Specifies the SKU Name for this MySQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. B_Gen4_1, GP_Gen5_8). For more information see the [product documentation](https://docs.microsoft.com/en-us/rest/api/mysql/servers/create#sku). + +* `capacity` - (Required) The scale up/out capacity, representing server's compute units. + +* `tier` - (Required) The tier of the particular SKU. Possible values are `Basic`, `GeneralPurpose`, and `MemoryOptimized`. For more information see the [product documentation](https://docs.microsoft.com/en-us/azure/mysql/concepts-pricing-tiers). + +* `family` - (Required) The `family` of hardware `Gen4` or `Gen5`, before selecting your `family` check the [product documentation](https://docs.microsoft.com/en-us/azure/mysql/concepts-pricing-tiers#compute-generations-vcores-and-memory) for availability in your region. + +--- + +`storage_profile` supports the following: + +* `storage_mb` - (Required) Max storage allowed for a server. Possible values are between `5120` MB(5GB) and `1048576` MB(1TB) for the Basic SKU and between `5120` MB(5GB) and `4194304` MB(4TB) for General Purpose/Memory Optimized SKUs. For more information see the [product documentation](https://docs.microsoft.com/en-us/rest/api/mysql/servers/create#StorageProfile). + +* `backup_retention_days` - (Optional) Backup retention days for the server, supported values are between `7` and `35` days. -* `name` - (Optional) Specifies the SKU Name for this MySQL Server. Possible values are: `MYSQLB50`, `MYSQLB100`, `MYSQLS100`, `MYSQLS200`, `MYSQLS400` and `MYSQLS800`. -* `capacity` - (Optional) Specifies the DTU's for this MySQL Server. Possible values are `50` and `100` DTU's when using a `Basic` SKU and `100`, `200`, `400` or `800` when using the `Standard` SKU. -* `tier` - (Optional) Specifies the SKU Tier for this MySQL Server. Possible values are `Basic` and `Standard`. +* `geo_redundant_backup` - (Optional) Enable Geo-redundant or not for server backup. Valid values for this property are `Enabled` or `Disabled`, not supported for the `basic` tier. ## Attributes Reference diff --git a/website/docs/r/network_interface.html.markdown b/website/docs/r/network_interface.html.markdown index ce179c020474c..3cb2972916a90 100644 --- a/website/docs/r/network_interface.html.markdown +++ b/website/docs/r/network_interface.html.markdown @@ -1,6 +1,6 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_network_interface" +page_title: "Azure Resource Manager: azurerm_network_interface" sidebar_current: "docs-azurerm-resource-network-interface" description: |- Manages a Network Interface located in a Virtual Network, usually attached to a Virtual Machine. diff --git a/website/docs/r/policy_definition.html.markdown b/website/docs/r/policy_definition.html.markdown index ffa1024738570..8274f489554c6 100644 --- a/website/docs/r/policy_definition.html.markdown +++ b/website/docs/r/policy_definition.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_policy_definition" sidebar_current: "docs-azurerm-resource-policy-definition" description: |- - Creates a policy for all of the resource groups under the subscription. + Manages a policy for all of the resource groups under the subscription. --- # azurerm_policy_definition -Creates a policy for all of the resource groups under the subscription. +Manages a policy for all of the resource groups under the subscription. ## Example Usage diff --git a/website/docs/r/postgresql_configuration.html.markdown b/website/docs/r/postgresql_configuration.html.markdown index 49c6181f9e8f0..27ec24af2b83b 100644 --- a/website/docs/r/postgresql_configuration.html.markdown +++ b/website/docs/r/postgresql_configuration.html.markdown @@ -6,7 +6,7 @@ description: |- Sets a PostgreSQL Configuration value on a PostgreSQL Server. --- -# azurerm\_postgresql\_configuration +# azurerm_postgresql_configuration Sets a PostgreSQL Configuration value on a PostgreSQL Server. @@ -24,15 +24,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 5120 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "psqladminun" administrator_login_password = "H@Sh1CoR3!" version = "9.5" - storage_mb = "51200" ssl_enforcement = "Enabled" } diff --git a/website/docs/r/postgresql_database.html.markdown b/website/docs/r/postgresql_database.html.markdown index 73f50efe14fe7..8cb9b885e2250 100644 --- a/website/docs/r/postgresql_database.html.markdown +++ b/website/docs/r/postgresql_database.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_postgresql_database" sidebar_current: "docs-azurerm-resource-database-postgresql-database" description: |- - Creates a PostgreSQL Database within a PostgreSQL Server. + Manages a PostgreSQL Database within a PostgreSQL Server. --- -# azurerm\_postgresql\_database +# azurerm_postgresql_database -Creates a PostgreSQL Database within a PostgreSQL Server +Manages a PostgreSQL Database within a PostgreSQL Server ## Example Usage @@ -24,15 +24,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 5120 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "psqladminun" administrator_login_password = "H@Sh1CoR3!" version = "9.5" - storage_mb = "51200" ssl_enforcement = "Enabled" } diff --git a/website/docs/r/postgresql_firewall_rule.html.markdown b/website/docs/r/postgresql_firewall_rule.html.markdown index a93a07e370b04..8fd7553f2a0ae 100644 --- a/website/docs/r/postgresql_firewall_rule.html.markdown +++ b/website/docs/r/postgresql_firewall_rule.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_postgresql_firewall_rule" sidebar_current: "docs-azurerm-resource-database-postgresql-firewall-rule" description: |- - Creates a Firewall Rule for a PostgreSQL Server. + Manages a Firewall Rule for a PostgreSQL Server. --- -# azurerm\_postgresql\_firewall\_rule +# azurerm_postgresql_firewall_rule -Creates a Firewall Rule for a PostgreSQL Server +Manages a Firewall Rule for a PostgreSQL Server ## Example Usage (Single IP Address) @@ -67,6 +67,9 @@ The following arguments are supported: * `end_ip_address` - (Required) Specifies the End IP Address associated with this Firewall Rule. Changing this forces a new resource to be created. +-> **NOTE:** The Azure feature `Allow access to Azure services` can be enabled by setting `start_ip_address` and `end_ip_address` to `0.0.0.0` which ([is documented in the Azure API Docs](https://docs.microsoft.com/en-us/rest/api/sql/firewallrules/createorupdate)). + + ## Attributes Reference The following attributes are exported: diff --git a/website/docs/r/postgresql_server.html.markdown b/website/docs/r/postgresql_server.html.markdown index e9525b89a4502..24315529dfb50 100644 --- a/website/docs/r/postgresql_server.html.markdown +++ b/website/docs/r/postgresql_server.html.markdown @@ -6,7 +6,7 @@ description: |- Create a PostgreSQL Server. --- -# azurerm\_postgresql\_server +# azurerm_postgresql_server Create a PostgreSQL Server. @@ -24,15 +24,21 @@ resource "azurerm_postgresql_server" "test" { resource_group_name = "${azurerm_resource_group.test.name}" sku { - name = "PGSQLB50" - capacity = 50 + name = "B_Gen4_2" + capacity = 2 tier = "Basic" + family = "Gen4" + } + + storage_profile { + storage_mb = 5120 + backup_retention_days = 7 + geo_redundant_backup = "Disabled" } administrator_login = "psqladminun" administrator_login_password = "H@Sh1CoR3!" version = "9.5" - storage_mb = "51200" ssl_enforcement = "Enabled" } ``` @@ -41,43 +47,21 @@ resource "azurerm_postgresql_server" "test" { The following arguments are supported: -* `name` - (Required) Specifies the name of the PostgreSQL Server. Changing this forces a - new resource to be created. +* `name` - (Required) Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. -* `resource_group_name` - (Required) The name of the resource group in which to - create the PostgreSQL Server. +* `resource_group_name` - (Required) The name of the resource group in which to create the PostgreSQL Server. 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. * `sku` - (Required) A `sku` block as defined below. +* `storage_profile` - (Required) A `storage_profile` block as defined below. + * `administrator_login` - (Required) The Administrator Login for the PostgreSQL Server. Changing this forces a new resource to be created. * `administrator_login_password` - (Required) The Password associated with the `administrator_login` for the PostgreSQL Server. -* `version` - (Required) Specifies the version of PostgreSQL to use. Valid values are `9.5` and `9.6`. Changing this forces a new resource to be created. - -* `storage_mb` - (Required) Specifies the amount of storage for the PostgreSQL Server in Megabytes. Possible values are shown below. Changing this forces a new resource to be created. - -Possible values for `storage_mb` when using a SKU Name of `Basic` are: -- `51200` (50GB) -- `179200` (175GB) -- `307200` (300GB) -- `435200` (425GB) -- `563200` (550GB) -- `691200` (675GB) -- `819200` (800GB) -- `947200` (925GB) - -Possible values for `storage_mb` when using a SKU Name of `Standard` are: -- `128000` (125GB) -- `256000` (256GB) -- `384000` (384GB) -- `512000` (512GB) -- `640000` (640GB) -- `768000` (768GB) -- `896000` (896GB) -- `1024000` (1TB) +* `version` - (Required) Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, and `10.0`. Changing this forces a new resource to be created. * `ssl_enforcement` - (Required) Specifies if SSL should be enforced on connections. Possible values are `Enabled` and `Disabled`. @@ -85,12 +69,25 @@ Possible values for `storage_mb` when using a SKU Name of `Standard` are: --- -* `sku` supports the following: +`sku` supports the following: + +* `name` - (Required) Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. B_Gen4_1, GP_Gen5_8). For more information see the [product documentation](https://docs.microsoft.com/en-us/rest/api/postgresql/servers/create#sku). + +* `capacity` - (Required) The scale up/out capacity, representing server's compute units. + +* `tier` - (Required) The tier of the particular SKU. Possible values are `Basic`, `GeneralPurpose`, and `MemoryOptimized`. For more information see the [product documentation](https://docs.microsoft.com/en-us/azure/postgresql/concepts-pricing-tiers). + +* `family` - (Required) The `family` of hardware `Gen4` or `Gen5`, before selecting your `family` check the [product documentation](https://docs.microsoft.com/en-us/azure/postgresql/concepts-pricing-tiers#compute-generations-vcores-and-memory) for availability in your region. + +--- + +`storage_profile` supports the following: + +* `storage_mb` - (Required) Max storage allowed for a server. Possible values are between `5120` MB(5GB) and `1048576` MB(1TB) for the Basic SKU and between `5120` MB(5GB) and `4194304` MB(4TB) for General Purpose/Memory Optimized SKUs. For more information see the [product documentation](https://docs.microsoft.com/en-us/rest/api/postgresql/servers/create#StorageProfile). -* `name` - (Optional) Specifies the SKU Name for this PostgreSQL Server. Possible values are: `PGSQLB50`, `PGSQLB100`, `PGSQLS100`, `PGSQLS200`, `PGSQLS400` and `PGSQLS800`. +* `backup_retention_days` - (Optional) Backup retention days for the server, supported values are between `7` and `35` days. -* `capacity` - (Optional) Specifies the DTU's for this PostgreSQL Server. Possible values are `50` and `100` DTU's when using a `Basic` SKU and `100`, `200`, `400` or `800` when using the `Standard` SKU. -* `tier` - (Optional) Specifies the SKU Tier for this PostgreSQL Server. Possible values are `Basic` and `Standard`. +* `geo_redundant_backup` - (Optional) Enable Geo-redundant or not for server backup. Valid values for this property are `Enabled` or `Disabled`, not supported for the `basic` tier. ## Attributes Reference diff --git a/website/docs/r/public_ip.html.markdown b/website/docs/r/public_ip.html.markdown index d9f65278b73ee..63bacd024fca7 100644 --- a/website/docs/r/public_ip.html.markdown +++ b/website/docs/r/public_ip.html.markdown @@ -6,7 +6,7 @@ description: |- Create a Public IP Address. --- -# azurerm\_public\_ip +# azurerm_public_ip Create a Public IP Address. diff --git a/website/docs/r/redis_cache.html.markdown b/website/docs/r/redis_cache.html.markdown index 79db178e70abd..8f9f375673e2b 100644 --- a/website/docs/r/redis_cache.html.markdown +++ b/website/docs/r/redis_cache.html.markdown @@ -148,7 +148,7 @@ The pricing group for the Redis Family - either "C" or "P" at present. * `redis_configuration` supports the following: -* `maxmemory_reserve` - (Optional) Value in megabytes reserved for non-cache usage e.g. failover. Defaults are shown below. +* `maxmemory_reserved` - (Optional) Value in megabytes reserved for non-cache usage e.g. failover. Defaults are shown below. * `maxmemory_delta` - (Optional) The max-memory delta for this Redis instance. Defaults are shown below. * `maxmemory_policy` - (Optional) How Redis will select what to remove when `maxmemory` is reached. Defaults are shown below. @@ -183,14 +183,14 @@ redis_configuration { | maxmemory_delta | 2 | 50 | 200 | | maxmemory_policy | volatile-lru | volatile-lru | volatile-lru | -_*Important*: The maxmemory_reserved setting is only available for Standard and Premium caches. More details are available in the Relevant Links section below._ +_*Important*: The `maxmemory_reserved` and `maxmemory_delta` settings are only available for Standard and Premium caches. More details are available in the Relevant Links section below._ * `patch_schedule` supports the following: * `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`. -~> **Note:** The Patch Window lasts for 5 hours from the `start_hour_utc`. +~> **Note:** The Patch Window lasts for `5` hours from the `start_hour_utc`. ## Attributes Reference diff --git a/website/docs/r/resource_group.html.markdown b/website/docs/r/resource_group.html.markdown index 22b6af415391c..32375ee7133c9 100644 --- a/website/docs/r/resource_group.html.markdown +++ b/website/docs/r/resource_group.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_resource_group" sidebar_current: "docs-azurerm-resource-resource-group" description: |- - Creates a new resource group on Azure. + Manages a resource group on Azure. --- -# azurerm\_resource\_group +# azurerm_resource_group -Creates a new resource group on Azure. +Manages a resource group on Azure. ## Example Usage diff --git a/website/docs/r/role_definition.html.markdown b/website/docs/r/role_definition.html.markdown index 1e181e33e104f..4add04c60c70a 100644 --- a/website/docs/r/role_definition.html.markdown +++ b/website/docs/r/role_definition.html.markdown @@ -17,7 +17,6 @@ Manages a custom Role Definition, used to assign Roles to Users/Principals. data "azurerm_subscription" "primary" {} resource "azurerm_role_definition" "test" { - role_definition_id = "12345678-1234-5678-1234-123456780123" name = "my-custom-role" scope = "${data.azurerm_subscription.primary.id}" description = "This is a custom role created via Terraform" @@ -37,7 +36,7 @@ resource "azurerm_role_definition" "test" { The following arguments are supported: -* `role_definition_id` - (Required) A unique UUID/GUID which identifies this role. Changing this forces a new resource to be created. +* `role_definition_id` - (Optional) A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created. * `name` - (Required) The name of the Role Definition. Changing this forces a new resource to be created. diff --git a/website/docs/r/route_table.html.markdown b/website/docs/r/route_table.html.markdown index 38fedd3e30986..fcf6384b2a05d 100644 --- a/website/docs/r/route_table.html.markdown +++ b/website/docs/r/route_table.html.markdown @@ -24,6 +24,8 @@ resource "azurerm_route_table" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" +disable_bgp_route_propagation = false + route { name = "route1" address_prefix = "10.1.0.0/16" @@ -48,6 +50,8 @@ The following arguments are supported: * `route` - (Optional) Can be specified multiple times to define multiple routes. Each `route` block supports fields documented below. +* `disable_bgp_route_propagation` - (Optional) Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable. + * `tags` - (Optional) A mapping of tags to assign to the resource. The `route` block supports: diff --git a/website/docs/r/scheduler_job.html.markdown b/website/docs/r/scheduler_job.html.markdown new file mode 100644 index 0000000000000..94b5c4ee825a0 --- /dev/null +++ b/website/docs/r/scheduler_job.html.markdown @@ -0,0 +1,219 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_scheduler_job" +sidebar_current: "docs-azurerm-resource-scheduler-job-x +description: |- + Manages a Scheduler Job. +--- + +# azurerm_scheduler_job + +Manages a Scheduler Job. + +## Example Usage (single web get now) + +```hcl +resource "azurerm_scheduler_job" "web-once-now" { + name = "tfex-web-once-now" + resource_group_name = "${azurerm_resource_group.rg.name}" + job_collection_name = "${azurerm_scheduler_job_collection.jc.name}" + + state = "enabled" //re-enable it each run + + action_web { + url = "http://this.url.fails" //defaults to get + } + + //default start time is now +} +``` + +## Example Usage (recurring daily with retry and basic authentication) + +```hcl +resource "azurerm_scheduler_job" "web-recurring-daily" { + name = "tfex-web-recurring-daily" + resource_group_name = "${azurerm_resource_group.rg.name}" + job_collection_name = "${azurerm_scheduler_job_collection.jc.name}" + + action_web { + url = "https://this.url.fails" + method = "put" + body = "this is some text" + + headers = { + Content-Type = "text" + } + + authentication_basic { + username = "login" + password = "apassword" + } + } + + retry { + interval = "00:05:00" //retry every 5 min + count = 10 //a maximum or 10 times + } + + recurrence { + frequency = "day" + count = 1000 + hours = [0,12] //run every 12 hours + minutes = [0,15,30,45] //4 times an hour + } + + start_time = "2018-07-07T07:07:07-07:00" +} +``` + +## Example Usage (recurring monthly with an error action and client certificate authentication) + +```hcl +resource "azurerm_scheduler_job" "web-recurring-daily" { + name = "tfex-web-recurring-daily" + resource_group_name = "${azurerm_resource_group.rg.name}" + job_collection_name = "${azurerm_scheduler_job_collection.jc.name}" + + action_web { + url = "https://this.url.fails" + authentication_certificate { + pfx = "${base64encode(file("your_cert.pfx"))}" + password = "cert_password" + } + } + + error_action_web { + url = "https://this.url.fails" + method = "put" + body = "The job failed" + + headers = { + "Content-Type" = "text" + } + + authentication_basic { + username = "login" + password = "apassword" + } + } + + recurrence { + frequency = "monthly" + count = 1000 + monthly_occurrences = [ + { //first sunday + day = "Sunday" + occurrence = 1 + }, + { //third sunday + day = "Sunday" + occurrence = 3 + }, + { //last sunday + day = "Sunday" + occurrence = -1 + } + ] + } + + start_time = "2018-07-07T07:07:07-07:00" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Scheduler Job. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group in which to create the Scheduler Job. Changing this forces a new resource to be created. + +* `job_collection_name` - (Required) Specifies the name of the Scheduler Job Collection in which the Job should exist. Changing this forces a new resource to be created. + +* `action_web` - (Required) A `action_web` block defining the job action as described below. Note this is identical to an `error_action_web` block. + +* `error_action_web` - (Optional) A `error_action_web` block defining the action to take on an error as described below. Note this is identical to an `action_web` block. + +* `retry` - (Optional) A `retry` block defining how to retry as described below. + +* `recurrence` - (Optional) A `recurrence` block defining a job occurrence schedule. + +* `start_time` - (Optional) The time the first instance of the job is to start running at. + +* `state` - (Optional) The sets or gets the current state of the job. Can be set to either `Enabled` or `Completed` + + +`web_action` & `error_web_action` block supports the following: + +* `url` - (Required) Specifies the URL of the web request. Must be HTTPS for authenticated requests. +* `method` - (Optional) Specifies the method of the request. Defaults to `Get` and must be one of `Get`, `Put`, `Post`, `Delete`. +* `body` - (Optional) Specifies the request body. +* `headers` - (Optional) A map specifying the headers sent with the request. +* `authentication_basic` - (Optional) An `authentication_active_directory` block which defines the Active Directory oauth configuration to use. +* `authentication_certificate` - (Optional) An `authentication_certificate` block which defines the client certificate information to be use. +* `authentication_active_directory` - (Optional) An `authentication_active_directory` block which defines the OAUTH Active Directory information to use. + + +`authentication_basic` block supports the following: + +* `username` - (Required) Specifies the username to use. +* `password` - (Required) Specifies the password to use. + + +`authentication_certificate` block supports the following: + +* `pfx` - (Required) Specifies the pfx certificate in base-64 format. +* `password` - (Required) Specifies the certificate password. + + +`authentication_active_directory` block supports the following: + +* `client_id` - (Required) Specifies the client ID to use. +* `tenant_id` - (Required) Specifies the tenant ID to use. +* `client_secret` - (Required) Specifies the secret to use. +* `audience` - (Optional) Specifies the audience. + + +`retry` block supports the following: + +* `interval` - (Required) Specifies the duration between retries. +* `count` - (Required) Specifies the number of times a retry should be attempted. + +`recurrence` block supports the following: + +* `frequency` - (Required) Specifies the frequency of recurrence. Must be one of `Minute`, `Hour`, `Day`, `Week`, `Month`. +* `interval` - (Optional) Specifies the interval between executions. Defaults to `1`. +* `count` - (Optional) Specifies the maximum number of times that the job should run. +* `end_time` - (Optional) Specifies the time at which the job will cease running. Must be less then 500 days into the future. +* `minutes` - (Optional) Specifies the minutes of the hour that the job should execute at. Must be between `0` and `59` +* `hours` - (Optional) Specifies the hours of the day that the job should execute at. Must be between `0` and `23` +* `week_days` - (Optional) Specifies the days of the week that the job should execute on. Must be one of `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday`, `Sunday`. Only applies when `Week` is used for frequency. +* `month_days` - (Optional) Specifies the days of the month that the job should execute on. Must be non zero and between `-1` and `31`. Only applies when `Month` is used for frequency. +* `monthly_occurrences` - (Optional) Specifies specific monthly occurrences like "last sunday of the month" with `monthly_occurrences` blocks. Only applies when `Month` is used for frequency. + +`monthly_occurrences` block supports the following: + +* `day` - (Optional) Specifies the day of the week that the job should execute on. Must be one of one of `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday`, `Sunday`. +* `occurrence` - (Optional) Specifies the week the job should run on. For example `1` for the first week, `-1` for the last week of the month. Must be between `-5` and `5`. + + +## Attributes Reference + +The following attributes are exported: + +* `id` - The Scheduler Job ID. + +`authentication_certificate` block exports the following: + +* `thumbprint` - (Computed) The certificate thumbprint. +* `expiration` - (Computed) The certificate expiration date. +* `subject_name` - (Computed) The certificate's certificate subject name. + +## Import + +Scheduler Job can be imported using a `resource id`, e.g. + +```shell +terraform import azurerm_scheduler_job.job1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Scheduler/jobCollections/jobCollection1/jobs/job1 +``` diff --git a/website/docs/r/scheduler_job_collection.html.markdown b/website/docs/r/scheduler_job_collection.html.markdown index 2fdcf743a1741..a717ce2865c25 100644 --- a/website/docs/r/scheduler_job_collection.html.markdown +++ b/website/docs/r/scheduler_job_collection.html.markdown @@ -1,14 +1,14 @@ --- layout: "azurerm" page_title: "Azure Resource Manager: azurerm_scheduler_job_collection" -sidebar_current: "docs-azurerm-resource-scheduler_job_collection" +sidebar_current: "docs-azurerm-resource-scheduler-job-collection" description: |- - Create an Scheduler Job Collection. + Manages a Scheduler Job Collection. --- # azurerm_scheduler_job_collection -Create an Scheduler Job Collection. +Manages a Scheduler Job Collection. ## Example Usage diff --git a/website/docs/r/search_service.html.markdown b/website/docs/r/search_service.html.markdown index 52b2b3bc31b47..0cc2418edcee4 100644 --- a/website/docs/r/search_service.html.markdown +++ b/website/docs/r/search_service.html.markdown @@ -6,7 +6,7 @@ description: |- Manage a Search Service. --- -# azurerm\_search\_service +# azurerm_search_service Allows you to manage an Azure Search Service diff --git a/website/docs/r/servicebus_namespace.html.markdown b/website/docs/r/servicebus_namespace.html.markdown index 26a5c6b068817..42a0b9275bb61 100644 --- a/website/docs/r/servicebus_namespace.html.markdown +++ b/website/docs/r/servicebus_namespace.html.markdown @@ -6,7 +6,7 @@ description: |- Create a ServiceBus Namespace. --- -# azurerm\_servicebus\_namespace +# azurerm_servicebus_namespace Create a ServiceBus Namespace. @@ -53,7 +53,7 @@ The following arguments are supported: * `sku` - (Required) Defines which tier to use. Options are basic, standard or premium. -* `capacity` - (Optional) Specifies the capacity of a Premium namespace. Can be 1, 2 or 4. +* `capacity` - (Optional) Specifies the capacity, can only be set when `sku` is `Premium` namespace. Can be `1`, `2` or `4`. * `tags` - (Optional) A mapping of tags to assign to the resource. diff --git a/website/docs/r/servicebus_queue.html.markdown b/website/docs/r/servicebus_queue.html.markdown index cb042bbc182e7..a3ab88e450651 100644 --- a/website/docs/r/servicebus_queue.html.markdown +++ b/website/docs/r/servicebus_queue.html.markdown @@ -6,7 +6,7 @@ description: |- Create a ServiceBus Queue. --- -# azurerm\_servicebus\_queue +# azurerm_servicebus_queue Create and manage a ServiceBus Queue. @@ -86,7 +86,7 @@ The following arguments are supported: a new resource to be created. Defaults to `false` for Basic and Standard. For Premium, it MUST be set to `true`. -~> **NOTE:** Service Bus Premium namespaces are always partitioned, so `enable_partitioning` MUST be set to `true`. +-> **NOTE:** Partitioning is available at entity creation for all queues and topics in Basic or Standard SKUs. It is not available for the Premium messaging SKU, but any previously existing partitioned entities in Premium namespaces continue to work as expected. Please [see the documentation](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-partitioning) for more information. * `lock_duration` - (Optional) The ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. Maximum value is 5 minutes. Defaults to 1 minute. (`PT1M`) @@ -103,7 +103,7 @@ The following arguments are supported: a queue can guarantee first-in-first-out delivery of messages. Changing this forces a new resource to be created. Defaults to `false`. -* `requires_session` - (Optional) Boolean flag which controls whether the Queue has dead letter support when a message expires. Defaults to `false`. +* `dead_lettering_on_message_expiration` - (Optional) Boolean flag which controls whether the Queue has dead letter support when a message expires. Defaults to `false`. ### TimeSpan Format diff --git a/website/docs/r/servicebus_subscription.html.markdown b/website/docs/r/servicebus_subscription.html.markdown index db0a6b21ee722..addc95781578a 100644 --- a/website/docs/r/servicebus_subscription.html.markdown +++ b/website/docs/r/servicebus_subscription.html.markdown @@ -6,7 +6,7 @@ description: |- Create a ServiceBus Subscription. --- -# azurerm\_servicebus\_subscription +# azurerm_servicebus_subscription Create a ServiceBus Subscription. diff --git a/website/docs/r/servicebus_topic.html.markdown b/website/docs/r/servicebus_topic.html.markdown index 329b2a6409f69..dc85d52b99912 100644 --- a/website/docs/r/servicebus_topic.html.markdown +++ b/website/docs/r/servicebus_topic.html.markdown @@ -6,7 +6,7 @@ description: |- Create a ServiceBus Topic. --- -# azurerm\_servicebus\_topic +# azurerm_servicebus_topic Create a ServiceBus Topic. @@ -85,6 +85,8 @@ The following arguments are supported: the topic to be partitioned across multiple message brokers. Defaults to false. Changing this forces a new resource to be created. +-> **NOTE:** Partitioning is available at entity creation for all queues and topics in Basic or Standard SKUs. It is not available for the Premium messaging SKU, but any previously existing partitioned entities in Premium namespaces continue to work as expected. Please [see the documentation](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-partitioning) for more information. + * `max_size_in_megabytes` - (Optional) Integer value which controls the size of memory allocated for the topic. For supported values see the "Queue/topic size" section of [this document](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quotas). diff --git a/website/docs/r/servicebus_topic_authorization_rule.html.markdown b/website/docs/r/servicebus_topic_authorization_rule.html.markdown index 2c98a44d8c0e4..a1ee01dcec70b 100644 --- a/website/docs/r/servicebus_topic_authorization_rule.html.markdown +++ b/website/docs/r/servicebus_topic_authorization_rule.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_servicebus_topic_authorization_rule" sidebar_current: "docs-azurerm-resource-servicebus-topic-authorization-rule" description: |- - Creates a new ServiceBus Topic authorization Rule within a ServiceBus Topic. + Manages a ServiceBus Topic authorization Rule within a ServiceBus Topic. --- # azurerm_servicebus_topic_authorization_rule -Creates a new ServiceBus Topic authorization Rule within a ServiceBus Topic. +Manages a ServiceBus Topic authorization Rule within a ServiceBus Topic. ## Example Usage diff --git a/website/docs/r/sql_database.html.markdown b/website/docs/r/sql_database.html.markdown index 8d7cd1937b9b8..8bfacf83daa99 100644 --- a/website/docs/r/sql_database.html.markdown +++ b/website/docs/r/sql_database.html.markdown @@ -6,7 +6,7 @@ description: |- Create a SQL Database. --- -# azurerm\_sql\_database +# azurerm_sql_database Allows you to manage an Azure SQL Database @@ -52,6 +52,8 @@ The following arguments are supported: * `create_mode` - (Optional) Specifies the type of database to create. Defaults to `Default`. See below for the accepted values/ +* `import` - (Optional) A Database Import block as documented below. `create_mode` must be set to `Default`. + * `source_database_id` - (Optional) The URI of the source database if `create_mode` value is not `Default`. * `restore_point_in_time` - (Optional) The point in time for the restore. Only applies if `create_mode` is `PointInTimeRestore` e.g. 2013-11-08T22:00:40Z @@ -73,6 +75,16 @@ The following arguments are supported: * `tags` - (Optional) A mapping of tags to assign to the resource. +`import` supports the following: + +* `storage_uri` - (Required) Specifies the blob URI of the .bacpac file. +* `storage_key` - (Required) Specifies the access key for the storage account. +* `storage_key_type` - (Required) Specifies the type of access key for the storage account. Valid values are `StorageAccessKey` or `SharedAccessKey`. +* `administrator_login` - (Required) Specifies the name of the SQL administrator. +* `administrator_login_password` - (Required) Specifies the password of the SQL administrator. +* `authentication_type` - (Required) Specifies the type of authentication used to access the server. Valid values are `SQL` or `ADPassword`. +* `operation_mode` - (Optional) Specifies the type of import operation being performed. The only allowable value is `Import`. + ## Attributes Reference The following attributes are exported: diff --git a/website/docs/r/sql_elasticpool.html.markdown b/website/docs/r/sql_elasticpool.html.markdown index 1d5d5bc487cfa..0bcff6338dfbf 100644 --- a/website/docs/r/sql_elasticpool.html.markdown +++ b/website/docs/r/sql_elasticpool.html.markdown @@ -6,7 +6,7 @@ description: |- Create a SQL Elastic Pool. --- -# azurerm\_sql\_elasticpool +# azurerm_sql_elasticpool Allows you to manage an Azure SQL Elastic Pool. diff --git a/website/docs/r/sql_firewall_rule.html.markdown b/website/docs/r/sql_firewall_rule.html.markdown index 9b8bd60464981..a0daf8718445d 100644 --- a/website/docs/r/sql_firewall_rule.html.markdown +++ b/website/docs/r/sql_firewall_rule.html.markdown @@ -39,7 +39,7 @@ resource "azurerm_sql_firewall_rule" "test" { The following arguments are supported: -* `name` - (Required) The name of the SQL Server. +* `name` - (Required) The name of the firewall rule. * `resource_group_name` - (Required) The name of the resource group in which to create the sql server. diff --git a/website/docs/r/sql_server.html.markdown b/website/docs/r/sql_server.html.markdown index 65be0be70249a..8dc8c01a2e9c2 100644 --- a/website/docs/r/sql_server.html.markdown +++ b/website/docs/r/sql_server.html.markdown @@ -7,7 +7,7 @@ description: |- --- -# azurerm\_sql\_server +# azurerm_sql_server Manages a SQL Azure Database Server. diff --git a/website/docs/r/storage_account.html.markdown b/website/docs/r/storage_account.html.markdown index f2eb13964f247..edf7c9ae5b105 100644 --- a/website/docs/r/storage_account.html.markdown +++ b/website/docs/r/storage_account.html.markdown @@ -31,6 +31,48 @@ resource "azurerm_storage_account" "testsa" { } ``` +## Example Usage with Network Rules + +```hcl +resource "azurerm_resource_group" "testrg" { + name = "resourceGroupName" + location = "westus" +} + +resource "azurerm_virtual_network" "test" { + name = "virtnetname" + address_space = ["10.0.0.0/16"] + location = "${azurerm_resource_group.testrg.location}" + resource_group_name = "${azurerm_resource_group.testrg.name}" +} + +resource "azurerm_subnet" "test" { + name = "subnetname" + resource_group_name = "${azurerm_resource_group.testrg.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "10.0.2.0/24" + service_endpoints = ["Microsoft.Sql","Microsoft.Storage"] + } + +resource "azurerm_storage_account" "testsa" { + name = "storageaccountname" + resource_group_name = "${azurerm_resource_group.testrg.name}" + + location = "${azurerm_resource_group.testrg.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + network_rules { + ip_rules = ["127.0.0.1"] + virtual_network_subnet_ids = ["${azurerm_subnet.test.id}"] + } + + tags { + environment = "staging" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -45,23 +87,19 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -* `account_kind` - (Optional) Defines the Kind of account. Valid options are `Storage`, - `StorageV2` and `BlobStorage`. Changing this forces a new resource to be created. +* `account_kind` - (Optional) Defines the Kind of account. Valid options are `Storage`, + `StorageV2` and `BlobStorage`. Changing this forces a new resource to be created. Defaults to `Storage`. * `account_tier` - (Required) Defines the Tier to use for this storage account. Valid options are `Standard` and `Premium`. Changing this forces a new resource to be created * `account_replication_type` - (Required) Defines the type of replication to use for this storage account. Valid options are `LRS`, `GRS`, `RAGRS` and `ZRS`. -* `access_tier` - (Optional) Defines the access tier for `BlobStorage` and `StorageV2` accounts. Valid options are `Hot` and `Cold`, defaults to `Hot`. +* `access_tier` - (Optional) Defines the access tier for `BlobStorage` and `StorageV2` accounts. Valid options are `Hot` and `Cool`, defaults to `Hot`. -* `enable_blob_encryption` - (Optional) Boolean flag which controls if Encryption - Services are enabled for Blob storage, see [here](https://azure.microsoft.com/en-us/documentation/articles/storage-service-encryption/) - for more information. +* `enable_blob_encryption` - (Optional) Boolean flag which controls if Encryption Services are enabled for Blob storage, see [here](https://azure.microsoft.com/en-us/documentation/articles/storage-service-encryption/) for more information. Defaults to `true`. -* `enable_file_encryption` - (Optional) Boolean flag which controls if Encryption - Services are enabled for File storage, see [here](https://azure.microsoft.com/en-us/documentation/articles/storage-service-encryption/) - for more information. +* `enable_file_encryption` - (Optional) Boolean flag which controls if Encryption Services are enabled for File storage, see [here](https://azure.microsoft.com/en-us/documentation/articles/storage-service-encryption/) for more information. Defaults to `true`. * `enable_https_traffic_only` - (Optional) Boolean flag which forces HTTPS if enabled, see [here](https://docs.microsoft.com/en-us/azure/storage/storage-require-secure-transfer/) for more information. @@ -70,8 +108,12 @@ The following arguments are supported: * `custom_domain` - (Optional) A `custom_domain` block as documented below. +* `network_rules` - (Optional) A `network_rules` block as documented below. + * `tags` - (Optional) A mapping of tags to assign to the resource. +* `identity` - (Optional) A Managed Service Identity block as defined below. + --- * `custom_domain` supports the following: @@ -79,8 +121,25 @@ The following arguments are supported: * `name` - (Optional) The Custom Domain Name to use for the Storage Account, which will be validated by Azure. * `use_subdomain` - (Optional) Should the Custom Domain Name be validated by using indirect CNAME validation? +--- + +* `network_rules` supports the following: + +* `bypass` - (Optional) Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Valid options are +any combination of `Logging`, `Metrics`, `AzureServices`, or `None`. +* `ip_rules` - (Optional) List of IP or IP ranges in CIDR Format. Only IPV4 addresses are allowed. +* `virtual_network_subnet_ids` - (Optional) A list of resource ids for subnets. + ~> **Note:** [More information on Validation is available here](https://docs.microsoft.com/en-gb/azure/storage/blobs/storage-custom-domain-name) +--- + +`identity` supports the following: + +* `type` - (Required) Specifies the identity type of the Storage Account. At this time the only allowed value is `SystemAssigned`. + +~> The assigned `principal_id` and `tenant_id` can be retrieved after the identity `type` has been set to `SystemAssigned` and Storage Account has been created. More details are available below. + ## Attributes Reference The following attributes are exported in addition to the arguments listed above: @@ -101,6 +160,17 @@ The following attributes are exported in addition to the arguments listed above: * `secondary_connection_string` - The connection string associated with the secondary location * `primary_blob_connection_string` - The connection string associated with the primary blob location * `secondary_blob_connection_string` - The connection string associated with the secondary blob location +* `identity` - An `identity` block as defined below, which contains the Identity information for this Storage Account. + +--- + +`identity` exports the following: + +* `principal_id` - The Principal ID for the Service Principal associated with the Identity of this Storage Account. + +* `tenant_id` - The Tenant ID for the Service Principal associated with the Identity of this Storage Account. + +-> You can access the Principal ID via `${azurerm_storage_account.test.identity.0.principal_id}` and the Tenant ID via `${azurerm_storage_account.test.identity.0.tenant_id}` ## Import diff --git a/website/docs/r/storage_blob.html.markdown b/website/docs/r/storage_blob.html.markdown index 6daf615e3deb7..2adc126a18a84 100644 --- a/website/docs/r/storage_blob.html.markdown +++ b/website/docs/r/storage_blob.html.markdown @@ -6,7 +6,7 @@ description: |- Create a Azure Storage Blob. --- -# azurerm\_storage\_blob +# azurerm_storage_blob Create an Azure Storage Blob. @@ -14,7 +14,7 @@ Create an Azure Storage Blob. ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg-d" + name = "acctestRG-d" location = "westus" } @@ -64,6 +64,8 @@ The following arguments are supported: * `size` - (Optional) Used only for `page` blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0. +* `content_type` - (Optional) The content type of the storage blob. Cannot be defined if `source_uri` is defined. Defaults to `application/octet-stream`. + * `source` - (Optional) An absolute path to a file on the local system. Cannot be defined if `source_uri` is defined. * `source_uri` - (Optional) The URI of an existing blob, or a file in the Azure File service, to use as the source contents diff --git a/website/docs/r/storage_container.html.markdown b/website/docs/r/storage_container.html.markdown index 9a4ef200075ef..6690da0f6271b 100644 --- a/website/docs/r/storage_container.html.markdown +++ b/website/docs/r/storage_container.html.markdown @@ -6,7 +6,7 @@ description: |- Create a Azure Storage Container. --- -# azurerm\_storage\_container +# azurerm_storage_container Create an Azure Storage Container. @@ -14,7 +14,7 @@ Create an Azure Storage Container. ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "westus" } diff --git a/website/docs/r/storage_queue.html.markdown b/website/docs/r/storage_queue.html.markdown index 2dbe1ae0686ac..ea4f99e29ddd1 100644 --- a/website/docs/r/storage_queue.html.markdown +++ b/website/docs/r/storage_queue.html.markdown @@ -6,7 +6,7 @@ description: |- Create a Azure Storage Queue. --- -# azurerm\_storage\_queue +# azurerm_storage_queue Create an Azure Storage Queue. @@ -14,7 +14,7 @@ Create an Azure Storage Queue. ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg-%d" + name = "acctestRG-%d" location = "westus" } diff --git a/website/docs/r/storage_share.html.markdown b/website/docs/r/storage_share.html.markdown index 4fa69f3352f31..5553d108962bd 100644 --- a/website/docs/r/storage_share.html.markdown +++ b/website/docs/r/storage_share.html.markdown @@ -6,7 +6,7 @@ description: |- Create an Azure Storage Share. --- -# azurerm\_storage\_share +# azurerm_storage_share Create an Azure Storage File Share. diff --git a/website/docs/r/storage_table.html.markdown b/website/docs/r/storage_table.html.markdown index 99343206c39d8..181329510da3b 100644 --- a/website/docs/r/storage_table.html.markdown +++ b/website/docs/r/storage_table.html.markdown @@ -6,7 +6,7 @@ description: |- Create a Azure Storage Table. --- -# azurerm\_storage\_table +# azurerm_storage_table Create an Azure Storage Table. diff --git a/website/docs/r/subnet.html.markdown b/website/docs/r/subnet.html.markdown index b7bcbf05d6a5e..e2e3c2bbb7c03 100644 --- a/website/docs/r/subnet.html.markdown +++ b/website/docs/r/subnet.html.markdown @@ -1,6 +1,6 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_subnet" +page_title: "Azure Resource Manager: azurerm_subnet" sidebar_current: "docs-azurerm-resource-network-subnet" description: |- Manages a subnet. Subnets represent network segments within the IP space defined by the virtual network. diff --git a/website/docs/r/template_deployment.html.markdown b/website/docs/r/template_deployment.html.markdown index 88f454b4a44d3..36ada32d76bee 100644 --- a/website/docs/r/template_deployment.html.markdown +++ b/website/docs/r/template_deployment.html.markdown @@ -6,7 +6,7 @@ description: |- Create a template deployment of resources. --- -# azurerm\_template\_deployment +# azurerm_template_deployment Create a template deployment of resources @@ -20,7 +20,7 @@ One workaround for this is to use a unique Resource Group for each ARM Template ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg-01" + name = "acctestRG-01" location = "West US" } diff --git a/website/docs/r/traffic_manager_endpoint.html.markdown b/website/docs/r/traffic_manager_endpoint.html.markdown index f8f6492a52000..8b4c58d24680f 100644 --- a/website/docs/r/traffic_manager_endpoint.html.markdown +++ b/website/docs/r/traffic_manager_endpoint.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_traffic_manager_endpoint" sidebar_current: "docs-azurerm-resource-network-traffic-manager-endpoint" description: |- - Creates a Traffic Manager Endpoint. + Manages a Traffic Manager Endpoint. --- # azurerm_traffic_manager_endpoint -Creates a Traffic Manager Endpoint. +Manages a Traffic Manager Endpoint. ## Example Usage diff --git a/website/docs/r/traffic_manager_profile.html.markdown b/website/docs/r/traffic_manager_profile.html.markdown index 967d655f0a913..7b03f74046755 100644 --- a/website/docs/r/traffic_manager_profile.html.markdown +++ b/website/docs/r/traffic_manager_profile.html.markdown @@ -3,13 +3,13 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_traffic_manager_profile" sidebar_current: "docs-azurerm-resource-network-traffic-manager-profile" description: |- - Creates a Traffic Manager Profile. + Manages a Traffic Manager Profile. --- # azurerm_traffic_manager_profile -Creates a Traffic Manager Profile to which multiple endpoints can be attached. +Manages a Traffic Manager Profile to which multiple endpoints can be attached. ## Example Usage diff --git a/website/docs/r/user_assigned_identity.markdown b/website/docs/r/user_assigned_identity.markdown new file mode 100644 index 0000000000000..9358cbac4530f --- /dev/null +++ b/website/docs/r/user_assigned_identity.markdown @@ -0,0 +1,58 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azure_user_assigned_identity" +sidebar_current: "docs-azurerm-resource-user-assigned-identity" +description: |- + Manages a new user assigned identity. +--- + +# azurerm_user_assigned_identity + +Manages a user assigned identity. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "test" { + name = "acceptanceTestResourceGroup1" + location = "eastus" +} + +resource "azurerm_user_assigned_identity" "testIdentity" { + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + + name = "search-api" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the user assigned identity. Changing this forces a + new identity to be created. + +* `resource_group_name` - (Required) The name of the resource group in which to + create the user assigned identity. + +* `location` - (Required) The location/region where the user assigned identity is + created. + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The user assigned identity ID. + +* `principal_id` - Service Principal ID associated with the user assigned identity. + +## Import + +User Assigned Identitites can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_user_assigned_identity.testIdentity /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acceptanceTestResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testIdentity +``` diff --git a/website/docs/r/virtual_machine.html.markdown b/website/docs/r/virtual_machine.html.markdown index 43c948d44df11..8614fc85adc72 100644 --- a/website/docs/r/virtual_machine.html.markdown +++ b/website/docs/r/virtual_machine.html.markdown @@ -1,20 +1,22 @@ --- layout: "azurerm" page_title: "Azure Resource Manager: azurerm_virtual_machine" -sidebar_current: "docs-azurerm-resource-compute-virtual-machine" +sidebar_current: "docs-azurerm-resource-compute-virtual-machine-x" description: |- Create a Virtual Machine. --- -# azurerm\_virtual\_machine +# azurerm_virtual_machine Create a virtual machine. +~> **NOTE:** Data Disks can be attached either directly on the `azurerm_virtual_machine` resource, or using the `azurerm_virtual_machine_data_disk_attachment` resource - but the two cannot be used together. If both are used against the same Virtual Machine, spurious changes will occur. + ## Example Usage with Managed Disks and Azure Platform Images (Recommended) ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US 2" } @@ -127,7 +129,7 @@ data "azurerm_image" "image" { } resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US 2" } @@ -227,7 +229,7 @@ resource "azurerm_virtual_machine" "test" { ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US" } @@ -345,6 +347,9 @@ The following arguments are supported: * `storage_os_disk` - (Required) A Storage OS Disk block as referenced below. * `delete_os_disk_on_termination` - (Optional) Flag to enable deletion of the OS disk VHD blob or managed disk when the VM is deleted, defaults to `false` * `storage_data_disk` - (Optional) A list of Storage Data disk blocks as referenced below. + +~> **Please Note:** Data Disks can also be attached either using this block or [the `azurerm_virtual_machine_data_disk_attachment` resource](virtual_machine_data_disk_attachment.html) - but not both. + * `delete_data_disks_on_termination` - (Optional) Flag to enable deletion of storage data disk VHD blobs or managed disks when the VM is deleted, defaults to `false` * `os_profile` - (Optional) An OS Profile block as documented below. Required when `create_option` in the `storage_os_disk` block is set to `FromImage`. * `identity` - (Optional) An identity block as documented below. @@ -375,7 +380,7 @@ For more information on the different example configurations, please check out t `storage_image_reference` supports the following: -* `id` - (Optional) Specifies the ID of the (custom) image to use to create the virtual +* `id` - (Optional) Specifies the ID of the (custom) image to use to create the virtual machine, for example: ```hcl @@ -412,6 +417,7 @@ resource "azurerm_virtual_machine" "test" { * `image_uri` - (Optional) Specifies the image_uri in the form publisherName:offer:skus:version. `image_uri` can also specify the [VHD uri](https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-cli-deploy-templates/#create-a-custom-vm-image) of a custom VM image to clone. When cloning a custom disk image the `os_type` documented below becomes required. * `os_type` - (Optional) Specifies the operating system Type, valid values are windows, linux. * `disk_size_gb` - (Optional) Specifies the size of the os disk in gigabytes. +* `write_accelerator_enabled` - (Optional) Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. `storage_data_disk` supports the following: @@ -423,6 +429,7 @@ resource "azurerm_virtual_machine" "test" { * `disk_size_gb` - (Required) Specifies the size of the data disk in gigabytes. * `caching` - (Optional) Specifies the caching requirements. * `lun` - (Required) Specifies the logical unit number of the data disk. +* `write_accelerator_enabled` - (Optional) Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. `os_profile` supports the following: @@ -439,7 +446,9 @@ resource "azurerm_virtual_machine" "test" { `identity` supports the following: -* `type` - (Required) Specifies the identity type of the virtual machine. The only allowable value is `SystemAssigned`. To enable Managed Service Identity the virtual machine extension "ManagedIdentityExtensionForWindows" or "ManagedIdentityExtensionForLinux" must also be added to the virtual machine. The Principal ID can be retrieved after the virtual machine has been created, e.g. +* `type` - (Required) Specifies the identity type of the virtual machine. Allowable values are `SystemAssigned` and `UserAssigned`. To enable Managed Service Identity the virtual machine extension "ManagedIdentityExtensionForWindows" or "ManagedIdentityExtensionForLinux" must also be added to the virtual machine. For the `SystemAssigned` identity the Principal ID can be retrieved after the virtual machine has been created. See [documentation](https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/overview) for more information. + +* `identity_ids` - (Optional) Specifies a list of user managed identity ids to be assigned to the VM. Required if `type` is `UserAssigned`. ```hcl resource "azurerm_virtual_machine" "test" { @@ -473,6 +482,7 @@ output "principal_id" { * `provision_vm_agent` - (Optional) This value defaults to false. * `enable_automatic_upgrades` - (Optional) This value defaults to false. +* `timezone` - (Optional) Specifies the time zone of the virtual machine, [the possible values are defined here](http://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/). Defaults to `""`. * `winrm` - (Optional) A collection of WinRM configuration blocks as documented below. * `additional_unattend_config` - (Optional) An Additional Unattended Config block as documented below. @@ -491,8 +501,13 @@ output "principal_id" { `os_profile_linux_config` supports the following: * `disable_password_authentication` - (Required) Specifies whether password authentication should be disabled. If set to `false`, an `admin_password` must be specified. -* `ssh_keys` - (Optional) Specifies a collection of `path` and `key_data` to be placed on the virtual machine. - +* `ssh_keys` - (Optional) Specifies a collection of `path` and `key_data` to be placed on the virtual machine. The `path` attribute sets the path of the destination file on the virtual machine, and the `key_data`-attribute sets the content of the destination file. An example of a working configuration (`` needs to be replaced with the actual username): +```hcl + ssh_keys { + key_data = "${file("/home//.ssh/authorized_keys")}" + path = "/home//.ssh/authorized_keys" + } +``` ~> **Note:** Please note that the only allowed `path` is `/home//.ssh/authorized_keys` due to a limitation of Azure. `os_profile_secrets` supports the following: diff --git a/website/docs/r/virtual_machine_data_disk_attachment.html.markdown b/website/docs/r/virtual_machine_data_disk_attachment.html.markdown new file mode 100644 index 0000000000000..b443ce047a45e --- /dev/null +++ b/website/docs/r/virtual_machine_data_disk_attachment.html.markdown @@ -0,0 +1,138 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_virtual_machine_data_disk_attachment" +sidebar_current: "docs-azurerm-resource-compute-virtual-machine-data-disk-attachment" +description: |- + Manages attaching a Disk to a Virtual Machine. +--- + +# azurerm_virtual_machine_data_disk_attachment + +Manages attaching a Disk to a Virtual Machine. + +~> **NOTE:** Data Disks can be attached either directly on the `azurerm_virtual_machine` resource, or using the `azurerm_virtual_machine_data_disk_attachment` resource - but the two cannot be used together. If both are used against the same Virtual Machine, spurious changes will occur. + +-> **Please Note:** only Managed Disks are supported via this separate resource, Unmanaged Disks can be attached using the `storage_data_disk` block in the `azurerm_virtual_machine` resource. + +## Example Usage + +```hcl +variable "prefix" { + default = "example" +} + +locals { + vm_name = "${var.prefix}-vm" +} + +resource "azurerm_resource_group" "main" { + name = "${var.prefix}-resources" + location = "West Europe" +} + +resource "azurerm_virtual_network" "main" { + name = "${var.prefix}-network" + address_space = ["10.0.0.0/16"] + location = "${azurerm_resource_group.main.location}" + resource_group_name = "${azurerm_resource_group.main.name}" +} + +resource "azurerm_subnet" "internal" { + name = "internal" + resource_group_name = "${azurerm_resource_group.main.name}" + virtual_network_name = "${azurerm_virtual_network.main.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_network_interface" "main" { + name = "${var.prefix}-nic" + location = "${azurerm_resource_group.main.location}" + resource_group_name = "${azurerm_resource_group.main.name}" + + ip_configuration { + name = "internal" + subnet_id = "${azurerm_subnet.internal.id}" + private_ip_address_allocation = "dynamic" + } +} + +resource "azurerm_virtual_machine" "test" { + name = "${local.vm_name}" + 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_F2" + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + storage_os_disk { + name = "myosdisk1" + caching = "ReadWrite" + create_option = "FromImage" + managed_disk_type = "Standard_LRS" + } + + os_profile { + computer_name = "${local.vm_name}" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} + +resource "azurerm_managed_disk" "test" { + name = "${local.vm_name}-disk1" + 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 = 10 +} + +resource "azurerm_virtual_machine_data_disk_attachment" "test" { + managed_disk_id = "${azurerm_managed_disk.test.id}" + virtual_machine_id = "${azurerm_virtual_machine.windows.id}" + lun = "10" + caching = "ReadWrite" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `virtual_machine_id` - (Required) The ID of the Virtual Machine to which the Data Disk should be attached. Changing this forces a new resource to be created. + +* `managed_disk_id` - (Required) The ID of an existing Managed Disk which should be attached. Changing this forces a new resource to be created. + +* `lun` - (Required) The Logical Unit Number of the Data Disk, which needs to be unique within the Virtual Machine. Changing this forces a new resource to be created. + +* `caching` - (Required) Specifies the caching requirements for this Data Disk. Possible values include `None`, `ReadOnly` and `ReadWrite`. + +* `create_option` - (Optional) The Create Option of the Data Disk, such as `Empty` or `Attach`. Defaults to `Attach`. Changing this forces a new resource to be created. + +* `write_accelerator_enabled` - (Optional) Specifies if Write Accelerator is enabled on the disk. This can only be enabled on `Premium_LRS` managed disks with no caching and [M-Series VMs](https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/how-to-enable-write-accelerator). Defaults to `false`. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the Virtual Machine Data Disk attachment. + +## Import + +Virtual Machines Data Disk Attachments can be imported using the `resource id`, e.g. + +```hcl +terraform import azurerm_virtual_machine_data_disk_attachment.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.compute/virtualMachines/machine1/dataDisks/disk1 +``` + +-> **Please Note:** This is a Terraform Unique ID matching the format: `{virtualMachineID}/dataDisks/{diskName}` \ No newline at end of file diff --git a/website/docs/r/virtual_machine_extension.html.markdown b/website/docs/r/virtual_machine_extension.html.markdown index 9316f9826cd23..796f9554e3369 100644 --- a/website/docs/r/virtual_machine_extension.html.markdown +++ b/website/docs/r/virtual_machine_extension.html.markdown @@ -1,15 +1,15 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_virtual_machine_extension" +page_title: "Azure Resource Manager: azurerm_virtual_machine_extension" sidebar_current: "docs-azurerm-resource-compute-virtualmachine-extension" description: |- - Creates a new Virtual Machine Extension to provide post deployment + Manages a Virtual Machine Extension to provide post deployment configuration and run automated tasks. --- # azurerm_virtual_machine_extension -Creates a new Virtual Machine Extension to provide post deployment configuration +Manages a Virtual Machine Extension to provide post deployment configuration and run automated tasks. ~> **Please Note:** The CustomScript extensions for Linux & Windows require that the `commandToExecute` returns a `0` exit code to be classified as successfully deployed. You can achieve this by appending `exit 0` to the end of your `commandToExecute`. @@ -18,7 +18,7 @@ and run automated tasks. ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US" } diff --git a/website/docs/r/virtual_machine_scale_set.html.markdown b/website/docs/r/virtual_machine_scale_set.html.markdown index a2d86c76afaf6..ea8011c871f39 100644 --- a/website/docs/r/virtual_machine_scale_set.html.markdown +++ b/website/docs/r/virtual_machine_scale_set.html.markdown @@ -17,7 +17,7 @@ Create a virtual machine scale set. ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US 2" } @@ -146,7 +146,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { ```hcl resource "azurerm_resource_group" "test" { - name = "acctestrg" + name = "acctestRG" location = "West US" } @@ -245,9 +245,10 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. * `sku` - (Required) A sku block as documented below. * `upgrade_policy_mode` - (Required) Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, `Manual` or `Automatic`. -* `overprovision` - (Optional) Specifies whether the virtual machine scale set should be overprovisioned. -* `single_placement_group` - (Optional) Specifies whether the scale set is limited to a single placement group with a maximum size of 100 virtual machines. If set to false, managed disks must be used. Default is true. Changing this forces a +* `overprovision` - (Optional) Specifies whether the virtual machine scale set should be overprovisioned. Defaults to `true`. +* `single_placement_group` - (Optional) Specifies whether the scale set is limited to a single placement group with a maximum size of 100 virtual machines. If set to false, managed disks must be used. Defaults to `true`. Changing this forces a new resource to be created. See [documentation](http://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-placement-groups) for more information. +* `license_type` - (Optional, when a Windows machine) Specifies the Windows OS license type. If supplied, the only allowed values are `Windows_Client` and `Windows_Server`. * `os_profile` - (Required) A Virtual Machine OS Profile block as documented below. * `os_profile_secrets` - (Optional) A collection of Secret blocks as documented below. * `os_profile_windows_config` - (Required, when a windows machine) A Windows config block as documented below. @@ -259,6 +260,7 @@ The following arguments are supported: * `extension` - (Optional) Can be specified multiple times to add extension profiles to the scale set. Each `extension` block supports the fields documented below. * `boot_diagnostics` - (Optional) A boot diagnostics profile block as referenced below. * `plan` - (Optional) A plan block as documented below. +* `priority` - (Optional) Specifies the priority for the virtual machines in the scale set, defaults to `Regular`. Possible values are `Low` and `Regular`. * `tags` - (Optional) A mapping of tags to assign to the resource. * `zones` - (Optional) A collection of availability zones to spread the Virtual Machines over. @@ -272,7 +274,9 @@ The following arguments are supported: `identity` supports the following: -* `type` - (Required) Specifies the identity type to be assigned to the scale set. The only allowable value is `SystemAssigned`. To enable Managed Service Identity (MSI) on all machines in the scale set, an extension with the type "ManagedIdentityExtensionForWindows" or "ManagedIdentityExtensionForLinux" must also be added. The scale set's Service Principal ID (SPN) can be retrieved after the scale set has been created. +* `type` - (Required) Specifies the identity type to be assigned to the scale set. Allowable values are `SystemAssigned` and `UserAssigned`. To enable Managed Service Identity (MSI) on all machines in the scale set, an extension with the type "ManagedIdentityExtensionForWindows" or "ManagedIdentityExtensionForLinux" must also be added. 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/en-us/azure/active-directory/managed-service-identity/overview) for more information. + +* `identity_ids` - (Optional) Specifies a list of user managed identity ids to be assigned to the VMSS. Required if `type` is `UserAssigned`. ```hcl resource "azurerm_virtual_machine_scale_set" "test" { @@ -287,15 +291,15 @@ resource "azurerm_virtual_machine_scale_set" "test" { } identity { - type = "systemAssigned" + type = "systemAssigned" } extension { - name = "MSILinuxExtension" - publisher = "Microsoft.ManagedIdentity" - type = "ManagedIdentityExtensionForLinux" - type_handler_version = "1.0" - settings = "{\"port\": 50342}" + name = "MSILinuxExtension" + publisher = "Microsoft.ManagedIdentity" + type = "ManagedIdentityExtensionForLinux" + type_handler_version = "1.0" + settings = "{\"port\": 50342}" } output "principal_id" { @@ -351,10 +355,14 @@ resource "azurerm_virtual_machine_scale_set" "test" { * `name` - (Required) Specifies the name of the network interface configuration. * `primary` - (Required) Indicates whether network interfaces created from the network interface configuration will be the primary NIC of the VM. -* `ip_configuration` - (Required) An ip_configuration block as documented below +* `ip_configuration` - (Required) An ip_configuration block as documented below. +* `accelerated_networking` - (Optional) Specifies whether to enable accelerated networking or not. Defaults to `false`. +* `dns_settings` - (Optional) An dns_settings block as documented below. * `network_security_group_id` - (Optional) Specifies the identifier for the network security group. -* `accelerated_networking` - (Optional) Specifies whether to enable accelerated networking or not. Defaults to -`false`. + +`dns_settings` supports the following: + +* `dns_servers` - (Required) Specifies an array of dns servers. `ip_configuration` supports the following: @@ -450,7 +458,6 @@ The following attributes are exported: * `id` - The virtual machine scale set ID. - ## Import Virtual Machine Scale Sets can be imported using the `resource id`, e.g. diff --git a/website/docs/r/virtual_network.html.markdown b/website/docs/r/virtual_network.html.markdown index 9c6c8d616823e..ada47e904c775 100644 --- a/website/docs/r/virtual_network.html.markdown +++ b/website/docs/r/virtual_network.html.markdown @@ -1,14 +1,14 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_virtual_network" +page_title: "Azure Resource Manager: azurerm_virtual_network" sidebar_current: "docs-azurerm-resource-network-virtual-network" description: |- - Creates a new virtual network including any configured subnets. Each subnet can optionally be configured with a security group to be associated with the subnet. + Manages a virtual network including any configured subnets. Each subnet can optionally be configured with a security group to be associated with the subnet. --- -# azurerm\_virtual\_network +# azurerm_virtual_network -Creates a new virtual network including any configured subnets. Each subnet can +Manages a virtual network including any configured subnets. Each subnet can optionally be configured with a security group to be associated with the subnet. ~> **NOTE on Virtual Networks and Subnet's:** Terraform currently diff --git a/website/docs/r/virtual_network_gateway.html.markdown b/website/docs/r/virtual_network_gateway.html.markdown index 40a0c1111ec73..9b9646322a9a4 100644 --- a/website/docs/r/virtual_network_gateway.html.markdown +++ b/website/docs/r/virtual_network_gateway.html.markdown @@ -1,14 +1,14 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_virtual_network_gateway" +page_title: "Azure Resource Manager: azurerm_virtual_network_gateway" sidebar_current: "docs-azurerm-resource-network-virtual-network-gateway-x" description: |- - Creates a new virtual network gateway to establish secure, cross-premises connectivity. + Manages a virtual network gateway to establish secure, cross-premises connectivity. --- # azurerm_virtual_network_gateway -Creates a new Virtual Network Gateway to establish secure, cross-premises connectivity. +Manages a Virtual Network Gateway to establish secure, cross-premises connectivity. -> **Note:** Please be aware that provisioning a Virtual Network Gateway takes a long time (between 30 minutes and 1 hour) @@ -170,12 +170,23 @@ The `vpn_client_configuration` block supports: vpn clients will be taken. You can provide more than one address space, e.g. in CIDR notation. -* `root_certificate` - (Required) One or more `root_certificate` blocks which are +* `vpn_client_protocols` - (Optional) List of the protocols supported by the vpn client. + The supported values are "SSTP" and "IkeV2". + +* `root_certificate` - (Optional) One or more `root_certificate` blocks which are defined below. These root certificates are used to sign the client certificate used by the VPN clients to connect to the gateway. + This setting is incompatible with the use of `radius_server_address` and `radius_server_secret`. * `revoked_certificate` - (Optional) One or more `revoked_certificate` blocks which are defined below. + This setting is incompatible with the use of `radius_server_address` and `radius_server_secret`. + +* `radius_server_address` - (Optional) The address of the Radius server. + This setting is incompatible with the use of `root_certificate` and `revoked_certificate`. + +* `radius_server_secret` - (Optional) The secret used by the Radius server. + This setting is incompatible with the use of `root_certificate` and `revoked_certificate`. The `bgp_settings` block supports: diff --git a/website/docs/r/virtual_network_gateway_connection.html.markdown b/website/docs/r/virtual_network_gateway_connection.html.markdown index 85327a9397c96..0407a8c0de912 100644 --- a/website/docs/r/virtual_network_gateway_connection.html.markdown +++ b/website/docs/r/virtual_network_gateway_connection.html.markdown @@ -1,14 +1,14 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_virtual_network_gateway_connection" +page_title: "Azure Resource Manager: azurerm_virtual_network_gateway_connection" sidebar_current: "docs-azurerm-resource-network-virtual-network-gateway-connection" description: |- - Creates a new connection in an existing Virtual Network Gateway. + Manages a connection in an existing Virtual Network Gateway. --- # azurerm_virtual_network_gateway_connection -Creates a new connection in an existing Virtual Network Gateway. +Manages a connection in an existing Virtual Network Gateway. ## Example Usage @@ -274,7 +274,7 @@ The `ipsec_policy` block supports: * `ipsec_integrity` - (Required) The IPSec integrity algorithm. Valid options are `GCMAES128`, `GCMAES192`, `GCMAES256`, `MD5`, `SHA1`, or `SHA256`. - + * `pfs_group` - (Required) The DH group used in IKE phase 2 for new child SA. Valid options are `ECP256`, `ECP384`, `PFS1`, `PFS2`, `PFS2048`, `PFS24`, or `None`. diff --git a/website/docs/r/virtual_network_peering.html.markdown b/website/docs/r/virtual_network_peering.html.markdown index 7b362d2a103d7..beabb001c02c6 100644 --- a/website/docs/r/virtual_network_peering.html.markdown +++ b/website/docs/r/virtual_network_peering.html.markdown @@ -1,15 +1,15 @@ --- layout: "azurerm" -page_title: "Azure Resource Manager: azure_virtual_network_peering" +page_title: "Azure Resource Manager: azurerm_virtual_network_peering" sidebar_current: "docs-azurerm-resource-network-virtual-network-peering" description: |- - Creates a new virtual network peering which allows resources to access other + Manages a virtual network peering which allows resources to access other resources in the linked virtual network. --- -# azurerm\_virtual\_network\_peering +# azurerm_virtual_network_peering -Creates a new virtual network peering which allows resources to access other +Manages a virtual network peering which allows resources to access other resources in the linked virtual network. ## Example Usage @@ -49,6 +49,59 @@ resource "azurerm_virtual_network_peering" "test2" { } ``` +## Example Usage (Global virtual network peering) + +```hcl +variable "location" { + default = [ + "uksouth", + "southeastasia", + ] +} + +variable "vnet_address_space" { + default = [ + "10.0.0.0/16", + "10.1.0.0/16", + ] +} + +resource "azurerm_resource_group" "vnet" { + count = "${length(var.location)}" + name = "rg-global-vnet-peering-${count.index}" + location = "${element(var.location, count.index)}" +} + +resource "azurerm_virtual_network" "vnet" { + count = "${length(var.location)}" + name = "vnet-${count.index}" + resource_group_name = "${element(azurerm_resource_group.vnet.*.name, count.index)}" + address_space = ["${element(var.vnet_address_space, count.index)}"] + location = "${element(azurerm_resource_group.vnet.*.location, count.index)}" +} + +resource "azurerm_subnet" "nva" { + count = "${length(var.location)}" + name = "nva" + resource_group_name = "${element(azurerm_resource_group.vnet.*.name, count.index)}" + virtual_network_name = "${element(azurerm_virtual_network.vnet.*.name, count.index)}" + address_prefix = "${cidrsubnet("${element(azurerm_virtual_network.vnet.*.address_space[count.index], count.index)}", 13, 0)}" # /29 +} + +# enable global peering between the two virtual network +resource "azurerm_virtual_network_peering" "peering" { + count = "${length(var.location)}" + name = "peering-to-${element(azurerm_virtual_network.vnet.*.name, 1 - count.index)}" + resource_group_name = "${element(azurerm_resource_group.vnet.*.name, count.index)}" + virtual_network_name = "${element(azurerm_virtual_network.vnet.*.name, count.index)}" + remote_virtual_network_id = "${element(azurerm_virtual_network.vnet.*.id, 1 - count.index)}" + allow_virtual_network_access = true + allow_forwarded_traffic = true + # `allow_gateway_transit` must be set to false for vnet Global Peering + allow_gateway_transit = false +} +``` + ## Argument Reference The following arguments are supported: @@ -77,11 +130,13 @@ The following arguments are supported: remote virtual network’s link to the local virtual network. * `use_remote_gateways` - (Optional) Controls if remote gateways can be used on - the local virtual network. If the flag is set to true, and - allowGatewayTransit on the remote peering is also true, virtual network will + the local virtual network. If the flag is set to `true`, and + `allow_gateway_transit` on the 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. Defaults to false. + have this flag set to `true`. This flag cannot be set if virtual network + already has a gateway. Defaults to `false`. + +-> **NOTE:** `use_remote_gateways` must be set to `false` if using Global Virtual Network Peerings. ## Attributes Reference