From 605042b8547c84133ec4871ee82f7dbacb78dbdb Mon Sep 17 00:00:00 2001 From: Tom Harvey Date: Thu, 20 Sep 2018 11:29:49 +1000 Subject: [PATCH] New Resources: `azurerm_dev_test_lab` / `azurerm_dev_test_virtual_network` (#1944) * Vendoring v2016-05-15 of the DevTestLabs SDK * New Resource: `azurerm_dev_test_lab` * New Data Source: `azurerm_dev_test_lab` * New Resource: `azurerm_dev_test_virtual_network` * Validation for the DevTestLab name ``` $ acctests azurerm TestValidateDevTestLabName === RUN TestValidateDevTestLabName --- PASS: TestValidateDevTestLabName (0.00s) PASS ok github.com/terraform-providers/terraform-provider-azurerm/azurerm 0.343s ``` * DevTest Virtual Network: adding validation * Making the resource group name case insensitive * Documenting the bug * Adding validation to the data source * Moving the DevTest validation into the azure package --- azurerm/config.go | 16 + azurerm/data_source_dev_test_lab.go | 105 + azurerm/data_source_dev_test_lab_test.go | 95 + azurerm/helpers/azure/devtest.go | 14 + azurerm/helpers/azure/devtest_test.go | 31 + azurerm/provider.go | 8 +- azurerm/resource_arm_dev_test_lab.go | 205 + azurerm/resource_arm_dev_test_lab_test.go | 158 + .../resource_arm_dev_test_virtual_network.go | 181 + ...ource_arm_dev_test_virtual_network_test.go | 143 + .../mgmt/2016-05-15/dtl/armtemplates.go | 228 + .../mgmt/2016-05-15/dtl/artifacts.go | 303 + .../mgmt/2016-05-15/dtl/artifactsources.go | 443 + .../devtestlabs/mgmt/2016-05-15/dtl/client.go | 51 + .../devtestlabs/mgmt/2016-05-15/dtl/costs.go | 192 + .../mgmt/2016-05-15/dtl/customimages.go | 379 + .../devtestlabs/mgmt/2016-05-15/dtl/disks.go | 542 ++ .../mgmt/2016-05-15/dtl/environments.go | 387 + .../mgmt/2016-05-15/dtl/formulas.go | 388 + .../mgmt/2016-05-15/dtl/galleryimages.go | 151 + .../mgmt/2016-05-15/dtl/globalschedules.go | 683 ++ .../devtestlabs/mgmt/2016-05-15/dtl/labs.go | 939 ++ .../devtestlabs/mgmt/2016-05-15/dtl/models.go | 7728 +++++++++++++++++ .../2016-05-15/dtl/notificationchannels.go | 514 ++ .../mgmt/2016-05-15/dtl/operations.go | 107 + .../mgmt/2016-05-15/dtl/policies.go | 453 + .../mgmt/2016-05-15/dtl/policysets.go | 112 + .../mgmt/2016-05-15/dtl/provideroperations.go | 126 + .../mgmt/2016-05-15/dtl/schedules.go | 612 ++ .../mgmt/2016-05-15/dtl/secrets.go | 379 + .../mgmt/2016-05-15/dtl/servicerunners.go | 356 + .../devtestlabs/mgmt/2016-05-15/dtl/users.go | 440 + .../mgmt/2016-05-15/dtl/version.go | 30 + .../mgmt/2016-05-15/dtl/virtualmachines.go | 972 +++ .../2016-05-15/dtl/virtualmachineschedules.go | 527 ++ .../mgmt/2016-05-15/dtl/virtualnetworks.go | 444 + vendor/vendor.json | 8 + website/azurerm.erb | 19 + website/docs/d/dev_test_lab.html.markdown | 52 + website/docs/r/dev_test_lab.html.markdown | 70 + .../r/dev_test_virtual_network.html.markdown | 70 + 41 files changed, 18659 insertions(+), 2 deletions(-) create mode 100644 azurerm/data_source_dev_test_lab.go create mode 100644 azurerm/data_source_dev_test_lab_test.go create mode 100644 azurerm/helpers/azure/devtest.go create mode 100644 azurerm/helpers/azure/devtest_test.go create mode 100644 azurerm/resource_arm_dev_test_lab.go create mode 100644 azurerm/resource_arm_dev_test_lab_test.go create mode 100644 azurerm/resource_arm_dev_test_virtual_network.go create mode 100644 azurerm/resource_arm_dev_test_virtual_network_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/armtemplates.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifacts.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifactsources.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/costs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/customimages.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/disks.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/environments.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/formulas.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/galleryimages.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/globalschedules.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/labs.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/notificationchannels.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/policies.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/policysets.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/provideroperations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/schedules.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/secrets.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/servicerunners.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/users.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualmachines.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualmachineschedules.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualnetworks.go create mode 100644 website/docs/d/dev_test_lab.html.markdown create mode 100644 website/docs/r/dev_test_lab.html.markdown create mode 100644 website/docs/r/dev_test_virtual_network.html.markdown diff --git a/azurerm/config.go b/azurerm/config.go index 3b107b149f70..37381c6d908b 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -21,6 +21,7 @@ import ( analyticsAccount "github.com/Azure/azure-sdk-for-go/services/datalake/analytics/mgmt/2016-11-01/account" "github.com/Azure/azure-sdk-for-go/services/datalake/store/2016-11-01/filesystem" storeAccount "github.com/Azure/azure-sdk-for-go/services/datalake/store/mgmt/2016-11-01/account" + "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl" "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" @@ -136,6 +137,10 @@ type ArmClient struct { // Devices iothubResourceClient devices.IotHubResourceClient + // DevTestLabs + devTestLabsClient dtl.LabsClient + devTestVirtualNetworksClient dtl.VirtualNetworksClient + // Databases mysqlConfigurationsClient mysql.ConfigurationsClient mysqlDatabasesClient mysql.DatabasesClient @@ -428,6 +433,7 @@ func getArmClient(c *authentication.Config) (*ArmClient, error) { client.registerDatabases(endpoint, c.SubscriptionID, auth, sender) client.registerDataLakeStoreClients(endpoint, c.SubscriptionID, auth, sender) client.registerDeviceClients(endpoint, c.SubscriptionID, auth, sender) + client.registerDevTestClients(endpoint, c.SubscriptionID, auth) client.registerDNSClients(endpoint, c.SubscriptionID, auth, sender) client.registerEventGridClients(endpoint, c.SubscriptionID, auth, sender) client.registerEventHubClients(endpoint, c.SubscriptionID, auth, sender) @@ -690,6 +696,16 @@ func (c *ArmClient) registerDeviceClients(endpoint, subscriptionId string, auth c.iothubResourceClient = iotClient } +func (c *ArmClient) registerDevTestClients(endpoint, subscriptionId string, auth autorest.Authorizer) { + labsClient := dtl.NewLabsClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&labsClient.Client, auth) + c.devTestLabsClient = labsClient + + devTestVirtualNetworksClient := dtl.NewVirtualNetworksClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&devTestVirtualNetworksClient.Client, auth) + c.devTestVirtualNetworksClient = devTestVirtualNetworksClient +} + func (c *ArmClient) registerDNSClients(endpoint, subscriptionId string, auth autorest.Authorizer, sender autorest.Sender) { dn := dns.NewRecordSetsClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&dn.Client, auth) diff --git a/azurerm/data_source_dev_test_lab.go b/azurerm/data_source_dev_test_lab.go new file mode 100644 index 000000000000..8a1c6c78fa01 --- /dev/null +++ b/azurerm/data_source_dev_test_lab.go @@ -0,0 +1,105 @@ +package azurerm + +import ( + "fmt" + + "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func dataSourceArmDevTestLab() *schema.Resource { + return &schema.Resource{ + Read: dataSourceArmDevTestLabRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: azure.ValidateDevTestLabName(), + }, + + "location": locationForDataSourceSchema(), + + "resource_group_name": resourceGroupNameForDataSourceSchema(), + + "storage_type": { + Type: schema.TypeString, + Computed: true, + }, + + "tags": tagsForDataSourceSchema(), + + "artifacts_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "default_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "default_premium_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "key_vault_id": { + Type: schema.TypeString, + Computed: true, + }, + + "premium_data_disk_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "unique_identifier": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceArmDevTestLabRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).devTestLabsClient + ctx := meta.(*ArmClient).StopContext + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + read, err := client.Get(ctx, resourceGroup, name, "") + if err != nil { + if utils.ResponseWasNotFound(read.Response) { + return fmt.Errorf("DevTest Lab %q was not found in Resource Group %q", name, resourceGroup) + } + + return fmt.Errorf("Error making Read request on DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.SetId(*read.ID) + + d.Set("name", read.Name) + d.Set("resource_group_name", resourceGroup) + if location := read.Location; location != nil { + d.Set("location", azureRMNormalizeLocation(*location)) + } + + if props := read.LabProperties; props != nil { + d.Set("storage_type", string(props.LabStorageType)) + + // Computed fields + d.Set("artifacts_storage_account_id", props.ArtifactsStorageAccount) + d.Set("default_storage_account_id", props.DefaultStorageAccount) + d.Set("default_premium_storage_account_id", props.DefaultPremiumStorageAccount) + d.Set("key_vault_id", props.VaultName) + d.Set("premium_data_disk_storage_account_id", props.PremiumDataDiskStorageAccount) + d.Set("unique_identifier", props.UniqueIdentifier) + } + + flattenAndSetTags(d, read.Tags) + + return nil +} diff --git a/azurerm/data_source_dev_test_lab_test.go b/azurerm/data_source_dev_test_lab_test.go new file mode 100644 index 000000000000..1e0de8059751 --- /dev/null +++ b/azurerm/data_source_dev_test_lab_test.go @@ -0,0 +1,95 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccDataSourceAzureRMDevTestLab_basic(t *testing.T) { + dataSourceName := "data.azurerm_dev_test_lab.test" + rInt := acctest.RandInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceDevTestLab_basic(rInt, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(dataSourceName, "storage_type", "Premium"), + resource.TestCheckResourceAttr(dataSourceName, "tags.%", "0"), + ), + }, + }, + }) +} + +func TestAccDataSourceAzureRMDevTestLab_complete(t *testing.T) { + dataSourceName := "data.azurerm_dev_test_lab.test" + rInt := acctest.RandInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceDevTestLab_complete(rInt, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(dataSourceName, "storage_type", "Standard"), + resource.TestCheckResourceAttr(dataSourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(dataSourceName, "tags.Hello", "World"), + ), + }, + }, + }) +} + +func testAccDataSourceDevTestLab_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dev_test_lab" "test" { + name = "acctestdtl%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +data "azurerm_dev_test_lab" "test" { + name = "${azurerm_dev_test_lab.test.name}" + resource_group_name = "${azurerm_dev_test_lab.test.resource_group_name}" +} +`, rInt, location, rInt) +} + +func testAccDataSourceDevTestLab_complete(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dev_test_lab" "test" { + name = "acctestdtl%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_type = "Standard" + + tags { + "Hello" = "World" + } +} + +data "azurerm_dev_test_lab" "test" { + name = "${azurerm_dev_test_lab.test.name}" + resource_group_name = "${azurerm_dev_test_lab.test.resource_group_name}" +} +`, rInt, location, rInt) +} diff --git a/azurerm/helpers/azure/devtest.go b/azurerm/helpers/azure/devtest.go new file mode 100644 index 000000000000..3a18c96af15d --- /dev/null +++ b/azurerm/helpers/azure/devtest.go @@ -0,0 +1,14 @@ +package azure + +import ( + "regexp" + + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" +) + +func ValidateDevTestLabName() schema.SchemaValidateFunc { + return validation.StringMatch( + regexp.MustCompile("^[A-Za-z0-9_-]+$"), + "Lab Name can only include alphanumeric characters, underscores, hyphens.") +} diff --git a/azurerm/helpers/azure/devtest_test.go b/azurerm/helpers/azure/devtest_test.go new file mode 100644 index 000000000000..f5090b9d808c --- /dev/null +++ b/azurerm/helpers/azure/devtest_test.go @@ -0,0 +1,31 @@ +package azure + +import "testing" + +func TestValidateDevTestLabName(t *testing.T) { + validNames := []string{ + "valid-name", + "valid02-name", + "validName1", + "-validname1", + "valid_name", + "double-hyphen--valid", + } + for _, v := range validNames { + _, errors := ValidateDevTestLabName()(v, "example") + if len(errors) != 0 { + t.Fatalf("%q should be a valid Dev Test Lab Name: %q", v, errors) + } + } + + invalidNames := []string{ + "invalid!", + "!@£", + } + for _, v := range invalidNames { + _, errors := ValidateDevTestLabName()(v, "name") + if len(errors) == 0 { + t.Fatalf("%q should be an invalid Dev Test Lab Name", v) + } + } +} diff --git a/azurerm/provider.go b/azurerm/provider.go index 3b2908667350..739e563c86f0 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -89,6 +89,7 @@ func Provider() terraform.ResourceProvider { "azurerm_cosmosdb_account": dataSourceArmCosmosDBAccount(), "azurerm_container_registry": dataSourceArmContainerRegistry(), "azurerm_data_lake_store": dataSourceArmDataLakeStoreAccount(), + "azurerm_dev_test_lab": dataSourceArmDevTestLab(), "azurerm_dns_zone": dataSourceArmDnsZone(), "azurerm_eventhub_namespace": dataSourceEventHubNamespace(), "azurerm_image": dataSourceArmImage(), @@ -141,8 +142,6 @@ func Provider() terraform.ResourceProvider { "azurerm_automation_schedule": resourceArmAutomationSchedule(), "azurerm_autoscale_setting": resourceArmAutoScaleSetting(), "azurerm_availability_set": resourceArmAvailabilitySet(), - "azurerm_firewall": resourceArmFirewall(), - "azurerm_firewall_network_rule_collection": resourceArmFirewallNetworkRuleCollection(), "azurerm_cdn_endpoint": resourceArmCdnEndpoint(), "azurerm_cdn_profile": resourceArmCdnProfile(), "azurerm_container_registry": resourceArmContainerRegistry(), @@ -154,6 +153,8 @@ func Provider() terraform.ResourceProvider { "azurerm_data_lake_store": resourceArmDataLakeStore(), "azurerm_data_lake_store_file": resourceArmDataLakeStoreFile(), "azurerm_data_lake_store_firewall_rule": resourceArmDataLakeStoreFirewallRule(), + "azurerm_dev_test_lab": resourceArmDevTestLab(), + "azurerm_dev_test_virtual_network": resourceArmDevTestVirtualNetwork(), "azurerm_dns_a_record": resourceArmDnsARecord(), "azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(), "azurerm_dns_caa_record": resourceArmDnsCaaRecord(), @@ -173,6 +174,8 @@ func Provider() terraform.ResourceProvider { "azurerm_express_route_circuit": resourceArmExpressRouteCircuit(), "azurerm_express_route_circuit_authorization": resourceArmExpressRouteCircuitAuthorization(), "azurerm_express_route_circuit_peering": resourceArmExpressRouteCircuitPeering(), + "azurerm_firewall": resourceArmFirewall(), + "azurerm_firewall_network_rule_collection": resourceArmFirewallNetworkRuleCollection(), "azurerm_function_app": resourceArmFunctionApp(), "azurerm_image": resourceArmImage(), "azurerm_iothub": resourceArmIotHub(), @@ -381,6 +384,7 @@ func determineAzureResourceProvidersToRegister(providerList []resources.Provider "Microsoft.DBforMySQL": {}, "Microsoft.DBforPostgreSQL": {}, "Microsoft.Devices": {}, + "Microsoft.DevTestLab": {}, "Microsoft.DocumentDB": {}, "Microsoft.EventGrid": {}, "Microsoft.EventHub": {}, diff --git a/azurerm/resource_arm_dev_test_lab.go b/azurerm/resource_arm_dev_test_lab.go new file mode 100644 index 000000000000..2307727709a2 --- /dev/null +++ b/azurerm/resource_arm_dev_test_lab.go @@ -0,0 +1,205 @@ +package azurerm + +import ( + "fmt" + "log" + + "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl" + "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 resourceArmDevTestLab() *schema.Resource { + return &schema.Resource{ + Create: resourceArmDevTestLabCreateUpdate, + Read: resourceArmDevTestLabRead, + Update: resourceArmDevTestLabCreateUpdate, + Delete: resourceArmDevTestLabDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateDevTestLabName(), + }, + + "location": locationSchema(), + + // There's a bug in the Azure API where this is returned in lower-case + // BUG: https://github.com/Azure/azure-rest-api-specs/issues/3964 + "resource_group_name": resourceGroupNameDiffSuppressSchema(), + + "storage_type": { + Type: schema.TypeString, + Optional: true, + Default: string(dtl.Premium), + ValidateFunc: validation.StringInSlice([]string{ + string(dtl.Standard), + string(dtl.Premium), + }, false), + }, + + "tags": tagsSchema(), + + "artifacts_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "default_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "default_premium_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "key_vault_id": { + Type: schema.TypeString, + Computed: true, + }, + + "premium_data_disk_storage_account_id": { + Type: schema.TypeString, + Computed: true, + }, + + "unique_identifier": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceArmDevTestLabCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).devTestLabsClient + ctx := meta.(*ArmClient).StopContext + + log.Printf("[INFO] preparing arguments for DevTest Lab creation") + + name := d.Get("name").(string) + location := azureRMNormalizeLocation(d.Get("location").(string)) + resourceGroup := d.Get("resource_group_name").(string) + storageType := d.Get("storage_type").(string) + tags := d.Get("tags").(map[string]interface{}) + + parameters := dtl.Lab{ + Location: utils.String(location), + Tags: expandTags(tags), + LabProperties: &dtl.LabProperties{ + LabStorageType: dtl.StorageType(storageType), + }, + } + + future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) + if err != nil { + return fmt.Errorf("Error creating/updating DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + err = future.WaitForCompletionRef(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error waiting for creation/update of DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + read, err := client.Get(ctx, resourceGroup, name, "") + if err != nil { + return fmt.Errorf("Error retrieving DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if read.ID == nil { + return fmt.Errorf("Cannot read DevTest Lab %q (Resource Group %q) ID", name, resourceGroup) + } + + d.SetId(*read.ID) + + return resourceArmDevTestLabRead(d, meta) +} + +func resourceArmDevTestLabRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).devTestLabsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + name := id.Path["labs"] + + read, err := client.Get(ctx, resourceGroup, name, "") + if err != nil { + if utils.ResponseWasNotFound(read.Response) { + log.Printf("[DEBUG] DevTest Lab %q was not found in Resource Group %q - removing from state!", name, resourceGroup) + d.SetId("") + return nil + } + + return fmt.Errorf("Error making Read request on DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.Set("name", read.Name) + d.Set("resource_group_name", resourceGroup) + if location := read.Location; location != nil { + d.Set("location", azureRMNormalizeLocation(*location)) + } + + if props := read.LabProperties; props != nil { + d.Set("storage_type", string(props.LabStorageType)) + + // Computed fields + d.Set("artifacts_storage_account_id", props.ArtifactsStorageAccount) + d.Set("default_storage_account_id", props.DefaultStorageAccount) + d.Set("default_premium_storage_account_id", props.DefaultPremiumStorageAccount) + d.Set("key_vault_id", props.VaultName) + d.Set("premium_data_disk_storage_account_id", props.PremiumDataDiskStorageAccount) + d.Set("unique_identifier", props.UniqueIdentifier) + } + + flattenAndSetTags(d, read.Tags) + + return nil +} + +func resourceArmDevTestLabDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).devTestLabsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + name := id.Path["labs"] + + read, err := client.Get(ctx, resourceGroup, name, "") + if err != nil { + if utils.ResponseWasNotFound(read.Response) { + // deleted outside of TF + log.Printf("[DEBUG] DevTest Lab %q was not found in Resource Group %q - assuming removed!", name, resourceGroup) + return nil + } + + return fmt.Errorf("Error retrieving DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + future, err := client.Delete(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("Error deleting DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + err = future.WaitForCompletionRef(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error waiting for the deletion of DevTest Lab %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + return err +} diff --git a/azurerm/resource_arm_dev_test_lab_test.go b/azurerm/resource_arm_dev_test_lab_test.go new file mode 100644 index 000000000000..eba9e400d7d0 --- /dev/null +++ b/azurerm/resource_arm_dev_test_lab_test.go @@ -0,0 +1,158 @@ +package azurerm + +import ( + "fmt" + "net/http" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAzureRMDevTestLab_basic(t *testing.T) { + resourceName := "azurerm_dev_test_lab.test" + rInt := acctest.RandInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDevTestLabDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMDevTestLab_basic(rInt, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDevTestLabExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "storage_type", "Premium"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMDevTestLab_complete(t *testing.T) { + resourceName := "azurerm_dev_test_lab.test" + rInt := acctest.RandInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDevTestLabDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMDevTestLab_complete(rInt, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDevTestLabExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "storage_type", "Standard"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Hello", "World"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testCheckAzureRMDevTestLabExists(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) + } + + labName := 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 DevTest Lab: %s", labName) + } + + conn := testAccProvider.Meta().(*ArmClient).devTestLabsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + resp, err := conn.Get(ctx, resourceGroup, labName, "") + if err != nil { + return fmt.Errorf("Bad: Get devTestLabsClient: %+v", err) + } + + if resp.StatusCode == http.StatusNotFound { + return fmt.Errorf("Bad: DevTest Lab %q (Resource Group: %q) does not exist", labName, resourceGroup) + } + + return nil + } +} + +func testCheckAzureRMDevTestLabDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*ArmClient).devTestLabsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_dev_test_lab" { + continue + } + + labName := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := conn.Get(ctx, resourceGroup, labName, "") + + if err != nil { + if resp.StatusCode == http.StatusNotFound { + return nil + } + + return err + } + + return fmt.Errorf("DevTest Lab still exists:\n%#v", resp) + } + + return nil +} + +func testAccAzureRMDevTestLab_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dev_test_lab" "test" { + name = "acctestdtl%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} +`, rInt, location, rInt) +} + +func testAccAzureRMDevTestLab_complete(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dev_test_lab" "test" { + name = "acctestdtl%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_type = "Standard" + + tags { + "Hello" = "World" + } +} +`, rInt, location, rInt) +} diff --git a/azurerm/resource_arm_dev_test_virtual_network.go b/azurerm/resource_arm_dev_test_virtual_network.go new file mode 100644 index 000000000000..f9d5924ade2c --- /dev/null +++ b/azurerm/resource_arm_dev_test_virtual_network.go @@ -0,0 +1,181 @@ +package azurerm + +import ( + "fmt" + "log" + "regexp" + + "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl" + "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 resourceArmDevTestVirtualNetwork() *schema.Resource { + return &schema.Resource{ + Create: resourceArmDevTestVirtualNetworkCreateUpdate, + Read: resourceArmDevTestVirtualNetworkRead, + Update: resourceArmDevTestVirtualNetworkCreateUpdate, + Delete: resourceArmDevTestVirtualNetworkDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateDevTestVirtualNetworkName(), + }, + + "lab_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateDevTestLabName(), + }, + + // There's a bug in the Azure API where this is returned in lower-case + // BUG: https://github.com/Azure/azure-rest-api-specs/issues/3964 + "resource_group_name": resourceGroupNameDiffSuppressSchema(), + + "description": { + Type: schema.TypeString, + Optional: true, + }, + + "tags": tagsSchema(), + + "unique_identifier": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceArmDevTestVirtualNetworkCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).devTestVirtualNetworksClient + ctx := meta.(*ArmClient).StopContext + + log.Printf("[INFO] preparing arguments for DevTest Virtual Network creation") + + name := d.Get("name").(string) + labName := d.Get("lab_name").(string) + resourceGroup := d.Get("resource_group_name").(string) + description := d.Get("description").(string) + tags := d.Get("tags").(map[string]interface{}) + + parameters := dtl.VirtualNetwork{ + Tags: expandTags(tags), + VirtualNetworkProperties: &dtl.VirtualNetworkProperties{ + Description: utils.String(description), + }, + } + + future, err := client.CreateOrUpdate(ctx, resourceGroup, labName, name, parameters) + if err != nil { + return fmt.Errorf("Error creating/updating DevTest Virtual Network %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err) + } + + err = future.WaitForCompletionRef(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error waiting for creation/update of DevTest Virtual Network %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err) + } + + read, err := client.Get(ctx, resourceGroup, labName, name, "") + if err != nil { + return fmt.Errorf("Error retrieving DevTest Virtual Network %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err) + } + + if read.ID == nil { + return fmt.Errorf("Cannot read DevTest Virtual Network %q (Lab %q / Resource Group %q) ID", name, labName, resourceGroup) + } + + d.SetId(*read.ID) + + return resourceArmDevTestVirtualNetworkRead(d, meta) +} + +func resourceArmDevTestVirtualNetworkRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).devTestVirtualNetworksClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + labName := id.Path["labs"] + name := id.Path["virtualnetworks"] + + read, err := client.Get(ctx, resourceGroup, labName, name, "") + if err != nil { + if utils.ResponseWasNotFound(read.Response) { + log.Printf("[DEBUG] DevTest Virtual Network %q was not found in Lab %q / Resource Group %q - removing from state!", name, labName, resourceGroup) + d.SetId("") + return nil + } + + return fmt.Errorf("Error making Read request on DevTest Virtual Network %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err) + } + + d.Set("name", read.Name) + d.Set("lab_name", labName) + d.Set("resource_group_name", resourceGroup) + + if props := read.VirtualNetworkProperties; props != nil { + d.Set("description", props.Description) + + // Computed fields + d.Set("unique_identifier", props.UniqueIdentifier) + } + + flattenAndSetTags(d, read.Tags) + + return nil +} + +func resourceArmDevTestVirtualNetworkDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).devTestVirtualNetworksClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + labName := id.Path["labs"] + name := id.Path["virtualnetworks"] + + read, err := client.Get(ctx, resourceGroup, labName, name, "") + if err != nil { + if utils.ResponseWasNotFound(read.Response) { + // deleted outside of TF + log.Printf("[DEBUG] DevTest Virtual Network %q was not found in Lab %q / Resource Group %q - assuming removed!", name, labName, resourceGroup) + return nil + } + + return fmt.Errorf("Error retrieving DevTest Virtual Network %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err) + } + + future, err := client.Delete(ctx, resourceGroup, labName, name) + if err != nil { + return fmt.Errorf("Error deleting DevTest Virtual Network %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err) + } + + err = future.WaitForCompletionRef(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error waiting for the deletion of DevTest Virtual Network %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err) + } + + return err +} + +func validateDevTestVirtualNetworkName() schema.SchemaValidateFunc { + return validation.StringMatch( + regexp.MustCompile("^[A-Za-z0-9_-]+$"), + "Virtual Network Name can only include alphanumeric characters, underscores, hyphens.") +} diff --git a/azurerm/resource_arm_dev_test_virtual_network_test.go b/azurerm/resource_arm_dev_test_virtual_network_test.go new file mode 100644 index 000000000000..f53009bdd476 --- /dev/null +++ b/azurerm/resource_arm_dev_test_virtual_network_test.go @@ -0,0 +1,143 @@ +package azurerm + +import ( + "fmt" + "net/http" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestValidateDevTestVirtualNetworkName(t *testing.T) { + validNames := []string{ + "valid-name", + "valid02-name", + "validName1", + "-validname1", + "valid_name", + "double-hyphen--valid", + } + for _, v := range validNames { + _, errors := validateDevTestVirtualNetworkName()(v, "example") + if len(errors) != 0 { + t.Fatalf("%q should be a valid Dev Test Virtual Network Name: %q", v, errors) + } + } + + invalidNames := []string{ + "invalid!", + "!@£", + } + for _, v := range invalidNames { + _, errors := validateDevTestVirtualNetworkName()(v, "name") + if len(errors) == 0 { + t.Fatalf("%q should be an invalid Dev Test Virtual Network Name", v) + } + } +} + +func TestAccAzureRMDevTestVirtualNetwork_basic(t *testing.T) { + resourceName := "azurerm_dev_test_virtual_network.test" + rInt := acctest.RandInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDevTestVirtualNetworkDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMDevTestVirtualNetwork_basic(rInt, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMDevTestVirtualNetworkExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testCheckAzureRMDevTestVirtualNetworkExists(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) + } + + virtualNetworkName := rs.Primary.Attributes["name"] + labName := rs.Primary.Attributes["lab_name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + conn := testAccProvider.Meta().(*ArmClient).devTestVirtualNetworksClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + resp, err := conn.Get(ctx, resourceGroup, labName, virtualNetworkName, "") + if err != nil { + return fmt.Errorf("Bad: Get devTestVirtualNetworksClient: %+v", err) + } + + if resp.StatusCode == http.StatusNotFound { + return fmt.Errorf("Bad: DevTest Virtual Network %q (Lab %q / Resource Group: %q) does not exist", virtualNetworkName, labName, resourceGroup) + } + + return nil + } +} + +func testCheckAzureRMDevTestVirtualNetworkDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*ArmClient).devTestVirtualNetworksClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_dev_test_virtual_network" { + continue + } + + virtualNetworkName := rs.Primary.Attributes["name"] + labName := rs.Primary.Attributes["lab_name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := conn.Get(ctx, resourceGroup, labName, virtualNetworkName, "") + + if err != nil { + if resp.StatusCode == http.StatusNotFound { + return nil + } + + return err + } + + return fmt.Errorf("DevTest Virtual Network still exists:\n%#v", resp) + } + + return nil +} + +func testAccAzureRMDevTestVirtualNetwork_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_dev_test_lab" "test" { + name = "acctestdtl%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_dev_test_virtual_network" "test" { + name = "acctestdtvn%d" + lab_name = "${azurerm_dev_test_lab.test.name}" + resource_group_name = "${azurerm_resource_group.test.name}" +} +`, rInt, location, rInt, rInt) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/armtemplates.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/armtemplates.go new file mode 100644 index 000000000000..75643b1e8fa3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/armtemplates.go @@ -0,0 +1,228 @@ +package dtl + +// 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" +) + +// ArmTemplatesClient is the the DevTest Labs Client. +type ArmTemplatesClient struct { + BaseClient +} + +// NewArmTemplatesClient creates an instance of the ArmTemplatesClient client. +func NewArmTemplatesClient(subscriptionID string) ArmTemplatesClient { + return NewArmTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewArmTemplatesClientWithBaseURI creates an instance of the ArmTemplatesClient client. +func NewArmTemplatesClientWithBaseURI(baseURI string, subscriptionID string) ArmTemplatesClient { + return ArmTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get azure resource manager template. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// artifactSourceName - the name of the artifact source. +// name - the name of the azure Resource Manager template. +// expand - specify the $expand query. Example: 'properties($select=displayName)' +func (client ArmTemplatesClient) Get(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result ArmTemplate, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, artifactSourceName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ArmTemplatesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ArmTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 ArmTemplatesClient) GetResponder(resp *http.Response) (result ArmTemplate, 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 list azure resource manager templates in a given artifact source. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// artifactSourceName - the name of the artifact source. +// expand - specify the $expand query. Example: 'properties($select=displayName)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client ArmTemplatesClient) List(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArmTemplatePage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcat.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "List", resp, "Failure sending request") + return + } + + result.rwcat, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ArmTemplatesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ArmTemplatesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 ArmTemplatesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArmTemplate, 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 ArmTemplatesClient) listNextResults(lastResults ResponseWithContinuationArmTemplate) (result ResponseWithContinuationArmTemplate, err error) { + req, err := lastResults.responseWithContinuationArmTemplatePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ArmTemplatesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArmTemplateIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifacts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifacts.go new file mode 100644 index 000000000000..6d8451d45e08 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifacts.go @@ -0,0 +1,303 @@ +package dtl + +// 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" +) + +// ArtifactsClient is the the DevTest Labs Client. +type ArtifactsClient struct { + BaseClient +} + +// NewArtifactsClient creates an instance of the ArtifactsClient client. +func NewArtifactsClient(subscriptionID string) ArtifactsClient { + return NewArtifactsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewArtifactsClientWithBaseURI creates an instance of the ArtifactsClient client. +func NewArtifactsClientWithBaseURI(baseURI string, subscriptionID string) ArtifactsClient { + return ArtifactsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GenerateArmTemplate generates an ARM template for the given artifact, uploads the required files to a storage +// account, and validates the generated artifact. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// artifactSourceName - the name of the artifact source. +// name - the name of the artifact. +// generateArmTemplateRequest - parameters for generating an ARM template for deploying artifacts. +func (client ArtifactsClient) GenerateArmTemplate(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (result ArmTemplateInfo, err error) { + req, err := client.GenerateArmTemplatePreparer(ctx, resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "GenerateArmTemplate", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateArmTemplateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "GenerateArmTemplate", resp, "Failure sending request") + return + } + + result, err = client.GenerateArmTemplateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "GenerateArmTemplate", resp, "Failure responding to request") + } + + return +} + +// GenerateArmTemplatePreparer prepares the GenerateArmTemplate request. +func (client ArtifactsClient) GenerateArmTemplatePreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate", pathParameters), + autorest.WithJSON(generateArmTemplateRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateArmTemplateSender sends the GenerateArmTemplate request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactsClient) GenerateArmTemplateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateArmTemplateResponder handles the response to the GenerateArmTemplate request. The method always +// closes the http.Response Body. +func (client ArtifactsClient) GenerateArmTemplateResponder(resp *http.Response) (result ArmTemplateInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get artifact. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// artifactSourceName - the name of the artifact source. +// name - the name of the artifact. +// expand - specify the $expand query. Example: 'properties($select=title)' +func (client ArtifactsClient) Get(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result Artifact, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, artifactSourceName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ArtifactsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactsClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 ArtifactsClient) GetResponder(resp *http.Response) (result Artifact, 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 list artifacts in a given artifact source. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// artifactSourceName - the name of the artifact source. +// expand - specify the $expand query. Example: 'properties($select=title)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client ArtifactsClient) List(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifactPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwca.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "List", resp, "Failure sending request") + return + } + + result.rwca, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ArtifactsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactsClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 ArtifactsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArtifact, 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 ArtifactsClient) listNextResults(lastResults ResponseWithContinuationArtifact) (result ResponseWithContinuationArtifact, err error) { + req, err := lastResults.responseWithContinuationArtifactPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ArtifactsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifactIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifactsources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifactsources.go new file mode 100644 index 000000000000..609bb72b3a0c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/artifactsources.go @@ -0,0 +1,443 @@ +package dtl + +// 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" +) + +// ArtifactSourcesClient is the the DevTest Labs Client. +type ArtifactSourcesClient struct { + BaseClient +} + +// NewArtifactSourcesClient creates an instance of the ArtifactSourcesClient client. +func NewArtifactSourcesClient(subscriptionID string) ArtifactSourcesClient { + return NewArtifactSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewArtifactSourcesClientWithBaseURI creates an instance of the ArtifactSourcesClient client. +func NewArtifactSourcesClientWithBaseURI(baseURI string, subscriptionID string) ArtifactSourcesClient { + return ArtifactSourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing artifact source. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the artifact source. +// artifactSource - properties of an artifact source. +func (client ArtifactSourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (result ArtifactSource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: artifactSource, + Constraints: []validation.Constraint{{Target: "artifactSource.ArtifactSourceProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.ArtifactSourcesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, artifactSource) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ArtifactSourcesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithJSON(artifactSource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 ArtifactSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ArtifactSource, 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 delete artifact source. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the artifact source. +func (client ArtifactSourcesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ArtifactSourcesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 ArtifactSourcesClient) 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 get artifact source. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the artifact source. +// expand - specify the $expand query. Example: 'properties($select=displayName)' +func (client ArtifactSourcesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result ArtifactSource, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ArtifactSourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 ArtifactSourcesClient) GetResponder(resp *http.Response) (result ArtifactSource, 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 list artifact sources in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=displayName)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client ArtifactSourcesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifactSourcePage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcas.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "List", resp, "Failure sending request") + return + } + + result.rwcas, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ArtifactSourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 ArtifactSourcesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArtifactSource, 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 ArtifactSourcesClient) listNextResults(lastResults ResponseWithContinuationArtifactSource) (result ResponseWithContinuationArtifactSource, err error) { + req, err := lastResults.responseWithContinuationArtifactSourcePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ArtifactSourcesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifactSourceIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} + +// Update modify properties of artifact sources. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the artifact source. +// artifactSource - properties of an artifact source. +func (client ArtifactSourcesClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (result ArtifactSource, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, artifactSource) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ArtifactSourcesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithJSON(artifactSource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 ArtifactSourcesClient) UpdateResponder(resp *http.Response) (result ArtifactSource, 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/devtestlabs/mgmt/2016-05-15/dtl/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/client.go new file mode 100644 index 000000000000..032c34907701 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/client.go @@ -0,0 +1,51 @@ +// Package dtl implements the Azure ARM Dtl service API version 2016-05-15. +// +// The DevTest Labs Client. +package dtl + +// 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 Dtl + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Dtl. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/costs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/costs.go new file mode 100644 index 000000000000..dec29625150b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/costs.go @@ -0,0 +1,192 @@ +package dtl + +// 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" +) + +// CostsClient is the the DevTest Labs Client. +type CostsClient struct { + BaseClient +} + +// NewCostsClient creates an instance of the CostsClient client. +func NewCostsClient(subscriptionID string) CostsClient { + return NewCostsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCostsClientWithBaseURI creates an instance of the CostsClient client. +func NewCostsClientWithBaseURI(baseURI string, subscriptionID string) CostsClient { + return CostsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing cost. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the cost. +// labCost - a cost item. +func (client CostsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, labCost LabCost) (result LabCost, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: labCost, + Constraints: []validation.Constraint{{Target: "labCost.LabCostProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.CostsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, labCost) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CostsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.CostsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CostsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CostsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, labCost LabCost) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), + autorest.WithJSON(labCost), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CostsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 CostsClient) CreateOrUpdateResponder(resp *http.Response) (result LabCost, 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 +} + +// Get get cost. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the cost. +// expand - specify the $expand query. Example: 'properties($expand=labCostDetails)' +func (client CostsClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result LabCost, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CostsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.CostsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CostsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CostsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CostsClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 CostsClient) GetResponder(resp *http.Response) (result LabCost, 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/devtestlabs/mgmt/2016-05-15/dtl/customimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/customimages.go new file mode 100644 index 000000000000..7c2c9007a45d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/customimages.go @@ -0,0 +1,379 @@ +package dtl + +// 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" +) + +// CustomImagesClient is the the DevTest Labs Client. +type CustomImagesClient struct { + BaseClient +} + +// NewCustomImagesClient creates an instance of the CustomImagesClient client. +func NewCustomImagesClient(subscriptionID string) CustomImagesClient { + return NewCustomImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomImagesClientWithBaseURI creates an instance of the CustomImagesClient client. +func NewCustomImagesClientWithBaseURI(baseURI string, subscriptionID string) CustomImagesClient { + return CustomImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing custom image. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the custom image. +// customImage - a custom image. +func (client CustomImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, customImage CustomImage) (result CustomImagesCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: customImage, + Constraints: []validation.Constraint{{Target: "customImage.CustomImageProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.CustomImagesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, customImage) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CustomImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, customImage CustomImage) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), + autorest.WithJSON(customImage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) CreateOrUpdateSender(req *http.Request) (future CustomImagesCreateOrUpdateFuture, err error) { + var resp *http.Response + 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 CustomImagesClient) CreateOrUpdateResponder(resp *http.Response) (result CustomImage, 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 delete custom image. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the custom image. +func (client CustomImagesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result CustomImagesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CustomImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) DeleteSender(req *http.Request) (future CustomImagesDeleteFuture, err error) { + var resp *http.Response + 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 CustomImagesClient) 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 get custom image. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the custom image. +// expand - specify the $expand query. Example: 'properties($select=vm)' +func (client CustomImagesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result CustomImage, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 CustomImagesClient) GetResponder(resp *http.Response) (result CustomImage, 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 list custom images in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=vm)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client CustomImagesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationCustomImagePage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcci.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "List", resp, "Failure sending request") + return + } + + result.rwcci, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client CustomImagesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 CustomImagesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationCustomImage, 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 CustomImagesClient) listNextResults(lastResults ResponseWithContinuationCustomImage) (result ResponseWithContinuationCustomImage, err error) { + req, err := lastResults.responseWithContinuationCustomImagePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomImagesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationCustomImageIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/disks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/disks.go new file mode 100644 index 000000000000..5792fc4b5eb1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/disks.go @@ -0,0 +1,542 @@ +package dtl + +// 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" +) + +// DisksClient is the the DevTest Labs Client. +type DisksClient struct { + BaseClient +} + +// NewDisksClient creates an instance of the DisksClient client. +func NewDisksClient(subscriptionID string) DisksClient { + return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDisksClientWithBaseURI creates an instance of the DisksClient client. +func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { + return DisksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Attach attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the disk. +// attachDiskProperties - properties of the disk to attach. +func (client DisksClient) Attach(ctx context.Context, resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties) (result DisksAttachFuture, err error) { + req, err := client.AttachPreparer(ctx, resourceGroupName, labName, userName, name, attachDiskProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Attach", nil, "Failure preparing request") + return + } + + result, err = client.AttachSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Attach", result.Response(), "Failure sending request") + return + } + + return +} + +// AttachPreparer prepares the Attach request. +func (client DisksClient) AttachPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach", pathParameters), + autorest.WithJSON(attachDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AttachSender sends the Attach request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) AttachSender(req *http.Request) (future DisksAttachFuture, err error) { + var resp *http.Response + 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 +} + +// AttachResponder handles the response to the Attach request. The method always +// closes the http.Response Body. +func (client DisksClient) AttachResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing disk. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the disk. +// disk - a Disk. +func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, name string, disk Disk) (result DisksCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: disk, + Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.DisksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, name, disk) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, disk Disk) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), + autorest.WithJSON(disk), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) CreateOrUpdateSender(req *http.Request) (future DisksCreateOrUpdateFuture, err error) { + var resp *http.Response + 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 DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, 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 delete disk. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the disk. +func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result DisksDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) DeleteSender(req *http.Request) (future DisksDeleteFuture, err error) { + var resp *http.Response + 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 DisksClient) 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 +} + +// Detach detach and break the lease of the disk attached to the virtual machine. This operation can take a while to +// complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the disk. +// detachDiskProperties - properties of the disk to detach. +func (client DisksClient) Detach(ctx context.Context, resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties) (result DisksDetachFuture, err error) { + req, err := client.DetachPreparer(ctx, resourceGroupName, labName, userName, name, detachDiskProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Detach", nil, "Failure preparing request") + return + } + + result, err = client.DetachSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Detach", result.Response(), "Failure sending request") + return + } + + return +} + +// DetachPreparer prepares the Detach request. +func (client DisksClient) DetachPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach", pathParameters), + autorest.WithJSON(detachDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachSender sends the Detach request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) DetachSender(req *http.Request) (future DisksDetachFuture, err error) { + var resp *http.Response + 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 +} + +// DetachResponder handles the response to the Detach request. The method always +// closes the http.Response Body. +func (client DisksClient) DetachResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get disk. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the disk. +// expand - specify the $expand query. Example: 'properties($select=diskType)' +func (client DisksClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (result Disk, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 DisksClient) GetResponder(resp *http.Response) (result Disk, 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 list disks in a given user profile. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// expand - specify the $expand query. Example: 'properties($select=diskType)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client DisksClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDiskPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcd.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "List", resp, "Failure sending request") + return + } + + result.rwcd, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DisksClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 DisksClient) ListResponder(resp *http.Response) (result ResponseWithContinuationDisk, 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 DisksClient) listNextResults(lastResults ResponseWithContinuationDisk) (result ResponseWithContinuationDisk, err error) { + req, err := lastResults.responseWithContinuationDiskPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.DisksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.DisksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DisksClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDiskIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/environments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/environments.go new file mode 100644 index 000000000000..6e1e06ed2947 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/environments.go @@ -0,0 +1,387 @@ +package dtl + +// 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" +) + +// EnvironmentsClient is the the DevTest Labs Client. +type EnvironmentsClient struct { + BaseClient +} + +// NewEnvironmentsClient creates an instance of the EnvironmentsClient client. +func NewEnvironmentsClient(subscriptionID string) EnvironmentsClient { + return NewEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentsClientWithBaseURI creates an instance of the EnvironmentsClient client. +func NewEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentsClient { + return EnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing environment. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the environment. +// dtlEnvironment - an environment, which is essentially an ARM template deployment. +func (client EnvironmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment Environment) (result EnvironmentsCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: dtlEnvironment, + Constraints: []validation.Constraint{{Target: "dtlEnvironment.EnvironmentProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.EnvironmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, name, dtlEnvironment) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment Environment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), + autorest.WithJSON(dtlEnvironment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) CreateOrUpdateSender(req *http.Request) (future EnvironmentsCreateOrUpdateFuture, err error) { + var resp *http.Response + 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 EnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result Environment, 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 delete environment. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the environment. +func (client EnvironmentsClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result EnvironmentsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) DeleteSender(req *http.Request) (future EnvironmentsDeleteFuture, err error) { + var resp *http.Response + 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 EnvironmentsClient) 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 get environment. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the environment. +// expand - specify the $expand query. Example: 'properties($select=deploymentProperties)' +func (client EnvironmentsClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (result Environment, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 EnvironmentsClient) GetResponder(resp *http.Response) (result Environment, 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 list environments in a given user profile. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// expand - specify the $expand query. Example: 'properties($select=deploymentProperties)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client EnvironmentsClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDtlEnvironmentPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcde.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "List", resp, "Failure sending request") + return + } + + result.rwcde, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 EnvironmentsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationDtlEnvironment, 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 EnvironmentsClient) listNextResults(lastResults ResponseWithContinuationDtlEnvironment) (result ResponseWithContinuationDtlEnvironment, err error) { + req, err := lastResults.responseWithContinuationDtlEnvironmentPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EnvironmentsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDtlEnvironmentIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/formulas.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/formulas.go new file mode 100644 index 000000000000..0bc96e0f7fdf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/formulas.go @@ -0,0 +1,388 @@ +package dtl + +// 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" +) + +// FormulasClient is the the DevTest Labs Client. +type FormulasClient struct { + BaseClient +} + +// NewFormulasClient creates an instance of the FormulasClient client. +func NewFormulasClient(subscriptionID string) FormulasClient { + return NewFormulasClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFormulasClientWithBaseURI creates an instance of the FormulasClient client. +func NewFormulasClientWithBaseURI(baseURI string, subscriptionID string) FormulasClient { + return FormulasClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing Formula. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the formula. +// formula - a formula for creating a VM, specifying an image base and other parameters +func (client FormulasClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, formula Formula) (result FormulasCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: formula, + Constraints: []validation.Constraint{{Target: "formula.FormulaProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("dtl.FormulasClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, formula) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FormulasClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, formula Formula) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), + autorest.WithJSON(formula), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) CreateOrUpdateSender(req *http.Request) (future FormulasCreateOrUpdateFuture, err error) { + var resp *http.Response + 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 FormulasClient) CreateOrUpdateResponder(resp *http.Response) (result Formula, 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 delete formula. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the formula. +func (client FormulasClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FormulasClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 FormulasClient) 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 get formula. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the formula. +// expand - specify the $expand query. Example: 'properties($select=description)' +func (client FormulasClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result Formula, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FormulasClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 FormulasClient) GetResponder(resp *http.Response) (result Formula, 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 list formulas in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=description)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client FormulasClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationFormulaPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcf.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "List", resp, "Failure sending request") + return + } + + result.rwcf, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client FormulasClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 FormulasClient) ListResponder(resp *http.Response) (result ResponseWithContinuationFormula, 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 FormulasClient) listNextResults(lastResults ResponseWithContinuationFormula) (result ResponseWithContinuationFormula, err error) { + req, err := lastResults.responseWithContinuationFormulaPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.FormulasClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.FormulasClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FormulasClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationFormulaIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/galleryimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/galleryimages.go new file mode 100644 index 000000000000..6741399c9ed3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/galleryimages.go @@ -0,0 +1,151 @@ +package dtl + +// 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" +) + +// GalleryImagesClient is the the DevTest Labs Client. +type GalleryImagesClient struct { + BaseClient +} + +// NewGalleryImagesClient creates an instance of the GalleryImagesClient client. +func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient { + return NewGalleryImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGalleryImagesClientWithBaseURI creates an instance of the GalleryImagesClient client. +func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient { + return GalleryImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list gallery images in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=author)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client GalleryImagesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationGalleryImagePage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcgi.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "List", resp, "Failure sending request") + return + } + + result.rwcgi, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GalleryImagesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 GalleryImagesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationGalleryImage, 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 GalleryImagesClient) listNextResults(lastResults ResponseWithContinuationGalleryImage) (result ResponseWithContinuationGalleryImage, err error) { + req, err := lastResults.responseWithContinuationGalleryImagePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client GalleryImagesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationGalleryImageIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/globalschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/globalschedules.go new file mode 100644 index 000000000000..cbb18431b4cb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/globalschedules.go @@ -0,0 +1,683 @@ +package dtl + +// 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" +) + +// GlobalSchedulesClient is the the DevTest Labs Client. +type GlobalSchedulesClient struct { + BaseClient +} + +// NewGlobalSchedulesClient creates an instance of the GlobalSchedulesClient client. +func NewGlobalSchedulesClient(subscriptionID string) GlobalSchedulesClient { + return NewGlobalSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGlobalSchedulesClientWithBaseURI creates an instance of the GlobalSchedulesClient client. +func NewGlobalSchedulesClientWithBaseURI(baseURI string, subscriptionID string) GlobalSchedulesClient { + return GlobalSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the schedule. +// schedule - a schedule. +func (client GlobalSchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, schedule Schedule) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schedule, + Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.GlobalSchedulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GlobalSchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, schedule Schedule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 GlobalSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, 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 delete schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the schedule. +func (client GlobalSchedulesClient) Delete(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GlobalSchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 GlobalSchedulesClient) 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 +} + +// Execute execute a schedule. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the schedule. +func (client GlobalSchedulesClient) Execute(ctx context.Context, resourceGroupName string, name string) (result GlobalSchedulesExecuteFuture, err error) { + req, err := client.ExecutePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + result, err = client.ExecuteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Execute", result.Response(), "Failure sending request") + return + } + + return +} + +// ExecutePreparer prepares the Execute request. +func (client GlobalSchedulesClient) ExecutePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSender sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) ExecuteSender(req *http.Request) (future GlobalSchedulesExecuteFuture, err error) { + var resp *http.Response + 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 +} + +// ExecuteResponder handles the response to the Execute request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the schedule. +// expand - specify the $expand query. Example: 'properties($select=status)' +func (client GlobalSchedulesClient) Get(ctx context.Context, resourceGroupName string, name string, expand string) (result Schedule, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GlobalSchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 GlobalSchedulesClient) GetResponder(resp *http.Response) (result Schedule, 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 list schedules in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// expand - specify the $expand query. Example: 'properties($select=status)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client GlobalSchedulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedulePage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rwcs.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rwcs, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client GlobalSchedulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return 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 GlobalSchedulesClient) ListByResourceGroupResponder(resp *http.Response) (result ResponseWithContinuationSchedule, 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 GlobalSchedulesClient) listByResourceGroupNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.responseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client GlobalSchedulesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationScheduleIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, expand, filter, top, orderby) + return +} + +// ListBySubscription list schedules in a subscription. +// Parameters: +// expand - specify the $expand query. Example: 'properties($select=status)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client GlobalSchedulesClient) ListBySubscription(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedulePage, err error) { + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.rwcs.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.rwcs, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client GlobalSchedulesClient) ListBySubscriptionPreparer(ctx context.Context, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return 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 GlobalSchedulesClient) ListBySubscriptionResponder(resp *http.Response) (result ResponseWithContinuationSchedule, 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 GlobalSchedulesClient) listBySubscriptionNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.responseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client GlobalSchedulesClient) ListBySubscriptionComplete(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationScheduleIterator, err error) { + result.page, err = client.ListBySubscription(ctx, expand, filter, top, orderby) + return +} + +// Retarget updates a schedule's target resource Id. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the schedule. +// retargetScheduleProperties - properties for retargeting a virtual machine schedule. +func (client GlobalSchedulesClient) Retarget(ctx context.Context, resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties) (result GlobalSchedulesRetargetFuture, err error) { + req, err := client.RetargetPreparer(ctx, resourceGroupName, name, retargetScheduleProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Retarget", nil, "Failure preparing request") + return + } + + result, err = client.RetargetSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Retarget", result.Response(), "Failure sending request") + return + } + + return +} + +// RetargetPreparer prepares the Retarget request. +func (client GlobalSchedulesClient) RetargetPreparer(ctx context.Context, resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget", pathParameters), + autorest.WithJSON(retargetScheduleProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RetargetSender sends the Retarget request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) RetargetSender(req *http.Request) (future GlobalSchedulesRetargetFuture, err error) { + var resp *http.Response + 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 +} + +// RetargetResponder handles the response to the Retarget request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) RetargetResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of schedules. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the schedule. +// schedule - a schedule. +func (client GlobalSchedulesClient) Update(ctx context.Context, resourceGroupName string, name string, schedule ScheduleFragment) (result Schedule, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GlobalSchedulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, schedule ScheduleFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 GlobalSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, 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/devtestlabs/mgmt/2016-05-15/dtl/labs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/labs.go new file mode 100644 index 000000000000..11f27dc90df9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/labs.go @@ -0,0 +1,939 @@ +package dtl + +// 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" +) + +// LabsClient is the the DevTest Labs Client. +type LabsClient struct { + BaseClient +} + +// NewLabsClient creates an instance of the LabsClient client. +func NewLabsClient(subscriptionID string) LabsClient { + return NewLabsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLabsClientWithBaseURI creates an instance of the LabsClient client. +func NewLabsClientWithBaseURI(baseURI string, subscriptionID string) LabsClient { + return LabsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ClaimAnyVM claim a random claimable virtual machine in the lab. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +func (client LabsClient) ClaimAnyVM(ctx context.Context, resourceGroupName string, name string) (result LabsClaimAnyVMFuture, err error) { + req, err := client.ClaimAnyVMPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ClaimAnyVM", nil, "Failure preparing request") + return + } + + result, err = client.ClaimAnyVMSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ClaimAnyVM", result.Response(), "Failure sending request") + return + } + + return +} + +// ClaimAnyVMPreparer prepares the ClaimAnyVM request. +func (client LabsClient) ClaimAnyVMPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClaimAnyVMSender sends the ClaimAnyVM request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ClaimAnyVMSender(req *http.Request) (future LabsClaimAnyVMFuture, err error) { + var resp *http.Response + 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 +} + +// ClaimAnyVMResponder handles the response to the ClaimAnyVM request. The method always +// closes the http.Response Body. +func (client LabsClient) ClaimAnyVMResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateEnvironment create virtual machines in a lab. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +// labVirtualMachineCreationParameter - properties for creating a virtual machine. +func (client LabsClient) CreateEnvironment(ctx context.Context, resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter) (result LabsCreateEnvironmentFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: labVirtualMachineCreationParameter, + Constraints: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("dtl.LabsClient", "CreateEnvironment", err.Error()) + } + + req, err := client.CreateEnvironmentPreparer(ctx, resourceGroupName, name, labVirtualMachineCreationParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateEnvironment", nil, "Failure preparing request") + return + } + + result, err = client.CreateEnvironmentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateEnvironment", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateEnvironmentPreparer prepares the CreateEnvironment request. +func (client LabsClient) CreateEnvironmentPreparer(ctx context.Context, resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment", pathParameters), + autorest.WithJSON(labVirtualMachineCreationParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateEnvironmentSender sends the CreateEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) CreateEnvironmentSender(req *http.Request) (future LabsCreateEnvironmentFuture, err error) { + var resp *http.Response + 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 +} + +// CreateEnvironmentResponder handles the response to the CreateEnvironment request. The method always +// closes the http.Response Body. +func (client LabsClient) CreateEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing lab. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +// lab - a lab. +func (client LabsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, lab Lab) (result LabsCreateOrUpdateFuture, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, lab) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LabsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, lab Lab) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithJSON(lab), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) CreateOrUpdateSender(req *http.Request) (future LabsCreateOrUpdateFuture, err error) { + var resp *http.Response + 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 LabsClient) CreateOrUpdateResponder(resp *http.Response) (result Lab, 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 delete lab. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +func (client LabsClient) Delete(ctx context.Context, resourceGroupName string, name string) (result LabsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LabsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) DeleteSender(req *http.Request) (future LabsDeleteFuture, err error) { + var resp *http.Response + 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 LabsClient) 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 +} + +// ExportResourceUsage exports the lab resource usage into a storage account This operation can take a while to +// complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +// exportResourceUsageParameters - the parameters of the export operation. +func (client LabsClient) ExportResourceUsage(ctx context.Context, resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters) (result LabsExportResourceUsageFuture, err error) { + req, err := client.ExportResourceUsagePreparer(ctx, resourceGroupName, name, exportResourceUsageParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ExportResourceUsage", nil, "Failure preparing request") + return + } + + result, err = client.ExportResourceUsageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ExportResourceUsage", result.Response(), "Failure sending request") + return + } + + return +} + +// ExportResourceUsagePreparer prepares the ExportResourceUsage request. +func (client LabsClient) ExportResourceUsagePreparer(ctx context.Context, resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage", pathParameters), + autorest.WithJSON(exportResourceUsageParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportResourceUsageSender sends the ExportResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ExportResourceUsageSender(req *http.Request) (future LabsExportResourceUsageFuture, err error) { + var resp *http.Response + 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 +} + +// ExportResourceUsageResponder handles the response to the ExportResourceUsage request. The method always +// closes the http.Response Body. +func (client LabsClient) ExportResourceUsageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateUploadURI generate a URI for uploading custom disk images to a Lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +// generateUploadURIParameter - properties for generating an upload URI. +func (client LabsClient) GenerateUploadURI(ctx context.Context, resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (result GenerateUploadURIResponse, err error) { + req, err := client.GenerateUploadURIPreparer(ctx, resourceGroupName, name, generateUploadURIParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "GenerateUploadURI", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateUploadURISender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "GenerateUploadURI", resp, "Failure sending request") + return + } + + result, err = client.GenerateUploadURIResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "GenerateUploadURI", resp, "Failure responding to request") + } + + return +} + +// GenerateUploadURIPreparer prepares the GenerateUploadURI request. +func (client LabsClient) GenerateUploadURIPreparer(ctx context.Context, resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri", pathParameters), + autorest.WithJSON(generateUploadURIParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateUploadURISender sends the GenerateUploadURI request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) GenerateUploadURISender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateUploadURIResponder handles the response to the GenerateUploadURI request. The method always +// closes the http.Response Body. +func (client LabsClient) GenerateUploadURIResponder(resp *http.Response) (result GenerateUploadURIResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=defaultStorageAccount)' +func (client LabsClient) Get(ctx context.Context, resourceGroupName string, name string, expand string) (result Lab, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LabsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 LabsClient) GetResponder(resp *http.Response) (result Lab, 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 list labs in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// expand - specify the $expand query. Example: 'properties($select=defaultStorageAccount)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client LabsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rwcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rwcl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client LabsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return 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 LabsClient) ListByResourceGroupResponder(resp *http.Response) (result ResponseWithContinuationLab, 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 LabsClient) listByResourceGroupNextResults(lastResults ResponseWithContinuationLab) (result ResponseWithContinuationLab, err error) { + req, err := lastResults.responseWithContinuationLabPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client LabsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, expand, filter, top, orderby) + return +} + +// ListBySubscription list labs in a subscription. +// Parameters: +// expand - specify the $expand query. Example: 'properties($select=defaultStorageAccount)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client LabsClient) ListBySubscription(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabPage, err error) { + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.rwcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.rwcl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client LabsClient) ListBySubscriptionPreparer(ctx context.Context, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return 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 LabsClient) ListBySubscriptionResponder(resp *http.Response) (result ResponseWithContinuationLab, 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 LabsClient) listBySubscriptionNextResults(lastResults ResponseWithContinuationLab) (result ResponseWithContinuationLab, err error) { + req, err := lastResults.responseWithContinuationLabPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client LabsClient) ListBySubscriptionComplete(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabIterator, err error) { + result.page, err = client.ListBySubscription(ctx, expand, filter, top, orderby) + return +} + +// ListVhds list disk images available for custom image creation. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +func (client LabsClient) ListVhds(ctx context.Context, resourceGroupName string, name string) (result ResponseWithContinuationLabVhdPage, err error) { + result.fn = client.listVhdsNextResults + req, err := client.ListVhdsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListVhds", nil, "Failure preparing request") + return + } + + resp, err := client.ListVhdsSender(req) + if err != nil { + result.rwclv.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListVhds", resp, "Failure sending request") + return + } + + result.rwclv, err = client.ListVhdsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListVhds", resp, "Failure responding to request") + } + + return +} + +// ListVhdsPreparer prepares the ListVhds request. +func (client LabsClient) ListVhdsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVhdsSender sends the ListVhds request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ListVhdsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListVhdsResponder handles the response to the ListVhds request. The method always +// closes the http.Response Body. +func (client LabsClient) ListVhdsResponder(resp *http.Response) (result ResponseWithContinuationLabVhd, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVhdsNextResults retrieves the next set of results, if any. +func (client LabsClient) listVhdsNextResults(lastResults ResponseWithContinuationLabVhd) (result ResponseWithContinuationLabVhd, err error) { + req, err := lastResults.responseWithContinuationLabVhdPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listVhdsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVhdsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listVhdsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVhdsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "listVhdsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVhdsComplete enumerates all values, automatically crossing page boundaries as required. +func (client LabsClient) ListVhdsComplete(ctx context.Context, resourceGroupName string, name string) (result ResponseWithContinuationLabVhdIterator, err error) { + result.page, err = client.ListVhds(ctx, resourceGroupName, name) + return +} + +// Update modify properties of labs. +// Parameters: +// resourceGroupName - the name of the resource group. +// name - the name of the lab. +// lab - a lab. +func (client LabsClient) Update(ctx context.Context, resourceGroupName string, name string, lab LabFragment) (result Lab, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, lab) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LabsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, lab LabFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithJSON(lab), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 LabsClient) UpdateResponder(resp *http.Response) (result Lab, 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/devtestlabs/mgmt/2016-05-15/dtl/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/models.go new file mode 100644 index 000000000000..acd828195a30 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/models.go @@ -0,0 +1,7728 @@ +package dtl + +// 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/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// CostThresholdStatus enumerates the values for cost threshold status. +type CostThresholdStatus string + +const ( + // Disabled ... + Disabled CostThresholdStatus = "Disabled" + // Enabled ... + Enabled CostThresholdStatus = "Enabled" +) + +// PossibleCostThresholdStatusValues returns an array of possible values for the CostThresholdStatus const type. +func PossibleCostThresholdStatusValues() []CostThresholdStatus { + return []CostThresholdStatus{Disabled, Enabled} +} + +// CostType enumerates the values for cost type. +type CostType string + +const ( + // Projected ... + Projected CostType = "Projected" + // Reported ... + Reported CostType = "Reported" + // Unavailable ... + Unavailable CostType = "Unavailable" +) + +// PossibleCostTypeValues returns an array of possible values for the CostType const type. +func PossibleCostTypeValues() []CostType { + return []CostType{Projected, Reported, Unavailable} +} + +// CustomImageOsType enumerates the values for custom image os type. +type CustomImageOsType string + +const ( + // Linux ... + Linux CustomImageOsType = "Linux" + // None ... + None CustomImageOsType = "None" + // Windows ... + Windows CustomImageOsType = "Windows" +) + +// PossibleCustomImageOsTypeValues returns an array of possible values for the CustomImageOsType const type. +func PossibleCustomImageOsTypeValues() []CustomImageOsType { + return []CustomImageOsType{Linux, None, Windows} +} + +// EnableStatus enumerates the values for enable status. +type EnableStatus string + +const ( + // EnableStatusDisabled ... + EnableStatusDisabled EnableStatus = "Disabled" + // EnableStatusEnabled ... + EnableStatusEnabled EnableStatus = "Enabled" +) + +// PossibleEnableStatusValues returns an array of possible values for the EnableStatus const type. +func PossibleEnableStatusValues() []EnableStatus { + return []EnableStatus{EnableStatusDisabled, EnableStatusEnabled} +} + +// FileUploadOptions enumerates the values for file upload options. +type FileUploadOptions string + +const ( + // FileUploadOptionsNone ... + FileUploadOptionsNone FileUploadOptions = "None" + // FileUploadOptionsUploadFilesAndGenerateSasTokens ... + FileUploadOptionsUploadFilesAndGenerateSasTokens FileUploadOptions = "UploadFilesAndGenerateSasTokens" +) + +// PossibleFileUploadOptionsValues returns an array of possible values for the FileUploadOptions const type. +func PossibleFileUploadOptionsValues() []FileUploadOptions { + return []FileUploadOptions{FileUploadOptionsNone, FileUploadOptionsUploadFilesAndGenerateSasTokens} +} + +// HostCachingOptions enumerates the values for host caching options. +type HostCachingOptions string + +const ( + // HostCachingOptionsNone ... + HostCachingOptionsNone HostCachingOptions = "None" + // HostCachingOptionsReadOnly ... + HostCachingOptionsReadOnly HostCachingOptions = "ReadOnly" + // HostCachingOptionsReadWrite ... + HostCachingOptionsReadWrite HostCachingOptions = "ReadWrite" +) + +// PossibleHostCachingOptionsValues returns an array of possible values for the HostCachingOptions const type. +func PossibleHostCachingOptionsValues() []HostCachingOptions { + return []HostCachingOptions{HostCachingOptionsNone, HostCachingOptionsReadOnly, HostCachingOptionsReadWrite} +} + +// HTTPStatusCode enumerates the values for http status code. +type HTTPStatusCode string + +const ( + // Accepted ... + Accepted HTTPStatusCode = "Accepted" + // BadGateway ... + BadGateway HTTPStatusCode = "BadGateway" + // BadRequest ... + BadRequest HTTPStatusCode = "BadRequest" + // Conflict ... + Conflict HTTPStatusCode = "Conflict" + // Continue ... + Continue HTTPStatusCode = "Continue" + // Created ... + Created HTTPStatusCode = "Created" + // ExpectationFailed ... + ExpectationFailed HTTPStatusCode = "ExpectationFailed" + // Forbidden ... + Forbidden HTTPStatusCode = "Forbidden" + // GatewayTimeout ... + GatewayTimeout HTTPStatusCode = "GatewayTimeout" + // Gone ... + Gone HTTPStatusCode = "Gone" + // HTTPVersionNotSupported ... + HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" + // InternalServerError ... + InternalServerError HTTPStatusCode = "InternalServerError" + // LengthRequired ... + LengthRequired HTTPStatusCode = "LengthRequired" + // MethodNotAllowed ... + MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" + // MovedPermanently ... + MovedPermanently HTTPStatusCode = "MovedPermanently" + // MultipleChoices ... + MultipleChoices HTTPStatusCode = "MultipleChoices" + // NoContent ... + NoContent HTTPStatusCode = "NoContent" + // NonAuthoritativeInformation ... + NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" + // NotAcceptable ... + NotAcceptable HTTPStatusCode = "NotAcceptable" + // NotFound ... + NotFound HTTPStatusCode = "NotFound" + // NotImplemented ... + NotImplemented HTTPStatusCode = "NotImplemented" + // NotModified ... + NotModified HTTPStatusCode = "NotModified" + // OK ... + OK HTTPStatusCode = "OK" + // PartialContent ... + PartialContent HTTPStatusCode = "PartialContent" + // PaymentRequired ... + PaymentRequired HTTPStatusCode = "PaymentRequired" + // PreconditionFailed ... + PreconditionFailed HTTPStatusCode = "PreconditionFailed" + // ProxyAuthenticationRequired ... + ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" + // Redirect ... + Redirect HTTPStatusCode = "Redirect" + // RequestedRangeNotSatisfiable ... + RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" + // RequestEntityTooLarge ... + RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" + // RequestTimeout ... + RequestTimeout HTTPStatusCode = "RequestTimeout" + // RequestURITooLong ... + RequestURITooLong HTTPStatusCode = "RequestUriTooLong" + // ResetContent ... + ResetContent HTTPStatusCode = "ResetContent" + // SeeOther ... + SeeOther HTTPStatusCode = "SeeOther" + // ServiceUnavailable ... + ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" + // SwitchingProtocols ... + SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" + // TemporaryRedirect ... + TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" + // Unauthorized ... + Unauthorized HTTPStatusCode = "Unauthorized" + // UnsupportedMediaType ... + UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" + // Unused ... + Unused HTTPStatusCode = "Unused" + // UpgradeRequired ... + UpgradeRequired HTTPStatusCode = "UpgradeRequired" + // UseProxy ... + UseProxy HTTPStatusCode = "UseProxy" +) + +// PossibleHTTPStatusCodeValues returns an array of possible values for the HTTPStatusCode const type. +func PossibleHTTPStatusCodeValues() []HTTPStatusCode { + return []HTTPStatusCode{Accepted, BadGateway, BadRequest, Conflict, Continue, Created, ExpectationFailed, Forbidden, GatewayTimeout, Gone, HTTPVersionNotSupported, InternalServerError, LengthRequired, MethodNotAllowed, MovedPermanently, MultipleChoices, NoContent, NonAuthoritativeInformation, NotAcceptable, NotFound, NotImplemented, NotModified, OK, PartialContent, PaymentRequired, PreconditionFailed, ProxyAuthenticationRequired, Redirect, RequestedRangeNotSatisfiable, RequestEntityTooLarge, RequestTimeout, RequestURITooLong, ResetContent, SeeOther, ServiceUnavailable, SwitchingProtocols, TemporaryRedirect, Unauthorized, UnsupportedMediaType, Unused, UpgradeRequired, UseProxy} +} + +// LinuxOsState enumerates the values for linux os state. +type LinuxOsState string + +const ( + // DeprovisionApplied ... + DeprovisionApplied LinuxOsState = "DeprovisionApplied" + // DeprovisionRequested ... + DeprovisionRequested LinuxOsState = "DeprovisionRequested" + // NonDeprovisioned ... + NonDeprovisioned LinuxOsState = "NonDeprovisioned" +) + +// PossibleLinuxOsStateValues returns an array of possible values for the LinuxOsState const type. +func PossibleLinuxOsStateValues() []LinuxOsState { + return []LinuxOsState{DeprovisionApplied, DeprovisionRequested, NonDeprovisioned} +} + +// NotificationChannelEventType enumerates the values for notification channel event type. +type NotificationChannelEventType string + +const ( + // AutoShutdown ... + AutoShutdown NotificationChannelEventType = "AutoShutdown" + // Cost ... + Cost NotificationChannelEventType = "Cost" +) + +// PossibleNotificationChannelEventTypeValues returns an array of possible values for the NotificationChannelEventType const type. +func PossibleNotificationChannelEventTypeValues() []NotificationChannelEventType { + return []NotificationChannelEventType{AutoShutdown, Cost} +} + +// NotificationStatus enumerates the values for notification status. +type NotificationStatus string + +const ( + // NotificationStatusDisabled ... + NotificationStatusDisabled NotificationStatus = "Disabled" + // NotificationStatusEnabled ... + NotificationStatusEnabled NotificationStatus = "Enabled" +) + +// PossibleNotificationStatusValues returns an array of possible values for the NotificationStatus const type. +func PossibleNotificationStatusValues() []NotificationStatus { + return []NotificationStatus{NotificationStatusDisabled, NotificationStatusEnabled} +} + +// PolicyEvaluatorType enumerates the values for policy evaluator type. +type PolicyEvaluatorType string + +const ( + // AllowedValuesPolicy ... + AllowedValuesPolicy PolicyEvaluatorType = "AllowedValuesPolicy" + // MaxValuePolicy ... + MaxValuePolicy PolicyEvaluatorType = "MaxValuePolicy" +) + +// PossiblePolicyEvaluatorTypeValues returns an array of possible values for the PolicyEvaluatorType const type. +func PossiblePolicyEvaluatorTypeValues() []PolicyEvaluatorType { + return []PolicyEvaluatorType{AllowedValuesPolicy, MaxValuePolicy} +} + +// PolicyFactName enumerates the values for policy fact name. +type PolicyFactName string + +const ( + // PolicyFactNameGalleryImage ... + PolicyFactNameGalleryImage PolicyFactName = "GalleryImage" + // PolicyFactNameLabPremiumVMCount ... + PolicyFactNameLabPremiumVMCount PolicyFactName = "LabPremiumVmCount" + // PolicyFactNameLabTargetCost ... + PolicyFactNameLabTargetCost PolicyFactName = "LabTargetCost" + // PolicyFactNameLabVMCount ... + PolicyFactNameLabVMCount PolicyFactName = "LabVmCount" + // PolicyFactNameLabVMSize ... + PolicyFactNameLabVMSize PolicyFactName = "LabVmSize" + // PolicyFactNameUserOwnedLabPremiumVMCount ... + PolicyFactNameUserOwnedLabPremiumVMCount PolicyFactName = "UserOwnedLabPremiumVmCount" + // PolicyFactNameUserOwnedLabVMCount ... + PolicyFactNameUserOwnedLabVMCount PolicyFactName = "UserOwnedLabVmCount" + // PolicyFactNameUserOwnedLabVMCountInSubnet ... + PolicyFactNameUserOwnedLabVMCountInSubnet PolicyFactName = "UserOwnedLabVmCountInSubnet" +) + +// PossiblePolicyFactNameValues returns an array of possible values for the PolicyFactName const type. +func PossiblePolicyFactNameValues() []PolicyFactName { + return []PolicyFactName{PolicyFactNameGalleryImage, PolicyFactNameLabPremiumVMCount, PolicyFactNameLabTargetCost, PolicyFactNameLabVMCount, PolicyFactNameLabVMSize, PolicyFactNameUserOwnedLabPremiumVMCount, PolicyFactNameUserOwnedLabVMCount, PolicyFactNameUserOwnedLabVMCountInSubnet} +} + +// PolicyStatus enumerates the values for policy status. +type PolicyStatus string + +const ( + // PolicyStatusDisabled ... + PolicyStatusDisabled PolicyStatus = "Disabled" + // PolicyStatusEnabled ... + PolicyStatusEnabled PolicyStatus = "Enabled" +) + +// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. +func PossiblePolicyStatusValues() []PolicyStatus { + return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} +} + +// PremiumDataDisk enumerates the values for premium data disk. +type PremiumDataDisk string + +const ( + // PremiumDataDiskDisabled ... + PremiumDataDiskDisabled PremiumDataDisk = "Disabled" + // PremiumDataDiskEnabled ... + PremiumDataDiskEnabled PremiumDataDisk = "Enabled" +) + +// PossiblePremiumDataDiskValues returns an array of possible values for the PremiumDataDisk const type. +func PossiblePremiumDataDiskValues() []PremiumDataDisk { + return []PremiumDataDisk{PremiumDataDiskDisabled, PremiumDataDiskEnabled} +} + +// ReportingCycleType enumerates the values for reporting cycle type. +type ReportingCycleType string + +const ( + // CalendarMonth ... + CalendarMonth ReportingCycleType = "CalendarMonth" + // Custom ... + Custom ReportingCycleType = "Custom" +) + +// PossibleReportingCycleTypeValues returns an array of possible values for the ReportingCycleType const type. +func PossibleReportingCycleTypeValues() []ReportingCycleType { + return []ReportingCycleType{CalendarMonth, Custom} +} + +// SourceControlType enumerates the values for source control type. +type SourceControlType string + +const ( + // GitHub ... + GitHub SourceControlType = "GitHub" + // VsoGit ... + VsoGit SourceControlType = "VsoGit" +) + +// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. +func PossibleSourceControlTypeValues() []SourceControlType { + return []SourceControlType{GitHub, VsoGit} +} + +// StorageType enumerates the values for storage type. +type StorageType string + +const ( + // Premium ... + Premium StorageType = "Premium" + // Standard ... + Standard StorageType = "Standard" +) + +// PossibleStorageTypeValues returns an array of possible values for the StorageType const type. +func PossibleStorageTypeValues() []StorageType { + return []StorageType{Premium, Standard} +} + +// TargetCostStatus enumerates the values for target cost status. +type TargetCostStatus string + +const ( + // TargetCostStatusDisabled ... + TargetCostStatusDisabled TargetCostStatus = "Disabled" + // TargetCostStatusEnabled ... + TargetCostStatusEnabled TargetCostStatus = "Enabled" +) + +// PossibleTargetCostStatusValues returns an array of possible values for the TargetCostStatus const type. +func PossibleTargetCostStatusValues() []TargetCostStatus { + return []TargetCostStatus{TargetCostStatusDisabled, TargetCostStatusEnabled} +} + +// TransportProtocol enumerates the values for transport protocol. +type TransportProtocol string + +const ( + // TCP ... + TCP TransportProtocol = "Tcp" + // UDP ... + UDP TransportProtocol = "Udp" +) + +// PossibleTransportProtocolValues returns an array of possible values for the TransportProtocol const type. +func PossibleTransportProtocolValues() []TransportProtocol { + return []TransportProtocol{TCP, UDP} +} + +// UsagePermissionType enumerates the values for usage permission type. +type UsagePermissionType string + +const ( + // Allow ... + Allow UsagePermissionType = "Allow" + // Default ... + Default UsagePermissionType = "Default" + // Deny ... + Deny UsagePermissionType = "Deny" +) + +// PossibleUsagePermissionTypeValues returns an array of possible values for the UsagePermissionType const type. +func PossibleUsagePermissionTypeValues() []UsagePermissionType { + return []UsagePermissionType{Allow, Default, Deny} +} + +// VirtualMachineCreationSource enumerates the values for virtual machine creation source. +type VirtualMachineCreationSource string + +const ( + // FromCustomImage ... + FromCustomImage VirtualMachineCreationSource = "FromCustomImage" + // FromGalleryImage ... + FromGalleryImage VirtualMachineCreationSource = "FromGalleryImage" +) + +// PossibleVirtualMachineCreationSourceValues returns an array of possible values for the VirtualMachineCreationSource const type. +func PossibleVirtualMachineCreationSourceValues() []VirtualMachineCreationSource { + return []VirtualMachineCreationSource{FromCustomImage, FromGalleryImage} +} + +// WindowsOsState enumerates the values for windows os state. +type WindowsOsState string + +const ( + // NonSysprepped ... + NonSysprepped WindowsOsState = "NonSysprepped" + // SysprepApplied ... + SysprepApplied WindowsOsState = "SysprepApplied" + // SysprepRequested ... + SysprepRequested WindowsOsState = "SysprepRequested" +) + +// PossibleWindowsOsStateValues returns an array of possible values for the WindowsOsState const type. +func PossibleWindowsOsStateValues() []WindowsOsState { + return []WindowsOsState{NonSysprepped, SysprepApplied, SysprepRequested} +} + +// ApplicableSchedule schedules applicable to a virtual machine. The schedules may have been defined on a VM or on +// lab level. +type ApplicableSchedule struct { + autorest.Response `json:"-"` + // ApplicableScheduleProperties - The properties of the resource. + *ApplicableScheduleProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicableSchedule. +func (as ApplicableSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if as.ApplicableScheduleProperties != nil { + objectMap["properties"] = as.ApplicableScheduleProperties + } + if as.ID != nil { + objectMap["id"] = as.ID + } + if as.Name != nil { + objectMap["name"] = as.Name + } + if as.Type != nil { + objectMap["type"] = as.Type + } + if as.Location != nil { + objectMap["location"] = as.Location + } + if as.Tags != nil { + objectMap["tags"] = as.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicableSchedule struct. +func (as *ApplicableSchedule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicableScheduleProperties ApplicableScheduleProperties + err = json.Unmarshal(*v, &applicableScheduleProperties) + if err != nil { + return err + } + as.ApplicableScheduleProperties = &applicableScheduleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + as.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + as.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + as.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + as.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + as.Tags = tags + } + } + } + + return nil +} + +// ApplicableScheduleFragment schedules applicable to a virtual machine. The schedules may have been defined on a +// VM or on lab level. +type ApplicableScheduleFragment struct { + // ApplicableSchedulePropertiesFragment - The properties of the resource. + *ApplicableSchedulePropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicableScheduleFragment. +func (asf ApplicableScheduleFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asf.ApplicableSchedulePropertiesFragment != nil { + objectMap["properties"] = asf.ApplicableSchedulePropertiesFragment + } + if asf.ID != nil { + objectMap["id"] = asf.ID + } + if asf.Name != nil { + objectMap["name"] = asf.Name + } + if asf.Type != nil { + objectMap["type"] = asf.Type + } + if asf.Location != nil { + objectMap["location"] = asf.Location + } + if asf.Tags != nil { + objectMap["tags"] = asf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicableScheduleFragment struct. +func (asf *ApplicableScheduleFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicableSchedulePropertiesFragment ApplicableSchedulePropertiesFragment + err = json.Unmarshal(*v, &applicableSchedulePropertiesFragment) + if err != nil { + return err + } + asf.ApplicableSchedulePropertiesFragment = &applicableSchedulePropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asf.Tags = tags + } + } + } + + return nil +} + +// ApplicableScheduleProperties properties of a schedules applicable to a virtual machine. +type ApplicableScheduleProperties struct { + // LabVmsShutdown - The auto-shutdown schedule, if one has been set at the lab or lab resource level. + LabVmsShutdown *Schedule `json:"labVmsShutdown,omitempty"` + // LabVmsStartup - The auto-startup schedule, if one has been set at the lab or lab resource level. + LabVmsStartup *Schedule `json:"labVmsStartup,omitempty"` +} + +// ApplicableSchedulePropertiesFragment properties of a schedules applicable to a virtual machine. +type ApplicableSchedulePropertiesFragment struct { + // LabVmsShutdown - The auto-shutdown schedule, if one has been set at the lab or lab resource level. + LabVmsShutdown *ScheduleFragment `json:"labVmsShutdown,omitempty"` + // LabVmsStartup - The auto-startup schedule, if one has been set at the lab or lab resource level. + LabVmsStartup *ScheduleFragment `json:"labVmsStartup,omitempty"` +} + +// ApplyArtifactsRequest request body for applying artifacts to a virtual machine. +type ApplyArtifactsRequest struct { + // Artifacts - The list of artifacts to apply. + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` +} + +// ArmTemplate an Azure Resource Manager template. +type ArmTemplate struct { + autorest.Response `json:"-"` + // ArmTemplateProperties - The properties of the resource. + *ArmTemplateProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ArmTemplate. +func (at ArmTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if at.ArmTemplateProperties != nil { + objectMap["properties"] = at.ArmTemplateProperties + } + if at.ID != nil { + objectMap["id"] = at.ID + } + if at.Name != nil { + objectMap["name"] = at.Name + } + if at.Type != nil { + objectMap["type"] = at.Type + } + if at.Location != nil { + objectMap["location"] = at.Location + } + if at.Tags != nil { + objectMap["tags"] = at.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ArmTemplate struct. +func (at *ArmTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var armTemplateProperties ArmTemplateProperties + err = json.Unmarshal(*v, &armTemplateProperties) + if err != nil { + return err + } + at.ArmTemplateProperties = &armTemplateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + at.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + at.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + at.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + at.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + at.Tags = tags + } + } + } + + return nil +} + +// ArmTemplateInfo information about a generated ARM template. +type ArmTemplateInfo struct { + autorest.Response `json:"-"` + // Template - The template's contents. + Template interface{} `json:"template,omitempty"` + // Parameters - The parameters of the ARM template. + Parameters interface{} `json:"parameters,omitempty"` +} + +// ArmTemplateParameterProperties properties of an Azure Resource Manager template parameter. +type ArmTemplateParameterProperties struct { + // Name - The name of the template parameter. + Name *string `json:"name,omitempty"` + // Value - The value of the template parameter. + Value *string `json:"value,omitempty"` +} + +// ArmTemplateProperties properties of an Azure Resource Manager template. +type ArmTemplateProperties struct { + // DisplayName - The display name of the ARM template. + DisplayName *string `json:"displayName,omitempty"` + // Description - The description of the ARM template. + Description *string `json:"description,omitempty"` + // Publisher - The publisher of the ARM template. + Publisher *string `json:"publisher,omitempty"` + // Icon - The URI to the icon of the ARM template. + Icon *string `json:"icon,omitempty"` + // Contents - The contents of the ARM template. + Contents interface{} `json:"contents,omitempty"` + // CreatedDate - The creation date of the armTemplate. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ParametersValueFilesInfo - File name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. + ParametersValueFilesInfo *[]ParametersValueFileInfo `json:"parametersValueFilesInfo,omitempty"` +} + +// Artifact an artifact. +type Artifact struct { + autorest.Response `json:"-"` + // ArtifactProperties - The properties of the resource. + *ArtifactProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Artifact. +func (a Artifact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ArtifactProperties != nil { + objectMap["properties"] = a.ArtifactProperties + } + if a.ID != nil { + objectMap["id"] = a.ID + } + if a.Name != nil { + objectMap["name"] = a.Name + } + if a.Type != nil { + objectMap["type"] = a.Type + } + if a.Location != nil { + objectMap["location"] = a.Location + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Artifact struct. +func (a *Artifact) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var artifactProperties ArtifactProperties + err = json.Unmarshal(*v, &artifactProperties) + if err != nil { + return err + } + a.ArtifactProperties = &artifactProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + } + } + + return nil +} + +// ArtifactDeploymentStatusProperties properties of an artifact deployment. +type ArtifactDeploymentStatusProperties struct { + // DeploymentStatus - The deployment status of the artifact. + DeploymentStatus *string `json:"deploymentStatus,omitempty"` + // ArtifactsApplied - The total count of the artifacts that were successfully applied. + ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` + // TotalArtifacts - The total count of the artifacts that were tentatively applied. + TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` +} + +// ArtifactDeploymentStatusPropertiesFragment properties of an artifact deployment. +type ArtifactDeploymentStatusPropertiesFragment struct { + // DeploymentStatus - The deployment status of the artifact. + DeploymentStatus *string `json:"deploymentStatus,omitempty"` + // ArtifactsApplied - The total count of the artifacts that were successfully applied. + ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` + // TotalArtifacts - The total count of the artifacts that were tentatively applied. + TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` +} + +// ArtifactInstallProperties properties of an artifact. +type ArtifactInstallProperties struct { + // ArtifactID - The artifact's identifier. + ArtifactID *string `json:"artifactId,omitempty"` + // Parameters - The parameters of the artifact. + Parameters *[]ArtifactParameterProperties `json:"parameters,omitempty"` + // Status - The status of the artifact. + Status *string `json:"status,omitempty"` + // DeploymentStatusMessage - The status message from the deployment. + DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` + // VMExtensionStatusMessage - The status message from the virtual machine extension. + VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` + // InstallTime - The time that the artifact starts to install on the virtual machine. + InstallTime *date.Time `json:"installTime,omitempty"` +} + +// ArtifactInstallPropertiesFragment properties of an artifact. +type ArtifactInstallPropertiesFragment struct { + // ArtifactID - The artifact's identifier. + ArtifactID *string `json:"artifactId,omitempty"` + // Parameters - The parameters of the artifact. + Parameters *[]ArtifactParameterPropertiesFragment `json:"parameters,omitempty"` + // Status - The status of the artifact. + Status *string `json:"status,omitempty"` + // DeploymentStatusMessage - The status message from the deployment. + DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` + // VMExtensionStatusMessage - The status message from the virtual machine extension. + VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` + // InstallTime - The time that the artifact starts to install on the virtual machine. + InstallTime *date.Time `json:"installTime,omitempty"` +} + +// ArtifactParameterProperties properties of an artifact parameter. +type ArtifactParameterProperties struct { + // Name - The name of the artifact parameter. + Name *string `json:"name,omitempty"` + // Value - The value of the artifact parameter. + Value *string `json:"value,omitempty"` +} + +// ArtifactParameterPropertiesFragment properties of an artifact parameter. +type ArtifactParameterPropertiesFragment struct { + // Name - The name of the artifact parameter. + Name *string `json:"name,omitempty"` + // Value - The value of the artifact parameter. + Value *string `json:"value,omitempty"` +} + +// ArtifactProperties properties of an artifact. +type ArtifactProperties struct { + // Title - The artifact's title. + Title *string `json:"title,omitempty"` + // Description - The artifact's description. + Description *string `json:"description,omitempty"` + // Publisher - The artifact's publisher. + Publisher *string `json:"publisher,omitempty"` + // FilePath - The file path to the artifact. + FilePath *string `json:"filePath,omitempty"` + // Icon - The URI to the artifact icon. + Icon *string `json:"icon,omitempty"` + // TargetOsType - The artifact's target OS. + TargetOsType *string `json:"targetOsType,omitempty"` + // Parameters - The artifact's parameters. + Parameters interface{} `json:"parameters,omitempty"` + // CreatedDate - The artifact's creation date. + CreatedDate *date.Time `json:"createdDate,omitempty"` +} + +// ArtifactSource properties of an artifact source. +type ArtifactSource struct { + autorest.Response `json:"-"` + // ArtifactSourceProperties - The properties of the resource. + *ArtifactSourceProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ArtifactSource. +func (as ArtifactSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if as.ArtifactSourceProperties != nil { + objectMap["properties"] = as.ArtifactSourceProperties + } + if as.ID != nil { + objectMap["id"] = as.ID + } + if as.Name != nil { + objectMap["name"] = as.Name + } + if as.Type != nil { + objectMap["type"] = as.Type + } + if as.Location != nil { + objectMap["location"] = as.Location + } + if as.Tags != nil { + objectMap["tags"] = as.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ArtifactSource struct. +func (as *ArtifactSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var artifactSourceProperties ArtifactSourceProperties + err = json.Unmarshal(*v, &artifactSourceProperties) + if err != nil { + return err + } + as.ArtifactSourceProperties = &artifactSourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + as.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + as.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + as.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + as.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + as.Tags = tags + } + } + } + + return nil +} + +// ArtifactSourceFragment properties of an artifact source. +type ArtifactSourceFragment struct { + // ArtifactSourcePropertiesFragment - The properties of the resource. + *ArtifactSourcePropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ArtifactSourceFragment. +func (asf ArtifactSourceFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asf.ArtifactSourcePropertiesFragment != nil { + objectMap["properties"] = asf.ArtifactSourcePropertiesFragment + } + if asf.ID != nil { + objectMap["id"] = asf.ID + } + if asf.Name != nil { + objectMap["name"] = asf.Name + } + if asf.Type != nil { + objectMap["type"] = asf.Type + } + if asf.Location != nil { + objectMap["location"] = asf.Location + } + if asf.Tags != nil { + objectMap["tags"] = asf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ArtifactSourceFragment struct. +func (asf *ArtifactSourceFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var artifactSourcePropertiesFragment ArtifactSourcePropertiesFragment + err = json.Unmarshal(*v, &artifactSourcePropertiesFragment) + if err != nil { + return err + } + asf.ArtifactSourcePropertiesFragment = &artifactSourcePropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asf.Tags = tags + } + } + } + + return nil +} + +// ArtifactSourceProperties properties of an artifact source. +type ArtifactSourceProperties struct { + // DisplayName - The artifact source's display name. + DisplayName *string `json:"displayName,omitempty"` + // URI - The artifact source's URI. + URI *string `json:"uri,omitempty"` + // SourceType - The artifact source's type. Possible values include: 'VsoGit', 'GitHub' + SourceType SourceControlType `json:"sourceType,omitempty"` + // FolderPath - The folder containing artifacts. + FolderPath *string `json:"folderPath,omitempty"` + // ArmTemplateFolderPath - The folder containing Azure Resource Manager templates. + ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` + // BranchRef - The artifact source's branch reference. + BranchRef *string `json:"branchRef,omitempty"` + // SecurityToken - The security token to authenticate to the artifact source. + SecurityToken *string `json:"securityToken,omitempty"` + // Status - Indicates if the artifact source is enabled (values: Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' + Status EnableStatus `json:"status,omitempty"` + // CreatedDate - The artifact source's creation date. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// ArtifactSourcePropertiesFragment properties of an artifact source. +type ArtifactSourcePropertiesFragment struct { + // DisplayName - The artifact source's display name. + DisplayName *string `json:"displayName,omitempty"` + // URI - The artifact source's URI. + URI *string `json:"uri,omitempty"` + // SourceType - The artifact source's type. Possible values include: 'VsoGit', 'GitHub' + SourceType SourceControlType `json:"sourceType,omitempty"` + // FolderPath - The folder containing artifacts. + FolderPath *string `json:"folderPath,omitempty"` + // ArmTemplateFolderPath - The folder containing Azure Resource Manager templates. + ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` + // BranchRef - The artifact source's branch reference. + BranchRef *string `json:"branchRef,omitempty"` + // SecurityToken - The security token to authenticate to the artifact source. + SecurityToken *string `json:"securityToken,omitempty"` + // Status - Indicates if the artifact source is enabled (values: Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' + Status EnableStatus `json:"status,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// AttachDiskProperties properties of the disk to attach. +type AttachDiskProperties struct { + // LeasedByLabVMID - The resource ID of the Lab virtual machine to which the disk is attached. + LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` +} + +// AttachNewDataDiskOptions properties to attach new disk to the Virtual Machine. +type AttachNewDataDiskOptions struct { + // DiskSizeGiB - Size of the disk to be attached in GibiBytes. + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` + // DiskName - The name of the disk to be attached. + DiskName *string `json:"diskName,omitempty"` + // DiskType - The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + DiskType StorageType `json:"diskType,omitempty"` +} + +// BulkCreationParameters parameters for creating multiple virtual machines as a single action. +type BulkCreationParameters struct { + // InstanceCount - The number of virtual machine instances to create. + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// CloudError error from a REST request. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody body of an error from a REST request. +type CloudErrorBody struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + // Details - Inner errors. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ComputeDataDisk a data disks attached to a virtual machine. +type ComputeDataDisk struct { + // Name - Gets data disk name. + Name *string `json:"name,omitempty"` + // DiskURI - When backed by a blob, the URI of underlying blob. + DiskURI *string `json:"diskUri,omitempty"` + // ManagedDiskID - When backed by managed disk, this is the ID of the compute disk resource. + ManagedDiskID *string `json:"managedDiskId,omitempty"` + // DiskSizeGiB - Gets data disk size in GiB. + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` +} + +// ComputeDataDiskFragment a data disks attached to a virtual machine. +type ComputeDataDiskFragment struct { + // Name - Gets data disk name. + Name *string `json:"name,omitempty"` + // DiskURI - When backed by a blob, the URI of underlying blob. + DiskURI *string `json:"diskUri,omitempty"` + // ManagedDiskID - When backed by managed disk, this is the ID of the compute disk resource. + ManagedDiskID *string `json:"managedDiskId,omitempty"` + // DiskSizeGiB - Gets data disk size in GiB. + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` +} + +// ComputeVMInstanceViewStatus status information about a virtual machine. +type ComputeVMInstanceViewStatus struct { + // Code - Gets the status Code. + Code *string `json:"code,omitempty"` + // DisplayStatus - Gets the short localizable label for the status. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Message - Gets the message associated with the status. + Message *string `json:"message,omitempty"` +} + +// ComputeVMInstanceViewStatusFragment status information about a virtual machine. +type ComputeVMInstanceViewStatusFragment struct { + // Code - Gets the status Code. + Code *string `json:"code,omitempty"` + // DisplayStatus - Gets the short localizable label for the status. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Message - Gets the message associated with the status. + Message *string `json:"message,omitempty"` +} + +// ComputeVMProperties properties of a virtual machine returned by the Microsoft.Compute API. +type ComputeVMProperties struct { + // Statuses - Gets the statuses of the virtual machine. + Statuses *[]ComputeVMInstanceViewStatus `json:"statuses,omitempty"` + // OsType - Gets the OS type of the virtual machine. + OsType *string `json:"osType,omitempty"` + // VMSize - Gets the size of the virtual machine. + VMSize *string `json:"vmSize,omitempty"` + // NetworkInterfaceID - Gets the network interface ID of the virtual machine. + NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` + // OsDiskID - Gets OS disk blob uri for the virtual machine. + OsDiskID *string `json:"osDiskId,omitempty"` + // DataDiskIds - Gets data disks blob uri for the virtual machine. + DataDiskIds *[]string `json:"dataDiskIds,omitempty"` + // DataDisks - Gets all data disks attached to the virtual machine. + DataDisks *[]ComputeDataDisk `json:"dataDisks,omitempty"` +} + +// ComputeVMPropertiesFragment properties of a virtual machine returned by the Microsoft.Compute API. +type ComputeVMPropertiesFragment struct { + // Statuses - Gets the statuses of the virtual machine. + Statuses *[]ComputeVMInstanceViewStatusFragment `json:"statuses,omitempty"` + // OsType - Gets the OS type of the virtual machine. + OsType *string `json:"osType,omitempty"` + // VMSize - Gets the size of the virtual machine. + VMSize *string `json:"vmSize,omitempty"` + // NetworkInterfaceID - Gets the network interface ID of the virtual machine. + NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` + // OsDiskID - Gets OS disk blob uri for the virtual machine. + OsDiskID *string `json:"osDiskId,omitempty"` + // DataDiskIds - Gets data disks blob uri for the virtual machine. + DataDiskIds *[]string `json:"dataDiskIds,omitempty"` + // DataDisks - Gets all data disks attached to the virtual machine. + DataDisks *[]ComputeDataDiskFragment `json:"dataDisks,omitempty"` +} + +// CostThresholdProperties properties of a cost threshold item. +type CostThresholdProperties struct { + // ThresholdID - The ID of the cost threshold item. + ThresholdID *string `json:"thresholdId,omitempty"` + // PercentageThreshold - The value of the percentage cost threshold. + PercentageThreshold *PercentageCostThresholdProperties `json:"percentageThreshold,omitempty"` + // DisplayOnChart - Indicates whether this threshold will be displayed on cost charts. Possible values include: 'Enabled', 'Disabled' + DisplayOnChart CostThresholdStatus `json:"displayOnChart,omitempty"` + // SendNotificationWhenExceeded - Indicates whether notifications will be sent when this threshold is exceeded. Possible values include: 'Enabled', 'Disabled' + SendNotificationWhenExceeded CostThresholdStatus `json:"sendNotificationWhenExceeded,omitempty"` + // NotificationSent - Indicates the datetime when notifications were last sent for this threshold. + NotificationSent *string `json:"notificationSent,omitempty"` +} + +// CustomImage a custom image. +type CustomImage struct { + autorest.Response `json:"-"` + // CustomImageProperties - The properties of the resource. + *CustomImageProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CustomImage. +func (ci CustomImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.CustomImageProperties != nil { + objectMap["properties"] = ci.CustomImageProperties + } + if ci.ID != nil { + objectMap["id"] = ci.ID + } + if ci.Name != nil { + objectMap["name"] = ci.Name + } + if ci.Type != nil { + objectMap["type"] = ci.Type + } + if ci.Location != nil { + objectMap["location"] = ci.Location + } + if ci.Tags != nil { + objectMap["tags"] = ci.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomImage struct. +func (ci *CustomImage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var customImageProperties CustomImageProperties + err = json.Unmarshal(*v, &customImageProperties) + if err != nil { + return err + } + ci.CustomImageProperties = &customImageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ci.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ci.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ci.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ci.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ci.Tags = tags + } + } + } + + return nil +} + +// CustomImageProperties properties of a custom image. +type CustomImageProperties struct { + // VM - The virtual machine from which the image is to be created. + VM *CustomImagePropertiesFromVM `json:"vm,omitempty"` + // Vhd - The VHD from which the image is to be created. + Vhd *CustomImagePropertiesCustom `json:"vhd,omitempty"` + // Description - The description of the custom image. + Description *string `json:"description,omitempty"` + // Author - The author of the custom image. + Author *string `json:"author,omitempty"` + // CreationDate - The creation date of the custom image. + CreationDate *date.Time `json:"creationDate,omitempty"` + // ManagedImageID - The Managed Image Id backing the custom image. + ManagedImageID *string `json:"managedImageId,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// CustomImagePropertiesCustom properties for creating a custom image from a VHD. +type CustomImagePropertiesCustom struct { + // ImageName - The image name. + ImageName *string `json:"imageName,omitempty"` + // SysPrep - Indicates whether sysprep has been run on the VHD. + SysPrep *bool `json:"sysPrep,omitempty"` + // OsType - The OS type of the custom image (i.e. Windows, Linux). Possible values include: 'Windows', 'Linux', 'None' + OsType CustomImageOsType `json:"osType,omitempty"` +} + +// CustomImagePropertiesFromVM properties for creating a custom image from a virtual machine. +type CustomImagePropertiesFromVM struct { + // SourceVMID - The source vm identifier. + SourceVMID *string `json:"sourceVmId,omitempty"` + // WindowsOsInfo - The Windows OS information of the VM. + WindowsOsInfo *WindowsOsInfo `json:"windowsOsInfo,omitempty"` + // LinuxOsInfo - The Linux OS information of the VM. + LinuxOsInfo *LinuxOsInfo `json:"linuxOsInfo,omitempty"` +} + +// CustomImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomImagesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *CustomImagesCreateOrUpdateFuture) Result(client CustomImagesClient) (ci CustomImage, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.CustomImagesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ci.Response.Response, err = future.GetResult(sender); err == nil && ci.Response.Response.StatusCode != http.StatusNoContent { + ci, err = client.CreateOrUpdateResponder(ci.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesCreateOrUpdateFuture", "Result", ci.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type CustomImagesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *CustomImagesDeleteFuture) Result(client CustomImagesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.CustomImagesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.CustomImagesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DataDiskProperties request body for adding a new or existing data disk to a virtual machine. +type DataDiskProperties struct { + // AttachNewDataDiskOptions - Specifies options to attach a new disk to the virtual machine. + AttachNewDataDiskOptions *AttachNewDataDiskOptions `json:"attachNewDataDiskOptions,omitempty"` + // ExistingLabDiskID - Specifies the existing lab disk id to attach to virtual machine. + ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` + // HostCaching - Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). Possible values include: 'HostCachingOptionsNone', 'HostCachingOptionsReadOnly', 'HostCachingOptionsReadWrite' + HostCaching HostCachingOptions `json:"hostCaching,omitempty"` +} + +// DayDetails properties of a daily schedule. +type DayDetails struct { + // Time - The time of day the schedule will occur. + Time *string `json:"time,omitempty"` +} + +// DayDetailsFragment properties of a daily schedule. +type DayDetailsFragment struct { + // Time - The time of day the schedule will occur. + Time *string `json:"time,omitempty"` +} + +// DetachDataDiskProperties request body for detaching data disk from a virtual machine. +type DetachDataDiskProperties struct { + // ExistingLabDiskID - Specifies the disk resource ID to detach from virtual machine. + ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` +} + +// DetachDiskProperties properties of the disk to detach. +type DetachDiskProperties struct { + // LeasedByLabVMID - The resource ID of the Lab VM to which the disk is attached. + LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` +} + +// Disk a Disk. +type Disk struct { + autorest.Response `json:"-"` + // DiskProperties - The properties of the resource. + *DiskProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Disk. +func (d Disk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DiskProperties != nil { + objectMap["properties"] = d.DiskProperties + } + if d.ID != nil { + objectMap["id"] = d.ID + } + if d.Name != nil { + objectMap["name"] = d.Name + } + if d.Type != nil { + objectMap["type"] = d.Type + } + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Disk struct. +func (d *Disk) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diskProperties DiskProperties + err = json.Unmarshal(*v, &diskProperties) + if err != nil { + return err + } + d.DiskProperties = &diskProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + } + } + + return nil +} + +// DiskProperties properties of a disk. +type DiskProperties struct { + // DiskType - The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + DiskType StorageType `json:"diskType,omitempty"` + // DiskSizeGiB - The size of the disk in GibiBytes. + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` + // LeasedByLabVMID - The resource ID of the VM to which this disk is leased. + LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` + // DiskBlobName - When backed by a blob, the name of the VHD blob without extension. + DiskBlobName *string `json:"diskBlobName,omitempty"` + // DiskURI - When backed by a blob, the URI of underlying blob. + DiskURI *string `json:"diskUri,omitempty"` + // CreatedDate - The creation date of the disk. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // HostCaching - The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + HostCaching *string `json:"hostCaching,omitempty"` + // ManagedDiskID - When backed by managed disk, this is the ID of the compute disk resource. + ManagedDiskID *string `json:"managedDiskId,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// DisksAttachFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DisksAttachFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksAttachFuture) Result(client DisksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksAttachFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.DisksAttachFuture") + return + } + ar.Response = future.Response() + return +} + +// DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DisksCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksCreateOrUpdateFuture) Result(client DisksClient) (d Disk, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.DisksCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DisksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DisksDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksDeleteFuture) Result(client DisksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.DisksDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DisksDetachFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DisksDetachFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisksDetachFuture) Result(client DisksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.DisksDetachFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.DisksDetachFuture") + return + } + ar.Response = future.Response() + return +} + +// Environment an environment, which is essentially an ARM template deployment. +type Environment struct { + autorest.Response `json:"-"` + // EnvironmentProperties - The properties of the resource. + *EnvironmentProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Environment. +func (e Environment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.EnvironmentProperties != nil { + objectMap["properties"] = e.EnvironmentProperties + } + if e.ID != nil { + objectMap["id"] = e.ID + } + if e.Name != nil { + objectMap["name"] = e.Name + } + if e.Type != nil { + objectMap["type"] = e.Type + } + if e.Location != nil { + objectMap["location"] = e.Location + } + if e.Tags != nil { + objectMap["tags"] = e.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Environment struct. +func (e *Environment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var environmentProperties EnvironmentProperties + err = json.Unmarshal(*v, &environmentProperties) + if err != nil { + return err + } + e.EnvironmentProperties = &environmentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + e.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + e.Tags = tags + } + } + } + + return nil +} + +// EnvironmentDeploymentProperties properties of an environment deployment. +type EnvironmentDeploymentProperties struct { + // ArmTemplateID - The Azure Resource Manager template's identifier. + ArmTemplateID *string `json:"armTemplateId,omitempty"` + // Parameters - The parameters of the Azure Resource Manager template. + Parameters *[]ArmTemplateParameterProperties `json:"parameters,omitempty"` +} + +// EnvironmentProperties properties of an environment. +type EnvironmentProperties struct { + // DeploymentProperties - The deployment properties of the environment. + DeploymentProperties *EnvironmentDeploymentProperties `json:"deploymentProperties,omitempty"` + // ArmTemplateDisplayName - The display name of the Azure Resource Manager template that produced the environment. + ArmTemplateDisplayName *string `json:"armTemplateDisplayName,omitempty"` + // ResourceGroupID - The identifier of the resource group containing the environment's resources. + ResourceGroupID *string `json:"resourceGroupId,omitempty"` + // CreatedByUser - The creator of the environment. + CreatedByUser *string `json:"createdByUser,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// EnvironmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EnvironmentsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentsCreateOrUpdateFuture) Result(client EnvironmentsClient) (e Environment, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.EnvironmentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateOrUpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsCreateOrUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EnvironmentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type EnvironmentsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentsDeleteFuture) Result(client EnvironmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.EnvironmentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.EnvironmentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EvaluatePoliciesProperties properties for evaluating a policy set. +type EvaluatePoliciesProperties struct { + // FactName - The fact name. + FactName *string `json:"factName,omitempty"` + // FactData - The fact data. + FactData *string `json:"factData,omitempty"` + // ValueOffset - The value offset. + ValueOffset *string `json:"valueOffset,omitempty"` +} + +// EvaluatePoliciesRequest request body for evaluating a policy set. +type EvaluatePoliciesRequest struct { + // Policies - Policies to evaluate. + Policies *[]EvaluatePoliciesProperties `json:"policies,omitempty"` +} + +// EvaluatePoliciesResponse response body for evaluating a policy set. +type EvaluatePoliciesResponse struct { + autorest.Response `json:"-"` + // Results - Results of evaluating a policy set. + Results *[]PolicySetResult `json:"results,omitempty"` +} + +// Event an event to be notified for. +type Event struct { + // EventName - The event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost' + EventName NotificationChannelEventType `json:"eventName,omitempty"` +} + +// EventFragment an event to be notified for. +type EventFragment struct { + // EventName - The event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost' + EventName NotificationChannelEventType `json:"eventName,omitempty"` +} + +// ExportResourceUsageParameters the parameters of the export operation. +type ExportResourceUsageParameters struct { + // BlobStorageAbsoluteSasURI - The blob storage absolute sas uri with write permission to the container which the usage data needs to be uploaded to. + BlobStorageAbsoluteSasURI *string `json:"blobStorageAbsoluteSasUri,omitempty"` + // UsageStartDate - The start time of the usage. If not provided, usage will be reported since the beginning of data collection. + UsageStartDate *date.Time `json:"usageStartDate,omitempty"` +} + +// ExternalSubnet subnet information as returned by the Microsoft.Network API. +type ExternalSubnet struct { + // ID - Gets or sets the identifier. + ID *string `json:"id,omitempty"` + // Name - Gets or sets the name. + Name *string `json:"name,omitempty"` +} + +// ExternalSubnetFragment subnet information as returned by the Microsoft.Network API. +type ExternalSubnetFragment struct { + // ID - Gets or sets the identifier. + ID *string `json:"id,omitempty"` + // Name - Gets or sets the name. + Name *string `json:"name,omitempty"` +} + +// Formula a formula for creating a VM, specifying an image base and other parameters +type Formula struct { + autorest.Response `json:"-"` + // FormulaProperties - The properties of the resource. + *FormulaProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Formula. +func (f Formula) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if f.FormulaProperties != nil { + objectMap["properties"] = f.FormulaProperties + } + if f.ID != nil { + objectMap["id"] = f.ID + } + if f.Name != nil { + objectMap["name"] = f.Name + } + if f.Type != nil { + objectMap["type"] = f.Type + } + if f.Location != nil { + objectMap["location"] = f.Location + } + if f.Tags != nil { + objectMap["tags"] = f.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Formula struct. +func (f *Formula) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var formulaProperties FormulaProperties + err = json.Unmarshal(*v, &formulaProperties) + if err != nil { + return err + } + f.FormulaProperties = &formulaProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + f.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + f.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + f.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + f.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + f.Tags = tags + } + } + } + + return nil +} + +// FormulaProperties properties of a formula. +type FormulaProperties struct { + // Description - The description of the formula. + Description *string `json:"description,omitempty"` + // Author - The author of the formula. + Author *string `json:"author,omitempty"` + // OsType - The OS type of the formula. + OsType *string `json:"osType,omitempty"` + // CreationDate - The creation date of the formula. + CreationDate *date.Time `json:"creationDate,omitempty"` + // FormulaContent - The content of the formula. + FormulaContent *LabVirtualMachineCreationParameter `json:"formulaContent,omitempty"` + // VM - Information about a VM from which a formula is to be created. + VM *FormulaPropertiesFromVM `json:"vm,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// FormulaPropertiesFromVM information about a VM from which a formula is to be created. +type FormulaPropertiesFromVM struct { + // LabVMID - The identifier of the VM from which a formula is to be created. + LabVMID *string `json:"labVmId,omitempty"` +} + +// FormulasCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FormulasCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *FormulasCreateOrUpdateFuture) Result(client FormulasClient) (f Formula, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.FormulasCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if f.Response.Response, err = future.GetResult(sender); err == nil && f.Response.Response.StatusCode != http.StatusNoContent { + f, err = client.CreateOrUpdateResponder(f.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.FormulasCreateOrUpdateFuture", "Result", f.Response.Response, "Failure responding to request") + } + } + return +} + +// GalleryImage a gallery image. +type GalleryImage struct { + // GalleryImageProperties - The properties of the resource. + *GalleryImageProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GalleryImage. +func (gi GalleryImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gi.GalleryImageProperties != nil { + objectMap["properties"] = gi.GalleryImageProperties + } + if gi.ID != nil { + objectMap["id"] = gi.ID + } + if gi.Name != nil { + objectMap["name"] = gi.Name + } + if gi.Type != nil { + objectMap["type"] = gi.Type + } + if gi.Location != nil { + objectMap["location"] = gi.Location + } + if gi.Tags != nil { + objectMap["tags"] = gi.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryImage struct. +func (gi *GalleryImage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var galleryImageProperties GalleryImageProperties + err = json.Unmarshal(*v, &galleryImageProperties) + if err != nil { + return err + } + gi.GalleryImageProperties = &galleryImageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gi.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + gi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + gi.Tags = tags + } + } + } + + return nil +} + +// GalleryImageProperties properties of a gallery image. +type GalleryImageProperties struct { + // Author - The author of the gallery image. + Author *string `json:"author,omitempty"` + // CreatedDate - The creation date of the gallery image. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // Description - The description of the gallery image. + Description *string `json:"description,omitempty"` + // ImageReference - The image reference of the gallery image. + ImageReference *GalleryImageReference `json:"imageReference,omitempty"` + // Icon - The icon of the gallery image. + Icon *string `json:"icon,omitempty"` + // Enabled - Indicates whether this gallery image is enabled. + Enabled *bool `json:"enabled,omitempty"` +} + +// GalleryImageReference the reference information for an Azure Marketplace image. +type GalleryImageReference struct { + // Offer - The offer of the gallery image. + Offer *string `json:"offer,omitempty"` + // Publisher - The publisher of the gallery image. + Publisher *string `json:"publisher,omitempty"` + // Sku - The SKU of the gallery image. + Sku *string `json:"sku,omitempty"` + // OsType - The OS type of the gallery image. + OsType *string `json:"osType,omitempty"` + // Version - The version of the gallery image. + Version *string `json:"version,omitempty"` +} + +// GalleryImageReferenceFragment the reference information for an Azure Marketplace image. +type GalleryImageReferenceFragment struct { + // Offer - The offer of the gallery image. + Offer *string `json:"offer,omitempty"` + // Publisher - The publisher of the gallery image. + Publisher *string `json:"publisher,omitempty"` + // Sku - The SKU of the gallery image. + Sku *string `json:"sku,omitempty"` + // OsType - The OS type of the gallery image. + OsType *string `json:"osType,omitempty"` + // Version - The version of the gallery image. + Version *string `json:"version,omitempty"` +} + +// GenerateArmTemplateRequest parameters for generating an ARM template for deploying artifacts. +type GenerateArmTemplateRequest struct { + // VirtualMachineName - The resource name of the virtual machine. + VirtualMachineName *string `json:"virtualMachineName,omitempty"` + // Parameters - The parameters of the ARM template. + Parameters *[]ParameterInfo `json:"parameters,omitempty"` + // Location - The location of the virtual machine. + Location *string `json:"location,omitempty"` + // FileUploadOptions - Options for uploading the files for the artifact. UploadFilesAndGenerateSasTokens is the default value. Possible values include: 'FileUploadOptionsUploadFilesAndGenerateSasTokens', 'FileUploadOptionsNone' + FileUploadOptions FileUploadOptions `json:"fileUploadOptions,omitempty"` +} + +// GenerateUploadURIParameter properties for generating an upload URI. +type GenerateUploadURIParameter struct { + // BlobName - The blob name of the upload URI. + BlobName *string `json:"blobName,omitempty"` +} + +// GenerateUploadURIResponse reponse body for generating an upload URI. +type GenerateUploadURIResponse struct { + autorest.Response `json:"-"` + // UploadURI - The upload URI for the VHD. + UploadURI *string `json:"uploadUri,omitempty"` +} + +// GlobalSchedulesExecuteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GlobalSchedulesExecuteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GlobalSchedulesExecuteFuture) Result(client GlobalSchedulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesExecuteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.GlobalSchedulesExecuteFuture") + return + } + ar.Response = future.Response() + return +} + +// GlobalSchedulesRetargetFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GlobalSchedulesRetargetFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GlobalSchedulesRetargetFuture) Result(client GlobalSchedulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesRetargetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.GlobalSchedulesRetargetFuture") + return + } + ar.Response = future.Response() + return +} + +// HourDetails properties of an hourly schedule. +type HourDetails struct { + // Minute - Minutes of the hour the schedule will run. + Minute *int32 `json:"minute,omitempty"` +} + +// HourDetailsFragment properties of an hourly schedule. +type HourDetailsFragment struct { + // Minute - Minutes of the hour the schedule will run. + Minute *int32 `json:"minute,omitempty"` +} + +// IdentityProperties properties of a managed identity +type IdentityProperties struct { + // Type - Managed identity. + Type *string `json:"type,omitempty"` + // PrincipalID - The principal id of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - The tenant identifier of resource. + TenantID *string `json:"tenantId,omitempty"` + // ClientSecretURL - The client secret URL of the identity. + ClientSecretURL *string `json:"clientSecretUrl,omitempty"` +} + +// InboundNatRule a rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load +// balancer. +type InboundNatRule struct { + // TransportProtocol - The transport protocol for the endpoint. Possible values include: 'TCP', 'UDP' + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + // FrontendPort - The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - The port to which the external traffic will be redirected. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// InboundNatRuleFragment a rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load +// balancer. +type InboundNatRuleFragment struct { + // TransportProtocol - The transport protocol for the endpoint. Possible values include: 'TCP', 'UDP' + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + // FrontendPort - The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - The port to which the external traffic will be redirected. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// Lab a lab. +type Lab struct { + autorest.Response `json:"-"` + // LabProperties - The properties of the resource. + *LabProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Lab. +func (l Lab) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if l.LabProperties != nil { + objectMap["properties"] = l.LabProperties + } + if l.ID != nil { + objectMap["id"] = l.ID + } + if l.Name != nil { + objectMap["name"] = l.Name + } + if l.Type != nil { + objectMap["type"] = l.Type + } + if l.Location != nil { + objectMap["location"] = l.Location + } + if l.Tags != nil { + objectMap["tags"] = l.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Lab struct. +func (l *Lab) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var labProperties LabProperties + err = json.Unmarshal(*v, &labProperties) + if err != nil { + return err + } + l.LabProperties = &labProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + l.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + l.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + l.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + l.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + l.Tags = tags + } + } + } + + return nil +} + +// LabCost a cost item. +type LabCost struct { + autorest.Response `json:"-"` + // LabCostProperties - The properties of the resource. + *LabCostProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabCost. +func (lc LabCost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lc.LabCostProperties != nil { + objectMap["properties"] = lc.LabCostProperties + } + if lc.ID != nil { + objectMap["id"] = lc.ID + } + if lc.Name != nil { + objectMap["name"] = lc.Name + } + if lc.Type != nil { + objectMap["type"] = lc.Type + } + if lc.Location != nil { + objectMap["location"] = lc.Location + } + if lc.Tags != nil { + objectMap["tags"] = lc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabCost struct. +func (lc *LabCost) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var labCostProperties LabCostProperties + err = json.Unmarshal(*v, &labCostProperties) + if err != nil { + return err + } + lc.LabCostProperties = &labCostProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lc.Tags = tags + } + } + } + + return nil +} + +// LabCostDetailsProperties the properties of a lab cost item. +type LabCostDetailsProperties struct { + // Date - The date of the cost item. + Date *date.Time `json:"date,omitempty"` + // Cost - The cost component of the cost item. + Cost *float64 `json:"cost,omitempty"` + // CostType - The type of the cost. Possible values include: 'Unavailable', 'Reported', 'Projected' + CostType CostType `json:"costType,omitempty"` +} + +// LabCostProperties properties of a cost item. +type LabCostProperties struct { + // TargetCost - The target cost properties + TargetCost *TargetCostProperties `json:"targetCost,omitempty"` + // LabCostSummary - The lab cost summary component of the cost data. + LabCostSummary *LabCostSummaryProperties `json:"labCostSummary,omitempty"` + // LabCostDetails - The lab cost details component of the cost data. + LabCostDetails *[]LabCostDetailsProperties `json:"labCostDetails,omitempty"` + // ResourceCosts - The resource cost component of the cost data. + ResourceCosts *[]LabResourceCostProperties `json:"resourceCosts,omitempty"` + // CurrencyCode - The currency code of the cost. + CurrencyCode *string `json:"currencyCode,omitempty"` + // StartDateTime - The start time of the cost data. + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // EndDateTime - The end time of the cost data. + EndDateTime *date.Time `json:"endDateTime,omitempty"` + // CreatedDate - The creation date of the cost. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabCostSummaryProperties the properties of the cost summary. +type LabCostSummaryProperties struct { + // EstimatedLabCost - The cost component of the cost item. + EstimatedLabCost *float64 `json:"estimatedLabCost,omitempty"` +} + +// LabFragment a lab. +type LabFragment struct { + // LabPropertiesFragment - The properties of the resource. + *LabPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabFragment. +func (lf LabFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lf.LabPropertiesFragment != nil { + objectMap["properties"] = lf.LabPropertiesFragment + } + if lf.ID != nil { + objectMap["id"] = lf.ID + } + if lf.Name != nil { + objectMap["name"] = lf.Name + } + if lf.Type != nil { + objectMap["type"] = lf.Type + } + if lf.Location != nil { + objectMap["location"] = lf.Location + } + if lf.Tags != nil { + objectMap["tags"] = lf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabFragment struct. +func (lf *LabFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var labPropertiesFragment LabPropertiesFragment + err = json.Unmarshal(*v, &labPropertiesFragment) + if err != nil { + return err + } + lf.LabPropertiesFragment = &labPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lf.Tags = tags + } + } + } + + return nil +} + +// LabProperties properties of a lab. +type LabProperties struct { + // DefaultStorageAccount - The lab's default storage account. + DefaultStorageAccount *string `json:"defaultStorageAccount,omitempty"` + // DefaultPremiumStorageAccount - The lab's default premium storage account. + DefaultPremiumStorageAccount *string `json:"defaultPremiumStorageAccount,omitempty"` + // ArtifactsStorageAccount - The lab's artifact storage account. + ArtifactsStorageAccount *string `json:"artifactsStorageAccount,omitempty"` + // PremiumDataDiskStorageAccount - The lab's premium data disk storage account. + PremiumDataDiskStorageAccount *string `json:"premiumDataDiskStorageAccount,omitempty"` + // VaultName - The lab's Key vault. + VaultName *string `json:"vaultName,omitempty"` + // LabStorageType - Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + LabStorageType StorageType `json:"labStorageType,omitempty"` + // CreatedDate - The creation date of the lab. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // PremiumDataDisks - The setting to enable usage of premium data disks. + // When its value is 'Enabled', creation of standard or premium data disks is allowed. + // When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'PremiumDataDiskDisabled', 'PremiumDataDiskEnabled' + PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabPropertiesFragment properties of a lab. +type LabPropertiesFragment struct { + // LabStorageType - Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + LabStorageType StorageType `json:"labStorageType,omitempty"` + // PremiumDataDisks - The setting to enable usage of premium data disks. + // When its value is 'Enabled', creation of standard or premium data disks is allowed. + // When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'PremiumDataDiskDisabled', 'PremiumDataDiskEnabled' + PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabResourceCostProperties the properties of a resource cost item. +type LabResourceCostProperties struct { + // Resourcename - The name of the resource. + Resourcename *string `json:"resourcename,omitempty"` + // ResourceUID - The unique identifier of the resource. + ResourceUID *string `json:"resourceUId,omitempty"` + // ResourceCost - The cost component of the resource cost item. + ResourceCost *float64 `json:"resourceCost,omitempty"` + // ResourceType - The logical resource type (ex. virtualmachine, storageaccount) + ResourceType *string `json:"resourceType,omitempty"` + // ResourceOwner - The owner of the resource (ex. janedoe@microsoft.com) + ResourceOwner *string `json:"resourceOwner,omitempty"` + // ResourcePricingTier - The category of the resource (ex. Premium_LRS, Standard_DS1) + ResourcePricingTier *string `json:"resourcePricingTier,omitempty"` + // ResourceStatus - The status of the resource (ex. Active) + ResourceStatus *string `json:"resourceStatus,omitempty"` + // ResourceID - The ID of the resource + ResourceID *string `json:"resourceId,omitempty"` + // ExternalResourceID - The ID of the external resource + ExternalResourceID *string `json:"externalResourceId,omitempty"` +} + +// LabsClaimAnyVMFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type LabsClaimAnyVMFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LabsClaimAnyVMFuture) Result(client LabsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsClaimAnyVMFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.LabsClaimAnyVMFuture") + return + } + ar.Response = future.Response() + return +} + +// LabsCreateEnvironmentFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type LabsCreateEnvironmentFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LabsCreateEnvironmentFuture) Result(client LabsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsCreateEnvironmentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.LabsCreateEnvironmentFuture") + return + } + ar.Response = future.Response() + return +} + +// LabsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type LabsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LabsCreateOrUpdateFuture) Result(client LabsClient) (l Lab, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.LabsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if l.Response.Response, err = future.GetResult(sender); err == nil && l.Response.Response.StatusCode != http.StatusNoContent { + l, err = client.CreateOrUpdateResponder(l.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsCreateOrUpdateFuture", "Result", l.Response.Response, "Failure responding to request") + } + } + return +} + +// LabsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type LabsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LabsDeleteFuture) Result(client LabsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.LabsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LabsExportResourceUsageFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type LabsExportResourceUsageFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LabsExportResourceUsageFuture) Result(client LabsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.LabsExportResourceUsageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.LabsExportResourceUsageFuture") + return + } + ar.Response = future.Response() + return +} + +// LabVhd properties of a VHD in the lab. +type LabVhd struct { + // ID - The URI to the VHD. + ID *string `json:"id,omitempty"` +} + +// LabVirtualMachine a virtual machine. +type LabVirtualMachine struct { + autorest.Response `json:"-"` + // LabVirtualMachineProperties - The properties of the resource. + *LabVirtualMachineProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabVirtualMachine. +func (lvm LabVirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lvm.LabVirtualMachineProperties != nil { + objectMap["properties"] = lvm.LabVirtualMachineProperties + } + if lvm.ID != nil { + objectMap["id"] = lvm.ID + } + if lvm.Name != nil { + objectMap["name"] = lvm.Name + } + if lvm.Type != nil { + objectMap["type"] = lvm.Type + } + if lvm.Location != nil { + objectMap["location"] = lvm.Location + } + if lvm.Tags != nil { + objectMap["tags"] = lvm.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabVirtualMachine struct. +func (lvm *LabVirtualMachine) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var labVirtualMachineProperties LabVirtualMachineProperties + err = json.Unmarshal(*v, &labVirtualMachineProperties) + if err != nil { + return err + } + lvm.LabVirtualMachineProperties = &labVirtualMachineProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lvm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lvm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lvm.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lvm.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lvm.Tags = tags + } + } + } + + return nil +} + +// LabVirtualMachineCreationParameter properties for creating a virtual machine. +type LabVirtualMachineCreationParameter struct { + // LabVirtualMachineCreationParameterProperties - The properties of the resource. + *LabVirtualMachineCreationParameterProperties `json:"properties,omitempty"` + // Name - The name of the virtual machine or environment + Name *string `json:"name,omitempty"` + // Location - The location of the new virtual machine or environment + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabVirtualMachineCreationParameter. +func (lvmcp LabVirtualMachineCreationParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lvmcp.LabVirtualMachineCreationParameterProperties != nil { + objectMap["properties"] = lvmcp.LabVirtualMachineCreationParameterProperties + } + if lvmcp.Name != nil { + objectMap["name"] = lvmcp.Name + } + if lvmcp.Location != nil { + objectMap["location"] = lvmcp.Location + } + if lvmcp.Tags != nil { + objectMap["tags"] = lvmcp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabVirtualMachineCreationParameter struct. +func (lvmcp *LabVirtualMachineCreationParameter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var labVirtualMachineCreationParameterProperties LabVirtualMachineCreationParameterProperties + err = json.Unmarshal(*v, &labVirtualMachineCreationParameterProperties) + if err != nil { + return err + } + lvmcp.LabVirtualMachineCreationParameterProperties = &labVirtualMachineCreationParameterProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lvmcp.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lvmcp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lvmcp.Tags = tags + } + } + } + + return nil +} + +// LabVirtualMachineCreationParameterProperties properties for virtual machine creation. +type LabVirtualMachineCreationParameterProperties struct { + // BulkCreationParameters - The number of virtual machine instances to create. + BulkCreationParameters *BulkCreationParameters `json:"bulkCreationParameters,omitempty"` + // Notes - The notes of the virtual machine. + Notes *string `json:"notes,omitempty"` + // OwnerObjectID - The object identifier of the owner of the virtual machine. + OwnerObjectID *string `json:"ownerObjectId,omitempty"` + // OwnerUserPrincipalName - The user principal name of the virtual machine owner. + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + // CreatedByUserID - The object identifier of the creator of the virtual machine. + CreatedByUserID *string `json:"createdByUserId,omitempty"` + // CreatedByUser - The email address of creator of the virtual machine. + CreatedByUser *string `json:"createdByUser,omitempty"` + // CreatedDate - The creation date of the virtual machine. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // CustomImageID - The custom image identifier of the virtual machine. + CustomImageID *string `json:"customImageId,omitempty"` + // OsType - The OS type of the virtual machine. + OsType *string `json:"osType,omitempty"` + // Size - The size of the virtual machine. + Size *string `json:"size,omitempty"` + // UserName - The user name of the virtual machine. + UserName *string `json:"userName,omitempty"` + // Password - The password of the virtual machine administrator. + Password *string `json:"password,omitempty"` + // SSHKey - The SSH key of the virtual machine administrator. + SSHKey *string `json:"sshKey,omitempty"` + // IsAuthenticationWithSSHKey - Indicates whether this virtual machine uses an SSH key for authentication. + IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + // Fqdn - The fully-qualified domain name of the virtual machine. + Fqdn *string `json:"fqdn,omitempty"` + // LabSubnetName - The lab subnet name of the virtual machine. + LabSubnetName *string `json:"labSubnetName,omitempty"` + // LabVirtualNetworkID - The lab virtual network identifier of the virtual machine. + LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` + // DisallowPublicIPAddress - Indicates whether the virtual machine is to be created without a public IP address. + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + // Artifacts - The artifacts to be installed on the virtual machine. + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` + // ArtifactDeploymentStatus - The artifact deployment status for the virtual machine. + ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` + // GalleryImageReference - The Microsoft Azure Marketplace image reference of the virtual machine. + GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` + // ComputeVM - The compute virtual machine properties. + ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` + // NetworkInterface - The network interface properties. + NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` + // ApplicableSchedule - The applicable schedule for the virtual machine. + ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` + // ExpirationDate - The expiration date for VM. + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + // AllowClaim - Indicates whether another user can take ownership of the virtual machine + AllowClaim *bool `json:"allowClaim,omitempty"` + // StorageType - Storage type to use for virtual machine (i.e. Standard, Premium). + StorageType *string `json:"storageType,omitempty"` + // VirtualMachineCreationSource - Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` + // EnvironmentID - The resource ID of the environment that contains this virtual machine, if any. + EnvironmentID *string `json:"environmentId,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabVirtualMachineFragment a virtual machine. +type LabVirtualMachineFragment struct { + // LabVirtualMachinePropertiesFragment - The properties of the resource. + *LabVirtualMachinePropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabVirtualMachineFragment. +func (lvmf LabVirtualMachineFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lvmf.LabVirtualMachinePropertiesFragment != nil { + objectMap["properties"] = lvmf.LabVirtualMachinePropertiesFragment + } + if lvmf.ID != nil { + objectMap["id"] = lvmf.ID + } + if lvmf.Name != nil { + objectMap["name"] = lvmf.Name + } + if lvmf.Type != nil { + objectMap["type"] = lvmf.Type + } + if lvmf.Location != nil { + objectMap["location"] = lvmf.Location + } + if lvmf.Tags != nil { + objectMap["tags"] = lvmf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabVirtualMachineFragment struct. +func (lvmf *LabVirtualMachineFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var labVirtualMachinePropertiesFragment LabVirtualMachinePropertiesFragment + err = json.Unmarshal(*v, &labVirtualMachinePropertiesFragment) + if err != nil { + return err + } + lvmf.LabVirtualMachinePropertiesFragment = &labVirtualMachinePropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lvmf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lvmf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lvmf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lvmf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lvmf.Tags = tags + } + } + } + + return nil +} + +// LabVirtualMachineProperties properties of a virtual machine. +type LabVirtualMachineProperties struct { + // Notes - The notes of the virtual machine. + Notes *string `json:"notes,omitempty"` + // OwnerObjectID - The object identifier of the owner of the virtual machine. + OwnerObjectID *string `json:"ownerObjectId,omitempty"` + // OwnerUserPrincipalName - The user principal name of the virtual machine owner. + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + // CreatedByUserID - The object identifier of the creator of the virtual machine. + CreatedByUserID *string `json:"createdByUserId,omitempty"` + // CreatedByUser - The email address of creator of the virtual machine. + CreatedByUser *string `json:"createdByUser,omitempty"` + // CreatedDate - The creation date of the virtual machine. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ComputeID - The resource identifier (Microsoft.Compute) of the virtual machine. + ComputeID *string `json:"computeId,omitempty"` + // CustomImageID - The custom image identifier of the virtual machine. + CustomImageID *string `json:"customImageId,omitempty"` + // OsType - The OS type of the virtual machine. + OsType *string `json:"osType,omitempty"` + // Size - The size of the virtual machine. + Size *string `json:"size,omitempty"` + // UserName - The user name of the virtual machine. + UserName *string `json:"userName,omitempty"` + // Password - The password of the virtual machine administrator. + Password *string `json:"password,omitempty"` + // SSHKey - The SSH key of the virtual machine administrator. + SSHKey *string `json:"sshKey,omitempty"` + // IsAuthenticationWithSSHKey - Indicates whether this virtual machine uses an SSH key for authentication. + IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + // Fqdn - The fully-qualified domain name of the virtual machine. + Fqdn *string `json:"fqdn,omitempty"` + // LabSubnetName - The lab subnet name of the virtual machine. + LabSubnetName *string `json:"labSubnetName,omitempty"` + // LabVirtualNetworkID - The lab virtual network identifier of the virtual machine. + LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` + // DisallowPublicIPAddress - Indicates whether the virtual machine is to be created without a public IP address. + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + // Artifacts - The artifacts to be installed on the virtual machine. + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` + // ArtifactDeploymentStatus - The artifact deployment status for the virtual machine. + ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` + // GalleryImageReference - The Microsoft Azure Marketplace image reference of the virtual machine. + GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` + // ComputeVM - The compute virtual machine properties. + ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` + // NetworkInterface - The network interface properties. + NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` + // ApplicableSchedule - The applicable schedule for the virtual machine. + ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` + // ExpirationDate - The expiration date for VM. + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + // AllowClaim - Indicates whether another user can take ownership of the virtual machine + AllowClaim *bool `json:"allowClaim,omitempty"` + // StorageType - Storage type to use for virtual machine (i.e. Standard, Premium). + StorageType *string `json:"storageType,omitempty"` + // VirtualMachineCreationSource - Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` + // EnvironmentID - The resource ID of the environment that contains this virtual machine, if any. + EnvironmentID *string `json:"environmentId,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabVirtualMachinePropertiesFragment properties of a virtual machine. +type LabVirtualMachinePropertiesFragment struct { + // Notes - The notes of the virtual machine. + Notes *string `json:"notes,omitempty"` + // OwnerObjectID - The object identifier of the owner of the virtual machine. + OwnerObjectID *string `json:"ownerObjectId,omitempty"` + // OwnerUserPrincipalName - The user principal name of the virtual machine owner. + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + // CreatedByUserID - The object identifier of the creator of the virtual machine. + CreatedByUserID *string `json:"createdByUserId,omitempty"` + // CreatedByUser - The email address of creator of the virtual machine. + CreatedByUser *string `json:"createdByUser,omitempty"` + // CreatedDate - The creation date of the virtual machine. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // CustomImageID - The custom image identifier of the virtual machine. + CustomImageID *string `json:"customImageId,omitempty"` + // OsType - The OS type of the virtual machine. + OsType *string `json:"osType,omitempty"` + // Size - The size of the virtual machine. + Size *string `json:"size,omitempty"` + // UserName - The user name of the virtual machine. + UserName *string `json:"userName,omitempty"` + // Password - The password of the virtual machine administrator. + Password *string `json:"password,omitempty"` + // SSHKey - The SSH key of the virtual machine administrator. + SSHKey *string `json:"sshKey,omitempty"` + // IsAuthenticationWithSSHKey - Indicates whether this virtual machine uses an SSH key for authentication. + IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + // Fqdn - The fully-qualified domain name of the virtual machine. + Fqdn *string `json:"fqdn,omitempty"` + // LabSubnetName - The lab subnet name of the virtual machine. + LabSubnetName *string `json:"labSubnetName,omitempty"` + // LabVirtualNetworkID - The lab virtual network identifier of the virtual machine. + LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` + // DisallowPublicIPAddress - Indicates whether the virtual machine is to be created without a public IP address. + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + // Artifacts - The artifacts to be installed on the virtual machine. + Artifacts *[]ArtifactInstallPropertiesFragment `json:"artifacts,omitempty"` + // ArtifactDeploymentStatus - The artifact deployment status for the virtual machine. + ArtifactDeploymentStatus *ArtifactDeploymentStatusPropertiesFragment `json:"artifactDeploymentStatus,omitempty"` + // GalleryImageReference - The Microsoft Azure Marketplace image reference of the virtual machine. + GalleryImageReference *GalleryImageReferenceFragment `json:"galleryImageReference,omitempty"` + // ComputeVM - The compute virtual machine properties. + ComputeVM *ComputeVMPropertiesFragment `json:"computeVm,omitempty"` + // NetworkInterface - The network interface properties. + NetworkInterface *NetworkInterfacePropertiesFragment `json:"networkInterface,omitempty"` + // ApplicableSchedule - The applicable schedule for the virtual machine. + ApplicableSchedule *ApplicableScheduleFragment `json:"applicableSchedule,omitempty"` + // ExpirationDate - The expiration date for VM. + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + // AllowClaim - Indicates whether another user can take ownership of the virtual machine + AllowClaim *bool `json:"allowClaim,omitempty"` + // StorageType - Storage type to use for virtual machine (i.e. Standard, Premium). + StorageType *string `json:"storageType,omitempty"` + // VirtualMachineCreationSource - Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` + // EnvironmentID - The resource ID of the environment that contains this virtual machine, if any. + EnvironmentID *string `json:"environmentId,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LinuxOsInfo information about a Linux OS. +type LinuxOsInfo struct { + // LinuxOsState - The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' + LinuxOsState LinuxOsState `json:"linuxOsState,omitempty"` +} + +// NetworkInterfaceProperties properties of a network interface. +type NetworkInterfaceProperties struct { + // VirtualNetworkID - The resource ID of the virtual network. + VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` + // SubnetID - The resource ID of the sub net. + SubnetID *string `json:"subnetId,omitempty"` + // PublicIPAddressID - The resource ID of the public IP address. + PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` + // PublicIPAddress - The public IP address. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - The private IP address. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // DNSName - The DNS name. + DNSName *string `json:"dnsName,omitempty"` + // RdpAuthority - The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). + RdpAuthority *string `json:"rdpAuthority,omitempty"` + // SSHAuthority - The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. + SSHAuthority *string `json:"sshAuthority,omitempty"` + // SharedPublicIPAddressConfiguration - The configuration for sharing a public IP address across multiple virtual machines. + SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` +} + +// NetworkInterfacePropertiesFragment properties of a network interface. +type NetworkInterfacePropertiesFragment struct { + // VirtualNetworkID - The resource ID of the virtual network. + VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` + // SubnetID - The resource ID of the sub net. + SubnetID *string `json:"subnetId,omitempty"` + // PublicIPAddressID - The resource ID of the public IP address. + PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` + // PublicIPAddress - The public IP address. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - The private IP address. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // DNSName - The DNS name. + DNSName *string `json:"dnsName,omitempty"` + // RdpAuthority - The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). + RdpAuthority *string `json:"rdpAuthority,omitempty"` + // SSHAuthority - The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. + SSHAuthority *string `json:"sshAuthority,omitempty"` + // SharedPublicIPAddressConfiguration - The configuration for sharing a public IP address across multiple virtual machines. + SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` +} + +// NotificationChannel a notification. +type NotificationChannel struct { + autorest.Response `json:"-"` + // NotificationChannelProperties - The properties of the resource. + *NotificationChannelProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for NotificationChannel. +func (nc NotificationChannel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if nc.NotificationChannelProperties != nil { + objectMap["properties"] = nc.NotificationChannelProperties + } + if nc.ID != nil { + objectMap["id"] = nc.ID + } + if nc.Name != nil { + objectMap["name"] = nc.Name + } + if nc.Type != nil { + objectMap["type"] = nc.Type + } + if nc.Location != nil { + objectMap["location"] = nc.Location + } + if nc.Tags != nil { + objectMap["tags"] = nc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NotificationChannel struct. +func (nc *NotificationChannel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var notificationChannelProperties NotificationChannelProperties + err = json.Unmarshal(*v, ¬ificationChannelProperties) + if err != nil { + return err + } + nc.NotificationChannelProperties = ¬ificationChannelProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + nc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + nc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + nc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + nc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + nc.Tags = tags + } + } + } + + return nil +} + +// NotificationChannelFragment a notification. +type NotificationChannelFragment struct { + // NotificationChannelPropertiesFragment - The properties of the resource. + *NotificationChannelPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for NotificationChannelFragment. +func (ncf NotificationChannelFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ncf.NotificationChannelPropertiesFragment != nil { + objectMap["properties"] = ncf.NotificationChannelPropertiesFragment + } + if ncf.ID != nil { + objectMap["id"] = ncf.ID + } + if ncf.Name != nil { + objectMap["name"] = ncf.Name + } + if ncf.Type != nil { + objectMap["type"] = ncf.Type + } + if ncf.Location != nil { + objectMap["location"] = ncf.Location + } + if ncf.Tags != nil { + objectMap["tags"] = ncf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NotificationChannelFragment struct. +func (ncf *NotificationChannelFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var notificationChannelPropertiesFragment NotificationChannelPropertiesFragment + err = json.Unmarshal(*v, ¬ificationChannelPropertiesFragment) + if err != nil { + return err + } + ncf.NotificationChannelPropertiesFragment = ¬ificationChannelPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ncf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ncf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ncf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ncf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ncf.Tags = tags + } + } + } + + return nil +} + +// NotificationChannelProperties properties of a schedule. +type NotificationChannelProperties struct { + // WebHookURL - The webhook URL to send notifications to. + WebHookURL *string `json:"webHookUrl,omitempty"` + // Description - Description of notification. + Description *string `json:"description,omitempty"` + // Events - The list of event for which this notification is enabled. + Events *[]Event `json:"events,omitempty"` + // CreatedDate - The creation date of the notification channel. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// NotificationChannelPropertiesFragment properties of a schedule. +type NotificationChannelPropertiesFragment struct { + // WebHookURL - The webhook URL to send notifications to. + WebHookURL *string `json:"webHookUrl,omitempty"` + // Description - Description of notification. + Description *string `json:"description,omitempty"` + // Events - The list of event for which this notification is enabled. + Events *[]EventFragment `json:"events,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// NotificationSettings notification settings for a schedule. +type NotificationSettings struct { + // Status - If notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'NotificationStatusDisabled', 'NotificationStatusEnabled' + Status NotificationStatus `json:"status,omitempty"` + // TimeInMinutes - Time in minutes before event at which notification will be sent. + TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` + // WebhookURL - The webhook URL to which the notification will be sent. + WebhookURL *string `json:"webhookUrl,omitempty"` +} + +// NotificationSettingsFragment notification settings for a schedule. +type NotificationSettingsFragment struct { + // Status - If notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'NotificationStatusDisabled', 'NotificationStatusEnabled' + Status NotificationStatus `json:"status,omitempty"` + // TimeInMinutes - Time in minutes before event at which notification will be sent. + TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` + // WebhookURL - The webhook URL to which the notification will be sent. + WebhookURL *string `json:"webhookUrl,omitempty"` +} + +// NotifyParameters properties for generating a Notification. +type NotifyParameters struct { + // EventName - The type of event (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost' + EventName NotificationChannelEventType `json:"eventName,omitempty"` + // JSONPayload - Properties for the notification in json format. + JSONPayload *string `json:"jsonPayload,omitempty"` +} + +// OperationError error details for the operation in case of a failure. +type OperationError struct { + // Code - The error code of the operation error. + Code *string `json:"code,omitempty"` + // Message - The error message of the operation error. + Message *string `json:"message,omitempty"` +} + +// OperationMetadata the REST API operation supported by DevTestLab ResourceProvider. +type OperationMetadata struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that describes the operations + Display *OperationMetadataDisplay `json:"display,omitempty"` +} + +// OperationMetadataDisplay the object that describes the operations +type OperationMetadataDisplay struct { + // Provider - Friendly name of the resource provider + Provider *string `json:"provider,omitempty"` + // Resource - Resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: read, write, delete, listKeys/action, etc. + Operation *string `json:"operation,omitempty"` + // Description - Friendly name of the operation + Description *string `json:"description,omitempty"` +} + +// OperationResult an Operation Result +type OperationResult struct { + autorest.Response `json:"-"` + // Status - The operation status. + Status *string `json:"status,omitempty"` + // StatusCode - The status code for the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestURITooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HTTPVersionNotSupported' + StatusCode HTTPStatusCode `json:"statusCode,omitempty"` + // Error - Error details for the operation in case of a failure. + Error *OperationError `json:"error,omitempty"` +} + +// ParameterInfo information about an artifact's parameter. +type ParameterInfo struct { + // Name - The name of the artifact parameter. + Name *string `json:"name,omitempty"` + // Value - The value of the artifact parameter. + Value *string `json:"value,omitempty"` +} + +// ParametersValueFileInfo a file containing a set of parameter values for an ARM template. +type ParametersValueFileInfo struct { + // FileName - File name. + FileName *string `json:"fileName,omitempty"` + // ParametersValueInfo - Contents of the file. + ParametersValueInfo interface{} `json:"parametersValueInfo,omitempty"` +} + +// PercentageCostThresholdProperties properties of a percentage cost threshold. +type PercentageCostThresholdProperties struct { + // ThresholdValue - The cost threshold value. + ThresholdValue *float64 `json:"thresholdValue,omitempty"` +} + +// Policy a Policy. +type Policy struct { + autorest.Response `json:"-"` + // PolicyProperties - The properties of the resource. + *PolicyProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Policy. +func (p Policy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.PolicyProperties != nil { + objectMap["properties"] = p.PolicyProperties + } + if p.ID != nil { + objectMap["id"] = p.ID + } + if p.Name != nil { + objectMap["name"] = p.Name + } + if p.Type != nil { + objectMap["type"] = p.Type + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Policy struct. +func (p *Policy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var policyProperties PolicyProperties + err = json.Unmarshal(*v, &policyProperties) + if err != nil { + return err + } + p.PolicyProperties = &policyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + } + } + + return nil +} + +// PolicyFragment a Policy. +type PolicyFragment struct { + // PolicyPropertiesFragment - The properties of the resource. + *PolicyPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PolicyFragment. +func (pf PolicyFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pf.PolicyPropertiesFragment != nil { + objectMap["properties"] = pf.PolicyPropertiesFragment + } + if pf.ID != nil { + objectMap["id"] = pf.ID + } + if pf.Name != nil { + objectMap["name"] = pf.Name + } + if pf.Type != nil { + objectMap["type"] = pf.Type + } + if pf.Location != nil { + objectMap["location"] = pf.Location + } + if pf.Tags != nil { + objectMap["tags"] = pf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PolicyFragment struct. +func (pf *PolicyFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var policyPropertiesFragment PolicyPropertiesFragment + err = json.Unmarshal(*v, &policyPropertiesFragment) + if err != nil { + return err + } + pf.PolicyPropertiesFragment = &policyPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pf.Tags = tags + } + } + } + + return nil +} + +// PolicyProperties properties of a Policy. +type PolicyProperties struct { + // Description - The description of the policy. + Description *string `json:"description,omitempty"` + // Status - The status of the policy. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' + Status PolicyStatus `json:"status,omitempty"` + // FactName - The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'PolicyFactNameUserOwnedLabVMCount', 'PolicyFactNameUserOwnedLabPremiumVMCount', 'PolicyFactNameLabVMCount', 'PolicyFactNameLabPremiumVMCount', 'PolicyFactNameLabVMSize', 'PolicyFactNameGalleryImage', 'PolicyFactNameUserOwnedLabVMCountInSubnet', 'PolicyFactNameLabTargetCost' + FactName PolicyFactName `json:"factName,omitempty"` + // FactData - The fact data of the policy. + FactData *string `json:"factData,omitempty"` + // Threshold - The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + Threshold *string `json:"threshold,omitempty"` + // EvaluatorType - The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` + // CreatedDate - The creation date of the policy. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// PolicyPropertiesFragment properties of a Policy. +type PolicyPropertiesFragment struct { + // Description - The description of the policy. + Description *string `json:"description,omitempty"` + // Status - The status of the policy. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' + Status PolicyStatus `json:"status,omitempty"` + // FactName - The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'PolicyFactNameUserOwnedLabVMCount', 'PolicyFactNameUserOwnedLabPremiumVMCount', 'PolicyFactNameLabVMCount', 'PolicyFactNameLabPremiumVMCount', 'PolicyFactNameLabVMSize', 'PolicyFactNameGalleryImage', 'PolicyFactNameUserOwnedLabVMCountInSubnet', 'PolicyFactNameLabTargetCost' + FactName PolicyFactName `json:"factName,omitempty"` + // FactData - The fact data of the policy. + FactData *string `json:"factData,omitempty"` + // Threshold - The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + Threshold *string `json:"threshold,omitempty"` + // EvaluatorType - The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// PolicySetResult result of a policy set evaluation. +type PolicySetResult struct { + // HasError - A value indicating whether this policy set evaluation has discovered violations. + HasError *bool `json:"hasError,omitempty"` + // PolicyViolations - The list of policy violations. + PolicyViolations *[]PolicyViolation `json:"policyViolations,omitempty"` +} + +// PolicyViolation policy violation. +type PolicyViolation struct { + // Code - The code of the policy violation. + Code *string `json:"code,omitempty"` + // Message - The message of the policy violation. + Message *string `json:"message,omitempty"` +} + +// Port properties of a network port. +type Port struct { + // TransportProtocol - Protocol type of the port. Possible values include: 'TCP', 'UDP' + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + // BackendPort - Backend port of the target virtual machine. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// PortFragment properties of a network port. +type PortFragment struct { + // TransportProtocol - Protocol type of the port. Possible values include: 'TCP', 'UDP' + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + // BackendPort - Backend port of the target virtual machine. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// ProviderOperationResult result of the request to list REST API operations +type ProviderOperationResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the resource provider. + Value *[]OperationMetadata `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProviderOperationResultIterator provides access to a complete listing of OperationMetadata values. +type ProviderOperationResultIterator struct { + i int + page ProviderOperationResultPage +} + +// 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 *ProviderOperationResultIterator) 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 ProviderOperationResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProviderOperationResultIterator) Response() ProviderOperationResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProviderOperationResultIterator) Value() OperationMetadata { + if !iter.page.NotDone() { + return OperationMetadata{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (por ProviderOperationResult) IsEmpty() bool { + return por.Value == nil || len(*por.Value) == 0 +} + +// providerOperationResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (por ProviderOperationResult) providerOperationResultPreparer() (*http.Request, error) { + if por.NextLink == nil || len(to.String(por.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(por.NextLink))) +} + +// ProviderOperationResultPage contains a page of OperationMetadata values. +type ProviderOperationResultPage struct { + fn func(ProviderOperationResult) (ProviderOperationResult, error) + por ProviderOperationResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProviderOperationResultPage) Next() error { + next, err := page.fn(page.por) + if err != nil { + return err + } + page.por = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProviderOperationResultPage) NotDone() bool { + return !page.por.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProviderOperationResultPage) Response() ProviderOperationResult { + return page.por +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProviderOperationResultPage) Values() []OperationMetadata { + if page.por.IsEmpty() { + return nil + } + return *page.por.Value +} + +// Resource an Azure resource. +type Resource struct { + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.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) +} + +// ResponseWithContinuationArmTemplate the response of a list operation. +type ResponseWithContinuationArmTemplate struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]ArmTemplate `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationArmTemplateIterator provides access to a complete listing of ArmTemplate values. +type ResponseWithContinuationArmTemplateIterator struct { + i int + page ResponseWithContinuationArmTemplatePage +} + +// 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 *ResponseWithContinuationArmTemplateIterator) 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 ResponseWithContinuationArmTemplateIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationArmTemplateIterator) Response() ResponseWithContinuationArmTemplate { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationArmTemplateIterator) Value() ArmTemplate { + if !iter.page.NotDone() { + return ArmTemplate{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcAt ResponseWithContinuationArmTemplate) IsEmpty() bool { + return rwcAt.Value == nil || len(*rwcAt.Value) == 0 +} + +// responseWithContinuationArmTemplatePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcAt ResponseWithContinuationArmTemplate) responseWithContinuationArmTemplatePreparer() (*http.Request, error) { + if rwcAt.NextLink == nil || len(to.String(rwcAt.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcAt.NextLink))) +} + +// ResponseWithContinuationArmTemplatePage contains a page of ArmTemplate values. +type ResponseWithContinuationArmTemplatePage struct { + fn func(ResponseWithContinuationArmTemplate) (ResponseWithContinuationArmTemplate, error) + rwcat ResponseWithContinuationArmTemplate +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationArmTemplatePage) Next() error { + next, err := page.fn(page.rwcat) + if err != nil { + return err + } + page.rwcat = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationArmTemplatePage) NotDone() bool { + return !page.rwcat.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationArmTemplatePage) Response() ResponseWithContinuationArmTemplate { + return page.rwcat +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationArmTemplatePage) Values() []ArmTemplate { + if page.rwcat.IsEmpty() { + return nil + } + return *page.rwcat.Value +} + +// ResponseWithContinuationArtifact the response of a list operation. +type ResponseWithContinuationArtifact struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Artifact `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationArtifactIterator provides access to a complete listing of Artifact values. +type ResponseWithContinuationArtifactIterator struct { + i int + page ResponseWithContinuationArtifactPage +} + +// 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 *ResponseWithContinuationArtifactIterator) 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 ResponseWithContinuationArtifactIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationArtifactIterator) Response() ResponseWithContinuationArtifact { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationArtifactIterator) Value() Artifact { + if !iter.page.NotDone() { + return Artifact{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcA ResponseWithContinuationArtifact) IsEmpty() bool { + return rwcA.Value == nil || len(*rwcA.Value) == 0 +} + +// responseWithContinuationArtifactPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcA ResponseWithContinuationArtifact) responseWithContinuationArtifactPreparer() (*http.Request, error) { + if rwcA.NextLink == nil || len(to.String(rwcA.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcA.NextLink))) +} + +// ResponseWithContinuationArtifactPage contains a page of Artifact values. +type ResponseWithContinuationArtifactPage struct { + fn func(ResponseWithContinuationArtifact) (ResponseWithContinuationArtifact, error) + rwca ResponseWithContinuationArtifact +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationArtifactPage) Next() error { + next, err := page.fn(page.rwca) + if err != nil { + return err + } + page.rwca = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationArtifactPage) NotDone() bool { + return !page.rwca.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationArtifactPage) Response() ResponseWithContinuationArtifact { + return page.rwca +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationArtifactPage) Values() []Artifact { + if page.rwca.IsEmpty() { + return nil + } + return *page.rwca.Value +} + +// ResponseWithContinuationArtifactSource the response of a list operation. +type ResponseWithContinuationArtifactSource struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]ArtifactSource `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationArtifactSourceIterator provides access to a complete listing of ArtifactSource values. +type ResponseWithContinuationArtifactSourceIterator struct { + i int + page ResponseWithContinuationArtifactSourcePage +} + +// 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 *ResponseWithContinuationArtifactSourceIterator) 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 ResponseWithContinuationArtifactSourceIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationArtifactSourceIterator) Response() ResponseWithContinuationArtifactSource { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationArtifactSourceIterator) Value() ArtifactSource { + if !iter.page.NotDone() { + return ArtifactSource{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcAs ResponseWithContinuationArtifactSource) IsEmpty() bool { + return rwcAs.Value == nil || len(*rwcAs.Value) == 0 +} + +// responseWithContinuationArtifactSourcePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcAs ResponseWithContinuationArtifactSource) responseWithContinuationArtifactSourcePreparer() (*http.Request, error) { + if rwcAs.NextLink == nil || len(to.String(rwcAs.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcAs.NextLink))) +} + +// ResponseWithContinuationArtifactSourcePage contains a page of ArtifactSource values. +type ResponseWithContinuationArtifactSourcePage struct { + fn func(ResponseWithContinuationArtifactSource) (ResponseWithContinuationArtifactSource, error) + rwcas ResponseWithContinuationArtifactSource +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationArtifactSourcePage) Next() error { + next, err := page.fn(page.rwcas) + if err != nil { + return err + } + page.rwcas = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationArtifactSourcePage) NotDone() bool { + return !page.rwcas.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationArtifactSourcePage) Response() ResponseWithContinuationArtifactSource { + return page.rwcas +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationArtifactSourcePage) Values() []ArtifactSource { + if page.rwcas.IsEmpty() { + return nil + } + return *page.rwcas.Value +} + +// ResponseWithContinuationCustomImage the response of a list operation. +type ResponseWithContinuationCustomImage struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]CustomImage `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationCustomImageIterator provides access to a complete listing of CustomImage values. +type ResponseWithContinuationCustomImageIterator struct { + i int + page ResponseWithContinuationCustomImagePage +} + +// 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 *ResponseWithContinuationCustomImageIterator) 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 ResponseWithContinuationCustomImageIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationCustomImageIterator) Response() ResponseWithContinuationCustomImage { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationCustomImageIterator) Value() CustomImage { + if !iter.page.NotDone() { + return CustomImage{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcCi ResponseWithContinuationCustomImage) IsEmpty() bool { + return rwcCi.Value == nil || len(*rwcCi.Value) == 0 +} + +// responseWithContinuationCustomImagePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcCi ResponseWithContinuationCustomImage) responseWithContinuationCustomImagePreparer() (*http.Request, error) { + if rwcCi.NextLink == nil || len(to.String(rwcCi.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcCi.NextLink))) +} + +// ResponseWithContinuationCustomImagePage contains a page of CustomImage values. +type ResponseWithContinuationCustomImagePage struct { + fn func(ResponseWithContinuationCustomImage) (ResponseWithContinuationCustomImage, error) + rwcci ResponseWithContinuationCustomImage +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationCustomImagePage) Next() error { + next, err := page.fn(page.rwcci) + if err != nil { + return err + } + page.rwcci = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationCustomImagePage) NotDone() bool { + return !page.rwcci.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationCustomImagePage) Response() ResponseWithContinuationCustomImage { + return page.rwcci +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationCustomImagePage) Values() []CustomImage { + if page.rwcci.IsEmpty() { + return nil + } + return *page.rwcci.Value +} + +// ResponseWithContinuationDisk the response of a list operation. +type ResponseWithContinuationDisk struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Disk `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationDiskIterator provides access to a complete listing of Disk values. +type ResponseWithContinuationDiskIterator struct { + i int + page ResponseWithContinuationDiskPage +} + +// 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 *ResponseWithContinuationDiskIterator) 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 ResponseWithContinuationDiskIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationDiskIterator) Response() ResponseWithContinuationDisk { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationDiskIterator) Value() Disk { + if !iter.page.NotDone() { + return Disk{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcD ResponseWithContinuationDisk) IsEmpty() bool { + return rwcD.Value == nil || len(*rwcD.Value) == 0 +} + +// responseWithContinuationDiskPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcD ResponseWithContinuationDisk) responseWithContinuationDiskPreparer() (*http.Request, error) { + if rwcD.NextLink == nil || len(to.String(rwcD.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcD.NextLink))) +} + +// ResponseWithContinuationDiskPage contains a page of Disk values. +type ResponseWithContinuationDiskPage struct { + fn func(ResponseWithContinuationDisk) (ResponseWithContinuationDisk, error) + rwcd ResponseWithContinuationDisk +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationDiskPage) Next() error { + next, err := page.fn(page.rwcd) + if err != nil { + return err + } + page.rwcd = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationDiskPage) NotDone() bool { + return !page.rwcd.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationDiskPage) Response() ResponseWithContinuationDisk { + return page.rwcd +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationDiskPage) Values() []Disk { + if page.rwcd.IsEmpty() { + return nil + } + return *page.rwcd.Value +} + +// ResponseWithContinuationDtlEnvironment the response of a list operation. +type ResponseWithContinuationDtlEnvironment struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Environment `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationDtlEnvironmentIterator provides access to a complete listing of Environment values. +type ResponseWithContinuationDtlEnvironmentIterator struct { + i int + page ResponseWithContinuationDtlEnvironmentPage +} + +// 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 *ResponseWithContinuationDtlEnvironmentIterator) 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 ResponseWithContinuationDtlEnvironmentIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationDtlEnvironmentIterator) Response() ResponseWithContinuationDtlEnvironment { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationDtlEnvironmentIterator) Value() Environment { + if !iter.page.NotDone() { + return Environment{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcDe ResponseWithContinuationDtlEnvironment) IsEmpty() bool { + return rwcDe.Value == nil || len(*rwcDe.Value) == 0 +} + +// responseWithContinuationDtlEnvironmentPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcDe ResponseWithContinuationDtlEnvironment) responseWithContinuationDtlEnvironmentPreparer() (*http.Request, error) { + if rwcDe.NextLink == nil || len(to.String(rwcDe.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcDe.NextLink))) +} + +// ResponseWithContinuationDtlEnvironmentPage contains a page of Environment values. +type ResponseWithContinuationDtlEnvironmentPage struct { + fn func(ResponseWithContinuationDtlEnvironment) (ResponseWithContinuationDtlEnvironment, error) + rwcde ResponseWithContinuationDtlEnvironment +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationDtlEnvironmentPage) Next() error { + next, err := page.fn(page.rwcde) + if err != nil { + return err + } + page.rwcde = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationDtlEnvironmentPage) NotDone() bool { + return !page.rwcde.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationDtlEnvironmentPage) Response() ResponseWithContinuationDtlEnvironment { + return page.rwcde +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationDtlEnvironmentPage) Values() []Environment { + if page.rwcde.IsEmpty() { + return nil + } + return *page.rwcde.Value +} + +// ResponseWithContinuationFormula the response of a list operation. +type ResponseWithContinuationFormula struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Formula `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationFormulaIterator provides access to a complete listing of Formula values. +type ResponseWithContinuationFormulaIterator struct { + i int + page ResponseWithContinuationFormulaPage +} + +// 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 *ResponseWithContinuationFormulaIterator) 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 ResponseWithContinuationFormulaIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationFormulaIterator) Response() ResponseWithContinuationFormula { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationFormulaIterator) Value() Formula { + if !iter.page.NotDone() { + return Formula{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcF ResponseWithContinuationFormula) IsEmpty() bool { + return rwcF.Value == nil || len(*rwcF.Value) == 0 +} + +// responseWithContinuationFormulaPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcF ResponseWithContinuationFormula) responseWithContinuationFormulaPreparer() (*http.Request, error) { + if rwcF.NextLink == nil || len(to.String(rwcF.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcF.NextLink))) +} + +// ResponseWithContinuationFormulaPage contains a page of Formula values. +type ResponseWithContinuationFormulaPage struct { + fn func(ResponseWithContinuationFormula) (ResponseWithContinuationFormula, error) + rwcf ResponseWithContinuationFormula +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationFormulaPage) Next() error { + next, err := page.fn(page.rwcf) + if err != nil { + return err + } + page.rwcf = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationFormulaPage) NotDone() bool { + return !page.rwcf.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationFormulaPage) Response() ResponseWithContinuationFormula { + return page.rwcf +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationFormulaPage) Values() []Formula { + if page.rwcf.IsEmpty() { + return nil + } + return *page.rwcf.Value +} + +// ResponseWithContinuationGalleryImage the response of a list operation. +type ResponseWithContinuationGalleryImage struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]GalleryImage `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationGalleryImageIterator provides access to a complete listing of GalleryImage values. +type ResponseWithContinuationGalleryImageIterator struct { + i int + page ResponseWithContinuationGalleryImagePage +} + +// 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 *ResponseWithContinuationGalleryImageIterator) 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 ResponseWithContinuationGalleryImageIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationGalleryImageIterator) Response() ResponseWithContinuationGalleryImage { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationGalleryImageIterator) Value() GalleryImage { + if !iter.page.NotDone() { + return GalleryImage{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcGi ResponseWithContinuationGalleryImage) IsEmpty() bool { + return rwcGi.Value == nil || len(*rwcGi.Value) == 0 +} + +// responseWithContinuationGalleryImagePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcGi ResponseWithContinuationGalleryImage) responseWithContinuationGalleryImagePreparer() (*http.Request, error) { + if rwcGi.NextLink == nil || len(to.String(rwcGi.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcGi.NextLink))) +} + +// ResponseWithContinuationGalleryImagePage contains a page of GalleryImage values. +type ResponseWithContinuationGalleryImagePage struct { + fn func(ResponseWithContinuationGalleryImage) (ResponseWithContinuationGalleryImage, error) + rwcgi ResponseWithContinuationGalleryImage +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationGalleryImagePage) Next() error { + next, err := page.fn(page.rwcgi) + if err != nil { + return err + } + page.rwcgi = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationGalleryImagePage) NotDone() bool { + return !page.rwcgi.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationGalleryImagePage) Response() ResponseWithContinuationGalleryImage { + return page.rwcgi +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationGalleryImagePage) Values() []GalleryImage { + if page.rwcgi.IsEmpty() { + return nil + } + return *page.rwcgi.Value +} + +// ResponseWithContinuationLab the response of a list operation. +type ResponseWithContinuationLab struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Lab `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabIterator provides access to a complete listing of Lab values. +type ResponseWithContinuationLabIterator struct { + i int + page ResponseWithContinuationLabPage +} + +// 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 *ResponseWithContinuationLabIterator) 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 ResponseWithContinuationLabIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationLabIterator) Response() ResponseWithContinuationLab { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationLabIterator) Value() Lab { + if !iter.page.NotDone() { + return Lab{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcL ResponseWithContinuationLab) IsEmpty() bool { + return rwcL.Value == nil || len(*rwcL.Value) == 0 +} + +// responseWithContinuationLabPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcL ResponseWithContinuationLab) responseWithContinuationLabPreparer() (*http.Request, error) { + if rwcL.NextLink == nil || len(to.String(rwcL.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcL.NextLink))) +} + +// ResponseWithContinuationLabPage contains a page of Lab values. +type ResponseWithContinuationLabPage struct { + fn func(ResponseWithContinuationLab) (ResponseWithContinuationLab, error) + rwcl ResponseWithContinuationLab +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationLabPage) Next() error { + next, err := page.fn(page.rwcl) + if err != nil { + return err + } + page.rwcl = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationLabPage) NotDone() bool { + return !page.rwcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationLabPage) Response() ResponseWithContinuationLab { + return page.rwcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationLabPage) Values() []Lab { + if page.rwcl.IsEmpty() { + return nil + } + return *page.rwcl.Value +} + +// ResponseWithContinuationLabVhd the response of a list operation. +type ResponseWithContinuationLabVhd struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]LabVhd `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabVhdIterator provides access to a complete listing of LabVhd values. +type ResponseWithContinuationLabVhdIterator struct { + i int + page ResponseWithContinuationLabVhdPage +} + +// 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 *ResponseWithContinuationLabVhdIterator) 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 ResponseWithContinuationLabVhdIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationLabVhdIterator) Response() ResponseWithContinuationLabVhd { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationLabVhdIterator) Value() LabVhd { + if !iter.page.NotDone() { + return LabVhd{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcLv ResponseWithContinuationLabVhd) IsEmpty() bool { + return rwcLv.Value == nil || len(*rwcLv.Value) == 0 +} + +// responseWithContinuationLabVhdPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcLv ResponseWithContinuationLabVhd) responseWithContinuationLabVhdPreparer() (*http.Request, error) { + if rwcLv.NextLink == nil || len(to.String(rwcLv.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcLv.NextLink))) +} + +// ResponseWithContinuationLabVhdPage contains a page of LabVhd values. +type ResponseWithContinuationLabVhdPage struct { + fn func(ResponseWithContinuationLabVhd) (ResponseWithContinuationLabVhd, error) + rwclv ResponseWithContinuationLabVhd +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationLabVhdPage) Next() error { + next, err := page.fn(page.rwclv) + if err != nil { + return err + } + page.rwclv = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationLabVhdPage) NotDone() bool { + return !page.rwclv.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationLabVhdPage) Response() ResponseWithContinuationLabVhd { + return page.rwclv +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationLabVhdPage) Values() []LabVhd { + if page.rwclv.IsEmpty() { + return nil + } + return *page.rwclv.Value +} + +// ResponseWithContinuationLabVirtualMachine the response of a list operation. +type ResponseWithContinuationLabVirtualMachine struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]LabVirtualMachine `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabVirtualMachineIterator provides access to a complete listing of LabVirtualMachine +// values. +type ResponseWithContinuationLabVirtualMachineIterator struct { + i int + page ResponseWithContinuationLabVirtualMachinePage +} + +// 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 *ResponseWithContinuationLabVirtualMachineIterator) 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 ResponseWithContinuationLabVirtualMachineIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationLabVirtualMachineIterator) Response() ResponseWithContinuationLabVirtualMachine { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationLabVirtualMachineIterator) Value() LabVirtualMachine { + if !iter.page.NotDone() { + return LabVirtualMachine{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcLvm ResponseWithContinuationLabVirtualMachine) IsEmpty() bool { + return rwcLvm.Value == nil || len(*rwcLvm.Value) == 0 +} + +// responseWithContinuationLabVirtualMachinePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcLvm ResponseWithContinuationLabVirtualMachine) responseWithContinuationLabVirtualMachinePreparer() (*http.Request, error) { + if rwcLvm.NextLink == nil || len(to.String(rwcLvm.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcLvm.NextLink))) +} + +// ResponseWithContinuationLabVirtualMachinePage contains a page of LabVirtualMachine values. +type ResponseWithContinuationLabVirtualMachinePage struct { + fn func(ResponseWithContinuationLabVirtualMachine) (ResponseWithContinuationLabVirtualMachine, error) + rwclvm ResponseWithContinuationLabVirtualMachine +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationLabVirtualMachinePage) Next() error { + next, err := page.fn(page.rwclvm) + if err != nil { + return err + } + page.rwclvm = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationLabVirtualMachinePage) NotDone() bool { + return !page.rwclvm.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationLabVirtualMachinePage) Response() ResponseWithContinuationLabVirtualMachine { + return page.rwclvm +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationLabVirtualMachinePage) Values() []LabVirtualMachine { + if page.rwclvm.IsEmpty() { + return nil + } + return *page.rwclvm.Value +} + +// ResponseWithContinuationNotificationChannel the response of a list operation. +type ResponseWithContinuationNotificationChannel struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]NotificationChannel `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationNotificationChannelIterator provides access to a complete listing of NotificationChannel +// values. +type ResponseWithContinuationNotificationChannelIterator struct { + i int + page ResponseWithContinuationNotificationChannelPage +} + +// 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 *ResponseWithContinuationNotificationChannelIterator) 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 ResponseWithContinuationNotificationChannelIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationNotificationChannelIterator) Response() ResponseWithContinuationNotificationChannel { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationNotificationChannelIterator) Value() NotificationChannel { + if !iter.page.NotDone() { + return NotificationChannel{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcNc ResponseWithContinuationNotificationChannel) IsEmpty() bool { + return rwcNc.Value == nil || len(*rwcNc.Value) == 0 +} + +// responseWithContinuationNotificationChannelPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcNc ResponseWithContinuationNotificationChannel) responseWithContinuationNotificationChannelPreparer() (*http.Request, error) { + if rwcNc.NextLink == nil || len(to.String(rwcNc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcNc.NextLink))) +} + +// ResponseWithContinuationNotificationChannelPage contains a page of NotificationChannel values. +type ResponseWithContinuationNotificationChannelPage struct { + fn func(ResponseWithContinuationNotificationChannel) (ResponseWithContinuationNotificationChannel, error) + rwcnc ResponseWithContinuationNotificationChannel +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationNotificationChannelPage) Next() error { + next, err := page.fn(page.rwcnc) + if err != nil { + return err + } + page.rwcnc = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationNotificationChannelPage) NotDone() bool { + return !page.rwcnc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationNotificationChannelPage) Response() ResponseWithContinuationNotificationChannel { + return page.rwcnc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationNotificationChannelPage) Values() []NotificationChannel { + if page.rwcnc.IsEmpty() { + return nil + } + return *page.rwcnc.Value +} + +// ResponseWithContinuationPolicy the response of a list operation. +type ResponseWithContinuationPolicy struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Policy `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationPolicyIterator provides access to a complete listing of Policy values. +type ResponseWithContinuationPolicyIterator struct { + i int + page ResponseWithContinuationPolicyPage +} + +// 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 *ResponseWithContinuationPolicyIterator) 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 ResponseWithContinuationPolicyIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationPolicyIterator) Response() ResponseWithContinuationPolicy { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationPolicyIterator) Value() Policy { + if !iter.page.NotDone() { + return Policy{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcP ResponseWithContinuationPolicy) IsEmpty() bool { + return rwcP.Value == nil || len(*rwcP.Value) == 0 +} + +// responseWithContinuationPolicyPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcP ResponseWithContinuationPolicy) responseWithContinuationPolicyPreparer() (*http.Request, error) { + if rwcP.NextLink == nil || len(to.String(rwcP.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcP.NextLink))) +} + +// ResponseWithContinuationPolicyPage contains a page of Policy values. +type ResponseWithContinuationPolicyPage struct { + fn func(ResponseWithContinuationPolicy) (ResponseWithContinuationPolicy, error) + rwcp ResponseWithContinuationPolicy +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationPolicyPage) Next() error { + next, err := page.fn(page.rwcp) + if err != nil { + return err + } + page.rwcp = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationPolicyPage) NotDone() bool { + return !page.rwcp.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationPolicyPage) Response() ResponseWithContinuationPolicy { + return page.rwcp +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationPolicyPage) Values() []Policy { + if page.rwcp.IsEmpty() { + return nil + } + return *page.rwcp.Value +} + +// ResponseWithContinuationSchedule the response of a list operation. +type ResponseWithContinuationSchedule struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Schedule `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationScheduleIterator provides access to a complete listing of Schedule values. +type ResponseWithContinuationScheduleIterator struct { + i int + page ResponseWithContinuationSchedulePage +} + +// 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 *ResponseWithContinuationScheduleIterator) 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 ResponseWithContinuationScheduleIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationScheduleIterator) Response() ResponseWithContinuationSchedule { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationScheduleIterator) Value() Schedule { + if !iter.page.NotDone() { + return Schedule{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcS ResponseWithContinuationSchedule) IsEmpty() bool { + return rwcS.Value == nil || len(*rwcS.Value) == 0 +} + +// responseWithContinuationSchedulePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcS ResponseWithContinuationSchedule) responseWithContinuationSchedulePreparer() (*http.Request, error) { + if rwcS.NextLink == nil || len(to.String(rwcS.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcS.NextLink))) +} + +// ResponseWithContinuationSchedulePage contains a page of Schedule values. +type ResponseWithContinuationSchedulePage struct { + fn func(ResponseWithContinuationSchedule) (ResponseWithContinuationSchedule, error) + rwcs ResponseWithContinuationSchedule +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationSchedulePage) Next() error { + next, err := page.fn(page.rwcs) + if err != nil { + return err + } + page.rwcs = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationSchedulePage) NotDone() bool { + return !page.rwcs.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationSchedulePage) Response() ResponseWithContinuationSchedule { + return page.rwcs +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationSchedulePage) Values() []Schedule { + if page.rwcs.IsEmpty() { + return nil + } + return *page.rwcs.Value +} + +// ResponseWithContinuationSecret the response of a list operation. +type ResponseWithContinuationSecret struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Secret `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationSecretIterator provides access to a complete listing of Secret values. +type ResponseWithContinuationSecretIterator struct { + i int + page ResponseWithContinuationSecretPage +} + +// 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 *ResponseWithContinuationSecretIterator) 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 ResponseWithContinuationSecretIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationSecretIterator) Response() ResponseWithContinuationSecret { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationSecretIterator) Value() Secret { + if !iter.page.NotDone() { + return Secret{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcS ResponseWithContinuationSecret) IsEmpty() bool { + return rwcS.Value == nil || len(*rwcS.Value) == 0 +} + +// responseWithContinuationSecretPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcS ResponseWithContinuationSecret) responseWithContinuationSecretPreparer() (*http.Request, error) { + if rwcS.NextLink == nil || len(to.String(rwcS.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcS.NextLink))) +} + +// ResponseWithContinuationSecretPage contains a page of Secret values. +type ResponseWithContinuationSecretPage struct { + fn func(ResponseWithContinuationSecret) (ResponseWithContinuationSecret, error) + rwcs ResponseWithContinuationSecret +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationSecretPage) Next() error { + next, err := page.fn(page.rwcs) + if err != nil { + return err + } + page.rwcs = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationSecretPage) NotDone() bool { + return !page.rwcs.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationSecretPage) Response() ResponseWithContinuationSecret { + return page.rwcs +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationSecretPage) Values() []Secret { + if page.rwcs.IsEmpty() { + return nil + } + return *page.rwcs.Value +} + +// ResponseWithContinuationServiceRunner the response of a list operation. +type ResponseWithContinuationServiceRunner struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]ServiceRunner `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationServiceRunnerIterator provides access to a complete listing of ServiceRunner values. +type ResponseWithContinuationServiceRunnerIterator struct { + i int + page ResponseWithContinuationServiceRunnerPage +} + +// 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 *ResponseWithContinuationServiceRunnerIterator) 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 ResponseWithContinuationServiceRunnerIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationServiceRunnerIterator) Response() ResponseWithContinuationServiceRunner { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationServiceRunnerIterator) Value() ServiceRunner { + if !iter.page.NotDone() { + return ServiceRunner{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcSr ResponseWithContinuationServiceRunner) IsEmpty() bool { + return rwcSr.Value == nil || len(*rwcSr.Value) == 0 +} + +// responseWithContinuationServiceRunnerPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcSr ResponseWithContinuationServiceRunner) responseWithContinuationServiceRunnerPreparer() (*http.Request, error) { + if rwcSr.NextLink == nil || len(to.String(rwcSr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcSr.NextLink))) +} + +// ResponseWithContinuationServiceRunnerPage contains a page of ServiceRunner values. +type ResponseWithContinuationServiceRunnerPage struct { + fn func(ResponseWithContinuationServiceRunner) (ResponseWithContinuationServiceRunner, error) + rwcsr ResponseWithContinuationServiceRunner +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationServiceRunnerPage) Next() error { + next, err := page.fn(page.rwcsr) + if err != nil { + return err + } + page.rwcsr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationServiceRunnerPage) NotDone() bool { + return !page.rwcsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationServiceRunnerPage) Response() ResponseWithContinuationServiceRunner { + return page.rwcsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationServiceRunnerPage) Values() []ServiceRunner { + if page.rwcsr.IsEmpty() { + return nil + } + return *page.rwcsr.Value +} + +// ResponseWithContinuationUser the response of a list operation. +type ResponseWithContinuationUser struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]User `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationUserIterator provides access to a complete listing of User values. +type ResponseWithContinuationUserIterator struct { + i int + page ResponseWithContinuationUserPage +} + +// 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 *ResponseWithContinuationUserIterator) 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 ResponseWithContinuationUserIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationUserIterator) Response() ResponseWithContinuationUser { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationUserIterator) Value() User { + if !iter.page.NotDone() { + return User{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcU ResponseWithContinuationUser) IsEmpty() bool { + return rwcU.Value == nil || len(*rwcU.Value) == 0 +} + +// responseWithContinuationUserPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcU ResponseWithContinuationUser) responseWithContinuationUserPreparer() (*http.Request, error) { + if rwcU.NextLink == nil || len(to.String(rwcU.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcU.NextLink))) +} + +// ResponseWithContinuationUserPage contains a page of User values. +type ResponseWithContinuationUserPage struct { + fn func(ResponseWithContinuationUser) (ResponseWithContinuationUser, error) + rwcu ResponseWithContinuationUser +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationUserPage) Next() error { + next, err := page.fn(page.rwcu) + if err != nil { + return err + } + page.rwcu = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationUserPage) NotDone() bool { + return !page.rwcu.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationUserPage) Response() ResponseWithContinuationUser { + return page.rwcu +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationUserPage) Values() []User { + if page.rwcu.IsEmpty() { + return nil + } + return *page.rwcu.Value +} + +// ResponseWithContinuationVirtualNetwork the response of a list operation. +type ResponseWithContinuationVirtualNetwork struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]VirtualNetwork `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationVirtualNetworkIterator provides access to a complete listing of VirtualNetwork values. +type ResponseWithContinuationVirtualNetworkIterator struct { + i int + page ResponseWithContinuationVirtualNetworkPage +} + +// 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 *ResponseWithContinuationVirtualNetworkIterator) 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 ResponseWithContinuationVirtualNetworkIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResponseWithContinuationVirtualNetworkIterator) Response() ResponseWithContinuationVirtualNetwork { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResponseWithContinuationVirtualNetworkIterator) Value() VirtualNetwork { + if !iter.page.NotDone() { + return VirtualNetwork{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcVn ResponseWithContinuationVirtualNetwork) IsEmpty() bool { + return rwcVn.Value == nil || len(*rwcVn.Value) == 0 +} + +// responseWithContinuationVirtualNetworkPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcVn ResponseWithContinuationVirtualNetwork) responseWithContinuationVirtualNetworkPreparer() (*http.Request, error) { + if rwcVn.NextLink == nil || len(to.String(rwcVn.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcVn.NextLink))) +} + +// ResponseWithContinuationVirtualNetworkPage contains a page of VirtualNetwork values. +type ResponseWithContinuationVirtualNetworkPage struct { + fn func(ResponseWithContinuationVirtualNetwork) (ResponseWithContinuationVirtualNetwork, error) + rwcvn ResponseWithContinuationVirtualNetwork +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResponseWithContinuationVirtualNetworkPage) Next() error { + next, err := page.fn(page.rwcvn) + if err != nil { + return err + } + page.rwcvn = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationVirtualNetworkPage) NotDone() bool { + return !page.rwcvn.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationVirtualNetworkPage) Response() ResponseWithContinuationVirtualNetwork { + return page.rwcvn +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationVirtualNetworkPage) Values() []VirtualNetwork { + if page.rwcvn.IsEmpty() { + return nil + } + return *page.rwcvn.Value +} + +// RetargetScheduleProperties properties for retargeting a virtual machine schedule. +type RetargetScheduleProperties struct { + // CurrentResourceID - The resource Id of the virtual machine on which the schedule operates + CurrentResourceID *string `json:"currentResourceId,omitempty"` + // TargetResourceID - The resource Id of the virtual machine that the schedule should be retargeted to + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// Schedule a schedule. +type Schedule struct { + autorest.Response `json:"-"` + // ScheduleProperties - The properties of the resource. + *ScheduleProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Schedule. +func (s Schedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.ScheduleProperties != nil { + objectMap["properties"] = s.ScheduleProperties + } + if s.ID != nil { + objectMap["id"] = s.ID + } + if s.Name != nil { + objectMap["name"] = s.Name + } + if s.Type != nil { + objectMap["type"] = s.Type + } + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Schedule struct. +func (s *Schedule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scheduleProperties ScheduleProperties + err = json.Unmarshal(*v, &scheduleProperties) + if err != nil { + return err + } + s.ScheduleProperties = &scheduleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + } + } + + return nil +} + +// ScheduleFragment a schedule. +type ScheduleFragment struct { + // SchedulePropertiesFragment - The properties of the resource. + *SchedulePropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ScheduleFragment. +func (sf ScheduleFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sf.SchedulePropertiesFragment != nil { + objectMap["properties"] = sf.SchedulePropertiesFragment + } + if sf.ID != nil { + objectMap["id"] = sf.ID + } + if sf.Name != nil { + objectMap["name"] = sf.Name + } + if sf.Type != nil { + objectMap["type"] = sf.Type + } + if sf.Location != nil { + objectMap["location"] = sf.Location + } + if sf.Tags != nil { + objectMap["tags"] = sf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ScheduleFragment struct. +func (sf *ScheduleFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var schedulePropertiesFragment SchedulePropertiesFragment + err = json.Unmarshal(*v, &schedulePropertiesFragment) + if err != nil { + return err + } + sf.SchedulePropertiesFragment = &schedulePropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sf.Tags = tags + } + } + } + + return nil +} + +// ScheduleProperties properties of a schedule. +type ScheduleProperties struct { + // Status - The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' + Status EnableStatus `json:"status,omitempty"` + // TaskType - The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + TaskType *string `json:"taskType,omitempty"` + // WeeklyRecurrence - If the schedule will occur only some days of the week, specify the weekly recurrence. + WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` + // DailyRecurrence - If the schedule will occur once each day of the week, specify the daily recurrence. + DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` + // HourlyRecurrence - If the schedule will occur multiple times a day, specify the hourly recurrence. + HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` + // TimeZoneID - The time zone ID (e.g. Pacific Standard time). + TimeZoneID *string `json:"timeZoneId,omitempty"` + // NotificationSettings - Notification settings. + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + // CreatedDate - The creation date of the schedule. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // TargetResourceID - The resource ID to which the schedule belongs + TargetResourceID *string `json:"targetResourceId,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// SchedulePropertiesFragment properties of a schedule. +type SchedulePropertiesFragment struct { + // Status - The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' + Status EnableStatus `json:"status,omitempty"` + // TaskType - The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + TaskType *string `json:"taskType,omitempty"` + // WeeklyRecurrence - If the schedule will occur only some days of the week, specify the weekly recurrence. + WeeklyRecurrence *WeekDetailsFragment `json:"weeklyRecurrence,omitempty"` + // DailyRecurrence - If the schedule will occur once each day of the week, specify the daily recurrence. + DailyRecurrence *DayDetailsFragment `json:"dailyRecurrence,omitempty"` + // HourlyRecurrence - If the schedule will occur multiple times a day, specify the hourly recurrence. + HourlyRecurrence *HourDetailsFragment `json:"hourlyRecurrence,omitempty"` + // TimeZoneID - The time zone ID (e.g. Pacific Standard time). + TimeZoneID *string `json:"timeZoneId,omitempty"` + // NotificationSettings - Notification settings. + NotificationSettings *NotificationSettingsFragment `json:"notificationSettings,omitempty"` + // TargetResourceID - The resource ID to which the schedule belongs + TargetResourceID *string `json:"targetResourceId,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// SchedulesExecuteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type SchedulesExecuteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SchedulesExecuteFuture) Result(client SchedulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesExecuteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.SchedulesExecuteFuture") + return + } + ar.Response = future.Response() + return +} + +// Secret a secret. +type Secret struct { + autorest.Response `json:"-"` + // SecretProperties - The properties of the resource. + *SecretProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Secret. +func (s Secret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SecretProperties != nil { + objectMap["properties"] = s.SecretProperties + } + if s.ID != nil { + objectMap["id"] = s.ID + } + if s.Name != nil { + objectMap["name"] = s.Name + } + if s.Type != nil { + objectMap["type"] = s.Type + } + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Secret struct. +func (s *Secret) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var secretProperties SecretProperties + err = json.Unmarshal(*v, &secretProperties) + if err != nil { + return err + } + s.SecretProperties = &secretProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + } + } + + return nil +} + +// SecretProperties properties of a secret. +type SecretProperties struct { + // Value - The value of the secret for secret creation. + Value *string `json:"value,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// ServiceRunner a container for a managed identity to execute DevTest lab services. +type ServiceRunner struct { + autorest.Response `json:"-"` + // Identity - The identity of the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ServiceRunner. +func (sr ServiceRunner) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Identity != nil { + objectMap["identity"] = sr.Identity + } + if sr.ID != nil { + objectMap["id"] = sr.ID + } + if sr.Name != nil { + objectMap["name"] = sr.Name + } + if sr.Type != nil { + objectMap["type"] = sr.Type + } + if sr.Location != nil { + objectMap["location"] = sr.Location + } + if sr.Tags != nil { + objectMap["tags"] = sr.Tags + } + return json.Marshal(objectMap) +} + +// SharedPublicIPAddressConfiguration properties of a virtual machine that determine how it is connected to a load +// balancer. +type SharedPublicIPAddressConfiguration struct { + // InboundNatRules - The incoming NAT rules + InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` +} + +// SharedPublicIPAddressConfigurationFragment properties of a virtual machine that determine how it is connected to +// a load balancer. +type SharedPublicIPAddressConfigurationFragment struct { + // InboundNatRules - The incoming NAT rules + InboundNatRules *[]InboundNatRuleFragment `json:"inboundNatRules,omitempty"` +} + +// ShutdownNotificationContent the contents of a shutdown notification. Webhooks can use this type to deserialize +// the request body when they get notified of an imminent shutdown. +type ShutdownNotificationContent struct { + // SkipURL - The URL to skip auto-shutdown. + SkipURL *string `json:"skipUrl,omitempty"` + // DelayURL60 - The URL to delay shutdown by 60 minutes. + DelayURL60 *string `json:"delayUrl60,omitempty"` + // DelayURL120 - The URL to delay shutdown by 2 hours. + DelayURL120 *string `json:"delayUrl120,omitempty"` + // VMName - The virtual machine to be shut down. + VMName *string `json:"vmName,omitempty"` + // GUID - The GUID for the virtual machine to be shut down. + GUID *string `json:"guid,omitempty"` + // Owner - The owner of the virtual machine. + Owner *string `json:"owner,omitempty"` + // EventType - The event for which a notification will be sent. + EventType *string `json:"eventType,omitempty"` + // Text - The text for the notification. + Text *string `json:"text,omitempty"` + // SubscriptionID - The subscription ID for the schedule. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroupName - The resource group name for the schedule. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // LabName - The lab for the schedule. + LabName *string `json:"labName,omitempty"` +} + +// Subnet subnet information. +type Subnet struct { + // ResourceID - The resource ID of the subnet. + ResourceID *string `json:"resourceId,omitempty"` + // LabSubnetName - The name of the subnet as seen in the lab. + LabSubnetName *string `json:"labSubnetName,omitempty"` + // AllowPublicIP - The permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' + AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` +} + +// SubnetFragment subnet information. +type SubnetFragment struct { + // ResourceID - The resource ID of the subnet. + ResourceID *string `json:"resourceId,omitempty"` + // LabSubnetName - The name of the subnet as seen in the lab. + LabSubnetName *string `json:"labSubnetName,omitempty"` + // AllowPublicIP - The permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' + AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` +} + +// SubnetOverride property overrides on a subnet of a virtual network. +type SubnetOverride struct { + // ResourceID - The resource ID of the subnet. + ResourceID *string `json:"resourceId,omitempty"` + // LabSubnetName - The name given to the subnet within the lab. + LabSubnetName *string `json:"labSubnetName,omitempty"` + // UseInVMCreationPermission - Indicates whether this subnet can be used during virtual machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` + // UsePublicIPAddressPermission - Indicates whether public IP addresses can be assigned to virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` + // SharedPublicIPAddressConfiguration - Properties that virtual machines on this subnet will share. + SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` + // VirtualNetworkPoolName - The virtual network pool associated with this subnet. + VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` +} + +// SubnetOverrideFragment property overrides on a subnet of a virtual network. +type SubnetOverrideFragment struct { + // ResourceID - The resource ID of the subnet. + ResourceID *string `json:"resourceId,omitempty"` + // LabSubnetName - The name given to the subnet within the lab. + LabSubnetName *string `json:"labSubnetName,omitempty"` + // UseInVMCreationPermission - Indicates whether this subnet can be used during virtual machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` + // UsePublicIPAddressPermission - Indicates whether public IP addresses can be assigned to virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` + // SharedPublicIPAddressConfiguration - Properties that virtual machines on this subnet will share. + SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` + // VirtualNetworkPoolName - The virtual network pool associated with this subnet. + VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` +} + +// SubnetSharedPublicIPAddressConfiguration configuration for public IP address sharing. +type SubnetSharedPublicIPAddressConfiguration struct { + // AllowedPorts - Backend ports that virtual machines on this subnet are allowed to expose + AllowedPorts *[]Port `json:"allowedPorts,omitempty"` +} + +// SubnetSharedPublicIPAddressConfigurationFragment configuration for public IP address sharing. +type SubnetSharedPublicIPAddressConfigurationFragment struct { + // AllowedPorts - Backend ports that virtual machines on this subnet are allowed to expose + AllowedPorts *[]PortFragment `json:"allowedPorts,omitempty"` +} + +// TargetCostProperties properties of a cost target. +type TargetCostProperties struct { + // Status - Target cost status. Possible values include: 'TargetCostStatusEnabled', 'TargetCostStatusDisabled' + Status TargetCostStatus `json:"status,omitempty"` + // Target - Lab target cost + Target *int32 `json:"target,omitempty"` + // CostThresholds - Cost thresholds. + CostThresholds *[]CostThresholdProperties `json:"costThresholds,omitempty"` + // CycleStartDateTime - Reporting cycle start date. + CycleStartDateTime *date.Time `json:"cycleStartDateTime,omitempty"` + // CycleEndDateTime - Reporting cycle end date. + CycleEndDateTime *date.Time `json:"cycleEndDateTime,omitempty"` + // CycleType - Reporting cycle type. Possible values include: 'CalendarMonth', 'Custom' + CycleType ReportingCycleType `json:"cycleType,omitempty"` +} + +// User profile of a lab user. +type User struct { + autorest.Response `json:"-"` + // UserProperties - The properties of the resource. + *UserProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for User. +func (u User) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.UserProperties != nil { + objectMap["properties"] = u.UserProperties + } + if u.ID != nil { + objectMap["id"] = u.ID + } + if u.Name != nil { + objectMap["name"] = u.Name + } + if u.Type != nil { + objectMap["type"] = u.Type + } + if u.Location != nil { + objectMap["location"] = u.Location + } + if u.Tags != nil { + objectMap["tags"] = u.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for User struct. +func (u *User) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var userProperties UserProperties + err = json.Unmarshal(*v, &userProperties) + if err != nil { + return err + } + u.UserProperties = &userProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + u.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + u.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + u.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + u.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + u.Tags = tags + } + } + } + + return nil +} + +// UserFragment profile of a lab user. +type UserFragment struct { + // UserPropertiesFragment - The properties of the resource. + *UserPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for UserFragment. +func (uf UserFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if uf.UserPropertiesFragment != nil { + objectMap["properties"] = uf.UserPropertiesFragment + } + if uf.ID != nil { + objectMap["id"] = uf.ID + } + if uf.Name != nil { + objectMap["name"] = uf.Name + } + if uf.Type != nil { + objectMap["type"] = uf.Type + } + if uf.Location != nil { + objectMap["location"] = uf.Location + } + if uf.Tags != nil { + objectMap["tags"] = uf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for UserFragment struct. +func (uf *UserFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var userPropertiesFragment UserPropertiesFragment + err = json.Unmarshal(*v, &userPropertiesFragment) + if err != nil { + return err + } + uf.UserPropertiesFragment = &userPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + uf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + uf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + uf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + uf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + uf.Tags = tags + } + } + } + + return nil +} + +// UserIdentity identity attributes of a lab user. +type UserIdentity struct { + // PrincipalName - Set to the principal name / UPN of the client JWT making the request. + PrincipalName *string `json:"principalName,omitempty"` + // PrincipalID - Set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - Set to the tenant ID of the client JWT making the request. + TenantID *string `json:"tenantId,omitempty"` + // ObjectID - Set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. + ObjectID *string `json:"objectId,omitempty"` + // AppID - Set to the app Id of the client JWT making the request. + AppID *string `json:"appId,omitempty"` +} + +// UserIdentityFragment identity attributes of a lab user. +type UserIdentityFragment struct { + // PrincipalName - Set to the principal name / UPN of the client JWT making the request. + PrincipalName *string `json:"principalName,omitempty"` + // PrincipalID - Set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - Set to the tenant ID of the client JWT making the request. + TenantID *string `json:"tenantId,omitempty"` + // ObjectID - Set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. + ObjectID *string `json:"objectId,omitempty"` + // AppID - Set to the app Id of the client JWT making the request. + AppID *string `json:"appId,omitempty"` +} + +// UserProperties properties of a lab user profile. +type UserProperties struct { + // Identity - The identity of the user. + Identity *UserIdentity `json:"identity,omitempty"` + // SecretStore - The secret store of the user. + SecretStore *UserSecretStore `json:"secretStore,omitempty"` + // CreatedDate - The creation date of the user profile. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// UserPropertiesFragment properties of a lab user profile. +type UserPropertiesFragment struct { + // Identity - The identity of the user. + Identity *UserIdentityFragment `json:"identity,omitempty"` + // SecretStore - The secret store of the user. + SecretStore *UserSecretStoreFragment `json:"secretStore,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// UsersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UsersDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *UsersDeleteFuture) Result(client UsersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.UsersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// UserSecretStore properties of a user's secret store. +type UserSecretStore struct { + // KeyVaultURI - The URI of the user's Key vault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + // KeyVaultID - The ID of the user's Key vault. + KeyVaultID *string `json:"keyVaultId,omitempty"` +} + +// UserSecretStoreFragment properties of a user's secret store. +type UserSecretStoreFragment struct { + // KeyVaultURI - The URI of the user's Key vault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + // KeyVaultID - The ID of the user's Key vault. + KeyVaultID *string `json:"keyVaultId,omitempty"` +} + +// VirtualMachinesAddDataDiskFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesAddDataDiskFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesAddDataDiskFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesAddDataDiskFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesAddDataDiskFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesApplyArtifactsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesApplyArtifactsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesApplyArtifactsFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesApplyArtifactsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesApplyArtifactsFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineSchedulesExecuteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachineSchedulesExecuteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineSchedulesExecuteFuture) Result(client VirtualMachineSchedulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesExecuteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachineSchedulesExecuteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesClaimFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type VirtualMachinesClaimFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesClaimFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClaimFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesClaimFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesClient) (lvm LabVirtualMachine, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lvm.Response.Response, err = future.GetResult(sender); err == nil && lvm.Response.Response.StatusCode != http.StatusNoContent { + lvm, err = client.CreateOrUpdateResponder(lvm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesCreateOrUpdateFuture", "Result", lvm.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesDetachDataDiskFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesDetachDataDiskFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesDetachDataDiskFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesDetachDataDiskFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesDetachDataDiskFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type VirtualMachinesStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesStartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type VirtualMachinesStopFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesStopFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesStopFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetwork a virtual network. +type VirtualNetwork struct { + autorest.Response `json:"-"` + // VirtualNetworkProperties - The properties of the resource. + *VirtualNetworkProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetwork. +func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vn.VirtualNetworkProperties != nil { + objectMap["properties"] = vn.VirtualNetworkProperties + } + if vn.ID != nil { + objectMap["id"] = vn.ID + } + if vn.Name != nil { + objectMap["name"] = vn.Name + } + if vn.Type != nil { + objectMap["type"] = vn.Type + } + if vn.Location != nil { + objectMap["location"] = vn.Location + } + if vn.Tags != nil { + objectMap["tags"] = vn.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. +func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkProperties VirtualNetworkProperties + err = json.Unmarshal(*v, &virtualNetworkProperties) + if err != nil { + return err + } + vn.VirtualNetworkProperties = &virtualNetworkProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vn.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vn.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vn.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vn.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vn.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkFragment a virtual network. +type VirtualNetworkFragment struct { + // VirtualNetworkPropertiesFragment - The properties of the resource. + *VirtualNetworkPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkFragment. +func (vnf VirtualNetworkFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnf.VirtualNetworkPropertiesFragment != nil { + objectMap["properties"] = vnf.VirtualNetworkPropertiesFragment + } + if vnf.ID != nil { + objectMap["id"] = vnf.ID + } + if vnf.Name != nil { + objectMap["name"] = vnf.Name + } + if vnf.Type != nil { + objectMap["type"] = vnf.Type + } + if vnf.Location != nil { + objectMap["location"] = vnf.Location + } + if vnf.Tags != nil { + objectMap["tags"] = vnf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkFragment struct. +func (vnf *VirtualNetworkFragment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkPropertiesFragment VirtualNetworkPropertiesFragment + err = json.Unmarshal(*v, &virtualNetworkPropertiesFragment) + if err != nil { + return err + } + vnf.VirtualNetworkPropertiesFragment = &virtualNetworkPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vnf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vnf.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkProperties properties of a virtual network. +type VirtualNetworkProperties struct { + // AllowedSubnets - The allowed subnets of the virtual network. + AllowedSubnets *[]Subnet `json:"allowedSubnets,omitempty"` + // Description - The description of the virtual network. + Description *string `json:"description,omitempty"` + // ExternalProviderResourceID - The Microsoft.Network resource identifier of the virtual network. + ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` + // ExternalSubnets - The external subnet properties. + ExternalSubnets *[]ExternalSubnet `json:"externalSubnets,omitempty"` + // SubnetOverrides - The subnet overrides of the virtual network. + SubnetOverrides *[]SubnetOverride `json:"subnetOverrides,omitempty"` + // CreatedDate - The creation date of the virtual network. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// VirtualNetworkPropertiesFragment properties of a virtual network. +type VirtualNetworkPropertiesFragment struct { + // AllowedSubnets - The allowed subnets of the virtual network. + AllowedSubnets *[]SubnetFragment `json:"allowedSubnets,omitempty"` + // Description - The description of the virtual network. + Description *string `json:"description,omitempty"` + // ExternalProviderResourceID - The Microsoft.Network resource identifier of the virtual network. + ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` + // ExternalSubnets - The external subnet properties. + ExternalSubnets *[]ExternalSubnetFragment `json:"externalSubnets,omitempty"` + // SubnetOverrides - The subnet overrides of the virtual network. + SubnetOverrides *[]SubnetOverrideFragment `json:"subnetOverrides,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// VirtualNetworksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualNetworksCreateOrUpdateFuture struct { + azure.Future +} + +// 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) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualNetworksCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { + vn, err = client.CreateOrUpdateResponder(vn.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualNetworksDeleteFuture struct { + azure.Future +} + +// 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) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("dtl.VirtualNetworksDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WeekDetails properties of a weekly schedule. +type WeekDetails struct { + // Weekdays - The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + Weekdays *[]string `json:"weekdays,omitempty"` + // Time - The time of the day the schedule will occur. + Time *string `json:"time,omitempty"` +} + +// WeekDetailsFragment properties of a weekly schedule. +type WeekDetailsFragment struct { + // Weekdays - The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + Weekdays *[]string `json:"weekdays,omitempty"` + // Time - The time of the day the schedule will occur. + Time *string `json:"time,omitempty"` +} + +// WindowsOsInfo information about a Windows OS. +type WindowsOsInfo struct { + // WindowsOsState - The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). Possible values include: 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' + WindowsOsState WindowsOsState `json:"windowsOsState,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/notificationchannels.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/notificationchannels.go new file mode 100644 index 000000000000..00d689f3a33d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/notificationchannels.go @@ -0,0 +1,514 @@ +package dtl + +// 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" +) + +// NotificationChannelsClient is the the DevTest Labs Client. +type NotificationChannelsClient struct { + BaseClient +} + +// NewNotificationChannelsClient creates an instance of the NotificationChannelsClient client. +func NewNotificationChannelsClient(subscriptionID string) NotificationChannelsClient { + return NewNotificationChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNotificationChannelsClientWithBaseURI creates an instance of the NotificationChannelsClient client. +func NewNotificationChannelsClientWithBaseURI(baseURI string, subscriptionID string) NotificationChannelsClient { + return NotificationChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing notificationChannel. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the notificationChannel. +// notificationChannel - a notification. +func (client NotificationChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (result NotificationChannel, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: notificationChannel, + Constraints: []validation.Constraint{{Target: "notificationChannel.NotificationChannelProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.NotificationChannelsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, notificationChannel) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NotificationChannelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithJSON(notificationChannel), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 NotificationChannelsClient) CreateOrUpdateResponder(resp *http.Response) (result NotificationChannel, 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 delete notificationchannel. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the notificationChannel. +func (client NotificationChannelsClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NotificationChannelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 NotificationChannelsClient) 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 get notificationchannel. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the notificationChannel. +// expand - specify the $expand query. Example: 'properties($select=webHookUrl)' +func (client NotificationChannelsClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result NotificationChannel, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NotificationChannelsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 NotificationChannelsClient) GetResponder(resp *http.Response) (result NotificationChannel, 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 list notificationchannels in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=webHookUrl)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client NotificationChannelsClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationNotificationChannelPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcnc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "List", resp, "Failure sending request") + return + } + + result.rwcnc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client NotificationChannelsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 NotificationChannelsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationNotificationChannel, 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 NotificationChannelsClient) listNextResults(lastResults ResponseWithContinuationNotificationChannel) (result ResponseWithContinuationNotificationChannel, err error) { + req, err := lastResults.responseWithContinuationNotificationChannelPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client NotificationChannelsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationNotificationChannelIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} + +// Notify send notification to provided channel. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the notificationChannel. +// notifyParameters - properties for generating a Notification. +func (client NotificationChannelsClient) Notify(ctx context.Context, resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (result autorest.Response, err error) { + req, err := client.NotifyPreparer(ctx, resourceGroupName, labName, name, notifyParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Notify", nil, "Failure preparing request") + return + } + + resp, err := client.NotifySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Notify", resp, "Failure sending request") + return + } + + result, err = client.NotifyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Notify", resp, "Failure responding to request") + } + + return +} + +// NotifyPreparer prepares the Notify request. +func (client NotificationChannelsClient) NotifyPreparer(ctx context.Context, resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify", pathParameters), + autorest.WithJSON(notifyParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// NotifySender sends the Notify request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) NotifySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// NotifyResponder handles the response to the Notify request. The method always +// closes the http.Response Body. +func (client NotificationChannelsClient) NotifyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of notificationchannels. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the notificationChannel. +// notificationChannel - a notification. +func (client NotificationChannelsClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (result NotificationChannel, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, notificationChannel) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NotificationChannelsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithJSON(notificationChannel), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 NotificationChannelsClient) UpdateResponder(resp *http.Response) (result NotificationChannel, 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/devtestlabs/mgmt/2016-05-15/dtl/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/operations.go new file mode 100644 index 000000000000..d62f6736ae17 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/operations.go @@ -0,0 +1,107 @@ +package dtl + +// 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 DevTest Labs Client. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get operation. +// Parameters: +// locationName - the name of the location. +// name - the name of the operation. +func (client OperationsClient) Get(ctx context.Context, locationName string, name string) (result OperationResult, err error) { + req, err := client.GetPreparer(ctx, locationName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.OperationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.OperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.OperationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationsClient) GetPreparer(ctx context.Context, locationName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 OperationsClient) GetResponder(resp *http.Response) (result OperationResult, 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/devtestlabs/mgmt/2016-05-15/dtl/policies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/policies.go new file mode 100644 index 000000000000..868bd2e12828 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/policies.go @@ -0,0 +1,453 @@ +package dtl + +// 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" +) + +// PoliciesClient is the the DevTest Labs Client. +type PoliciesClient struct { + BaseClient +} + +// NewPoliciesClient creates an instance of the PoliciesClient client. +func NewPoliciesClient(subscriptionID string) PoliciesClient { + return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient client. +func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { + return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// policySetName - the name of the policy set. +// name - the name of the policy. +// policy - a Policy. +func (client PoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy Policy) (result Policy, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: policy, + Constraints: []validation.Constraint{{Target: "policy.PolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.PoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, policySetName, name, policy) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy Policy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithJSON(policy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result Policy, 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 delete policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// policySetName - the name of the policy set. +// name - the name of the policy. +func (client PoliciesClient) Delete(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, policySetName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 PoliciesClient) 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 get policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// policySetName - the name of the policy set. +// name - the name of the policy. +// expand - specify the $expand query. Example: 'properties($select=description)' +func (client PoliciesClient) Get(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, expand string) (result Policy, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, policySetName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 PoliciesClient) GetResponder(resp *http.Response) (result Policy, 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 list policies in a given policy set. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// policySetName - the name of the policy set. +// expand - specify the $expand query. Example: 'properties($select=description)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client PoliciesClient) List(ctx context.Context, resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationPolicyPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, policySetName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcp.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "List", resp, "Failure sending request") + return + } + + result.rwcp, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 PoliciesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationPolicy, 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 PoliciesClient) listNextResults(lastResults ResponseWithContinuationPolicy) (result ResponseWithContinuationPolicy, err error) { + req, err := lastResults.responseWithContinuationPolicyPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.PoliciesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.PoliciesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoliciesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationPolicyIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, policySetName, expand, filter, top, orderby) + return +} + +// Update modify properties of policies. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// policySetName - the name of the policy set. +// name - the name of the policy. +// policy - a Policy. +func (client PoliciesClient) Update(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (result Policy, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, policySetName, name, policy) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithJSON(policy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 PoliciesClient) UpdateResponder(resp *http.Response) (result Policy, 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/devtestlabs/mgmt/2016-05-15/dtl/policysets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/policysets.go new file mode 100644 index 000000000000..12a8e75030df --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/policysets.go @@ -0,0 +1,112 @@ +package dtl + +// 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" +) + +// PolicySetsClient is the the DevTest Labs Client. +type PolicySetsClient struct { + BaseClient +} + +// NewPolicySetsClient creates an instance of the PolicySetsClient client. +func NewPolicySetsClient(subscriptionID string) PolicySetsClient { + return NewPolicySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPolicySetsClientWithBaseURI creates an instance of the PolicySetsClient client. +func NewPolicySetsClientWithBaseURI(baseURI string, subscriptionID string) PolicySetsClient { + return PolicySetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// EvaluatePolicies evaluates lab policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the policy set. +// evaluatePoliciesRequest - request body for evaluating a policy set. +func (client PolicySetsClient) EvaluatePolicies(ctx context.Context, resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (result EvaluatePoliciesResponse, err error) { + req, err := client.EvaluatePoliciesPreparer(ctx, resourceGroupName, labName, name, evaluatePoliciesRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PolicySetsClient", "EvaluatePolicies", nil, "Failure preparing request") + return + } + + resp, err := client.EvaluatePoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.PolicySetsClient", "EvaluatePolicies", resp, "Failure sending request") + return + } + + result, err = client.EvaluatePoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.PolicySetsClient", "EvaluatePolicies", resp, "Failure responding to request") + } + + return +} + +// EvaluatePoliciesPreparer prepares the EvaluatePolicies request. +func (client PolicySetsClient) EvaluatePoliciesPreparer(ctx context.Context, resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies", pathParameters), + autorest.WithJSON(evaluatePoliciesRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EvaluatePoliciesSender sends the EvaluatePolicies request. The method will close the +// http.Response Body if it receives an error. +func (client PolicySetsClient) EvaluatePoliciesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// EvaluatePoliciesResponder handles the response to the EvaluatePolicies request. The method always +// closes the http.Response Body. +func (client PolicySetsClient) EvaluatePoliciesResponder(resp *http.Response) (result EvaluatePoliciesResponse, err error) { + err = autorest.Respond( + resp, + 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/devtestlabs/mgmt/2016-05-15/dtl/provideroperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/provideroperations.go new file mode 100644 index 000000000000..8d20d3b6e01d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/provideroperations.go @@ -0,0 +1,126 @@ +package dtl + +// 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" +) + +// ProviderOperationsClient is the the DevTest Labs Client. +type ProviderOperationsClient struct { + BaseClient +} + +// NewProviderOperationsClient creates an instance of the ProviderOperationsClient client. +func NewProviderOperationsClient(subscriptionID string) ProviderOperationsClient { + return NewProviderOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProviderOperationsClientWithBaseURI creates an instance of the ProviderOperationsClient client. +func NewProviderOperationsClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsClient { + return ProviderOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List result of the request to list REST API operations +func (client ProviderOperationsClient) List(ctx context.Context) (result ProviderOperationResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.por.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "List", resp, "Failure sending request") + return + } + + result.por, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ProviderOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DevTestLab/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 ProviderOperationsClient) ListResponder(resp *http.Response) (result ProviderOperationResult, 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 ProviderOperationsClient) listNextResults(lastResults ProviderOperationResult) (result ProviderOperationResult, err error) { + req, err := lastResults.providerOperationResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderOperationsClient) ListComplete(ctx context.Context) (result ProviderOperationResultIterator, err error) { + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/schedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/schedules.go new file mode 100644 index 000000000000..4ca911a3cbdc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/schedules.go @@ -0,0 +1,612 @@ +package dtl + +// 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" +) + +// SchedulesClient is the the DevTest Labs Client. +type SchedulesClient struct { + BaseClient +} + +// NewSchedulesClient creates an instance of the SchedulesClient client. +func NewSchedulesClient(subscriptionID string) SchedulesClient { + return NewSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSchedulesClientWithBaseURI creates an instance of the SchedulesClient client. +func NewSchedulesClientWithBaseURI(baseURI string, subscriptionID string) SchedulesClient { + return SchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the schedule. +// schedule - a schedule. +func (client SchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, schedule Schedule) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schedule, + Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.SchedulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 SchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, 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 delete schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the schedule. +func (client SchedulesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 SchedulesClient) 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 +} + +// Execute execute a schedule. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the schedule. +func (client SchedulesClient) Execute(ctx context.Context, resourceGroupName string, labName string, name string) (result SchedulesExecuteFuture, err error) { + req, err := client.ExecutePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + result, err = client.ExecuteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Execute", result.Response(), "Failure sending request") + return + } + + return +} + +// ExecutePreparer prepares the Execute request. +func (client SchedulesClient) ExecutePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSender sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) ExecuteSender(req *http.Request) (future SchedulesExecuteFuture, err error) { + var resp *http.Response + 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 +} + +// ExecuteResponder handles the response to the Execute request. The method always +// closes the http.Response Body. +func (client SchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the schedule. +// expand - specify the $expand query. Example: 'properties($select=status)' +func (client SchedulesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result Schedule, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 SchedulesClient) GetResponder(resp *http.Response) (result Schedule, 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 list schedules in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=status)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client SchedulesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedulePage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcs.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "List", resp, "Failure sending request") + return + } + + result.rwcs, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SchedulesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 SchedulesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSchedule, 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 SchedulesClient) listNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.responseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SchedulesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationScheduleIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} + +// ListApplicable lists all applicable schedules +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the schedule. +func (client SchedulesClient) ListApplicable(ctx context.Context, resourceGroupName string, labName string, name string) (result ResponseWithContinuationSchedulePage, err error) { + result.fn = client.listApplicableNextResults + req, err := client.ListApplicablePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "ListApplicable", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicableSender(req) + if err != nil { + result.rwcs.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "ListApplicable", resp, "Failure sending request") + return + } + + result.rwcs, err = client.ListApplicableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "ListApplicable", resp, "Failure responding to request") + } + + return +} + +// ListApplicablePreparer prepares the ListApplicable request. +func (client SchedulesClient) ListApplicablePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListApplicableSender sends the ListApplicable request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) ListApplicableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListApplicableResponder handles the response to the ListApplicable request. The method always +// closes the http.Response Body. +func (client SchedulesClient) ListApplicableResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listApplicableNextResults retrieves the next set of results, if any. +func (client SchedulesClient) listApplicableNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.responseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listApplicableNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListApplicableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listApplicableNextResults", resp, "Failure sending next results request") + } + result, err = client.ListApplicableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listApplicableNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListApplicableComplete enumerates all values, automatically crossing page boundaries as required. +func (client SchedulesClient) ListApplicableComplete(ctx context.Context, resourceGroupName string, labName string, name string) (result ResponseWithContinuationScheduleIterator, err error) { + result.page, err = client.ListApplicable(ctx, resourceGroupName, labName, name) + return +} + +// Update modify properties of schedules. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the schedule. +// schedule - a schedule. +func (client SchedulesClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, schedule ScheduleFragment) (result Schedule, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SchedulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, schedule ScheduleFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 SchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, 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/devtestlabs/mgmt/2016-05-15/dtl/secrets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/secrets.go new file mode 100644 index 000000000000..2200a20e916f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/secrets.go @@ -0,0 +1,379 @@ +package dtl + +// 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" +) + +// SecretsClient is the the DevTest Labs Client. +type SecretsClient struct { + BaseClient +} + +// NewSecretsClient creates an instance of the SecretsClient client. +func NewSecretsClient(subscriptionID string) SecretsClient { + return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client. +func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { + return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing secret. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the secret. +// secret - a secret. +func (client SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, name string, secret Secret) (result Secret, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: secret, + Constraints: []validation.Constraint{{Target: "secret.SecretProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.SecretsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, name, secret) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecretsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, secret Secret) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), + autorest.WithJSON(secret), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) CreateOrUpdateSender(req *http.Request) (*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 SecretsClient) CreateOrUpdateResponder(resp *http.Response) (result Secret, 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 delete secret. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the secret. +func (client SecretsClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecretsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 SecretsClient) 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 get secret. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// name - the name of the secret. +// expand - specify the $expand query. Example: 'properties($select=value)' +func (client SecretsClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (result Secret, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecretsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 SecretsClient) GetResponder(resp *http.Response) (result Secret, 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 list secrets in a given user profile. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// userName - the name of the user profile. +// expand - specify the $expand query. Example: 'properties($select=value)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client SecretsClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSecretPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcs.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "List", resp, "Failure sending request") + return + } + + result.rwcs, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SecretsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 SecretsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSecret, 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 SecretsClient) listNextResults(lastResults ResponseWithContinuationSecret) (result ResponseWithContinuationSecret, err error) { + req, err := lastResults.responseWithContinuationSecretPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.SecretsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.SecretsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecretsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSecretIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/servicerunners.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/servicerunners.go new file mode 100644 index 000000000000..657d0229bfe3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/servicerunners.go @@ -0,0 +1,356 @@ +package dtl + +// 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" +) + +// ServiceRunnersClient is the the DevTest Labs Client. +type ServiceRunnersClient struct { + BaseClient +} + +// NewServiceRunnersClient creates an instance of the ServiceRunnersClient client. +func NewServiceRunnersClient(subscriptionID string) ServiceRunnersClient { + return NewServiceRunnersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceRunnersClientWithBaseURI creates an instance of the ServiceRunnersClient client. +func NewServiceRunnersClientWithBaseURI(baseURI string, subscriptionID string) ServiceRunnersClient { + return ServiceRunnersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing Service runner. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the service runner. +// serviceRunner - a container for a managed identity to execute DevTest lab services. +func (client ServiceRunnersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (result ServiceRunner, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, serviceRunner) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceRunnersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), + autorest.WithJSON(serviceRunner), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRunnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 ServiceRunnersClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceRunner, 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 delete service runner. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the service runner. +func (client ServiceRunnersClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServiceRunnersClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRunnersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 ServiceRunnersClient) 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 get service runner. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the service runner. +func (client ServiceRunnersClient) Get(ctx context.Context, resourceGroupName string, labName string, name string) (result ServiceRunner, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceRunnersClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRunnersClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 ServiceRunnersClient) GetResponder(resp *http.Response) (result ServiceRunner, 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 list service runners in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client ServiceRunnersClient) List(ctx context.Context, resourceGroupName string, labName string, filter string, top *int32, orderby string) (result ResponseWithContinuationServiceRunnerPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "List", resp, "Failure sending request") + return + } + + result.rwcsr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceRunnersClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners", 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 ServiceRunnersClient) 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 ServiceRunnersClient) ListResponder(resp *http.Response) (result ResponseWithContinuationServiceRunner, 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 ServiceRunnersClient) listNextResults(lastResults ResponseWithContinuationServiceRunner) (result ResponseWithContinuationServiceRunner, err error) { + req, err := lastResults.responseWithContinuationServiceRunnerPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServiceRunnersClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, filter string, top *int32, orderby string) (result ResponseWithContinuationServiceRunnerIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, filter, top, orderby) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/users.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/users.go new file mode 100644 index 000000000000..d15cba9c6179 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/users.go @@ -0,0 +1,440 @@ +package dtl + +// 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" +) + +// UsersClient is the the DevTest Labs Client. +type UsersClient struct { + BaseClient +} + +// NewUsersClient creates an instance of the UsersClient client. +func NewUsersClient(subscriptionID string) UsersClient { + return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsersClientWithBaseURI creates an instance of the UsersClient client. +func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { + return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing user profile. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the user profile. +// userParameter - profile of a lab user. +func (client UsersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, userParameter User) (result User, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, userParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UsersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, userParameter User) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithJSON(userParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) CreateOrUpdateSender(req *http.Request) (*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 UsersClient) CreateOrUpdateResponder(resp *http.Response) (result User, 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 delete user profile. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the user profile. +func (client UsersClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result UsersDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UsersClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) DeleteSender(req *http.Request) (future UsersDeleteFuture, err error) { + var resp *http.Response + 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 UsersClient) 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 get user profile. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the user profile. +// expand - specify the $expand query. Example: 'properties($select=identity)' +func (client UsersClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result User, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client UsersClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 UsersClient) GetResponder(resp *http.Response) (result User, 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 list user profiles in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=identity)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client UsersClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationUserPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcu.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "List", resp, "Failure sending request") + return + } + + result.rwcu, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsersClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 UsersClient) ListResponder(resp *http.Response) (result ResponseWithContinuationUser, 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 UsersClient) listNextResults(lastResults ResponseWithContinuationUser) (result ResponseWithContinuationUser, err error) { + req, err := lastResults.responseWithContinuationUserPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.UsersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.UsersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsersClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationUserIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} + +// Update modify properties of user profiles. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the user profile. +// userParameter - profile of a lab user. +func (client UsersClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, userParameter UserFragment) (result User, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, userParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client UsersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, userParameter UserFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithJSON(userParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 UsersClient) UpdateResponder(resp *http.Response) (result User, 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/devtestlabs/mgmt/2016-05-15/dtl/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/version.go new file mode 100644 index 000000000000..09570bcfd3a8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/version.go @@ -0,0 +1,30 @@ +package dtl + +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 + " dtl/2016-05-15" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualmachines.go new file mode 100644 index 000000000000..25468038e0c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualmachines.go @@ -0,0 +1,972 @@ +package dtl + +// 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" +) + +// VirtualMachinesClient is the the DevTest Labs Client. +type VirtualMachinesClient struct { + BaseClient +} + +// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { + return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { + return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddDataDisk attach a new or existing data disk to virtual machine. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +// dataDiskProperties - request body for adding a new or existing data disk to a virtual machine. +func (client VirtualMachinesClient) AddDataDisk(ctx context.Context, resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties) (result VirtualMachinesAddDataDiskFuture, err error) { + req, err := client.AddDataDiskPreparer(ctx, resourceGroupName, labName, name, dataDiskProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "AddDataDisk", nil, "Failure preparing request") + return + } + + result, err = client.AddDataDiskSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "AddDataDisk", result.Response(), "Failure sending request") + return + } + + return +} + +// AddDataDiskPreparer prepares the AddDataDisk request. +func (client VirtualMachinesClient) AddDataDiskPreparer(ctx context.Context, resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk", pathParameters), + autorest.WithJSON(dataDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddDataDiskSender sends the AddDataDisk request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) AddDataDiskSender(req *http.Request) (future VirtualMachinesAddDataDiskFuture, err error) { + var resp *http.Response + 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 +} + +// AddDataDiskResponder handles the response to the AddDataDisk request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) AddDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ApplyArtifacts apply artifacts to virtual machine. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +// applyArtifactsRequest - request body for applying artifacts to a virtual machine. +func (client VirtualMachinesClient) ApplyArtifacts(ctx context.Context, resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest) (result VirtualMachinesApplyArtifactsFuture, err error) { + req, err := client.ApplyArtifactsPreparer(ctx, resourceGroupName, labName, name, applyArtifactsRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ApplyArtifacts", nil, "Failure preparing request") + return + } + + result, err = client.ApplyArtifactsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ApplyArtifacts", result.Response(), "Failure sending request") + return + } + + return +} + +// ApplyArtifactsPreparer prepares the ApplyArtifacts request. +func (client VirtualMachinesClient) ApplyArtifactsPreparer(ctx context.Context, resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts", pathParameters), + autorest.WithJSON(applyArtifactsRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApplyArtifactsSender sends the ApplyArtifacts request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ApplyArtifactsSender(req *http.Request) (future VirtualMachinesApplyArtifactsFuture, err error) { + var resp *http.Response + 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 +} + +// ApplyArtifactsResponder handles the response to the ApplyArtifacts request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ApplyArtifactsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Claim take ownership of an existing virtual machine This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +func (client VirtualMachinesClient) Claim(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesClaimFuture, err error) { + req, err := client.ClaimPreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Claim", nil, "Failure preparing request") + return + } + + result, err = client.ClaimSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Claim", result.Response(), "Failure sending request") + return + } + + return +} + +// ClaimPreparer prepares the Claim request. +func (client VirtualMachinesClient) ClaimPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClaimSender sends the Claim request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ClaimSender(req *http.Request) (future VirtualMachinesClaimFuture, err error) { + var resp *http.Response + 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 +} + +// ClaimResponder handles the response to the Claim request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ClaimResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing Virtual machine. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +// labVirtualMachine - a virtual machine. +func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine) (result VirtualMachinesCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: labVirtualMachine, + Constraints: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("dtl.VirtualMachinesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, labVirtualMachine) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithJSON(labVirtualMachine), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachinesCreateOrUpdateFuture, err error) { + var resp *http.Response + 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 VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result LabVirtualMachine, 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 delete virtual machine. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +func (client VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DeleteSender(req *http.Request) (future VirtualMachinesDeleteFuture, err error) { + var resp *http.Response + 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 VirtualMachinesClient) 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 +} + +// DetachDataDisk detach the specified disk from the virtual machine. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +// detachDataDiskProperties - request body for detaching data disk from a virtual machine. +func (client VirtualMachinesClient) DetachDataDisk(ctx context.Context, resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties) (result VirtualMachinesDetachDataDiskFuture, err error) { + req, err := client.DetachDataDiskPreparer(ctx, resourceGroupName, labName, name, detachDataDiskProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "DetachDataDisk", nil, "Failure preparing request") + return + } + + result, err = client.DetachDataDiskSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "DetachDataDisk", result.Response(), "Failure sending request") + return + } + + return +} + +// DetachDataDiskPreparer prepares the DetachDataDisk request. +func (client VirtualMachinesClient) DetachDataDiskPreparer(ctx context.Context, resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk", pathParameters), + autorest.WithJSON(detachDataDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachDataDiskSender sends the DetachDataDisk request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DetachDataDiskSender(req *http.Request) (future VirtualMachinesDetachDataDiskFuture, err error) { + var resp *http.Response + 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 +} + +// DetachDataDiskResponder handles the response to the DetachDataDisk request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) DetachDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +// expand - specify the $expand query. Example: +// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' +func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result LabVirtualMachine, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachinesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachinesClient) GetResponder(resp *http.Response) (result LabVirtualMachine, 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 list virtual machines in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: +// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client VirtualMachinesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabVirtualMachinePage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwclvm.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "List", resp, "Failure sending request") + return + } + + result.rwclvm, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachinesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachinesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationLabVirtualMachine, 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 VirtualMachinesClient) listNextResults(lastResults ResponseWithContinuationLabVirtualMachine) (result ResponseWithContinuationLabVirtualMachine, err error) { + req, err := lastResults.responseWithContinuationLabVirtualMachinePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachinesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabVirtualMachineIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} + +// ListApplicableSchedules lists all applicable schedules +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +func (client VirtualMachinesClient) ListApplicableSchedules(ctx context.Context, resourceGroupName string, labName string, name string) (result ApplicableSchedule, err error) { + req, err := client.ListApplicableSchedulesPreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ListApplicableSchedules", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicableSchedulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure sending request") + return + } + + result, err = client.ListApplicableSchedulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure responding to request") + } + + return +} + +// ListApplicableSchedulesPreparer prepares the ListApplicableSchedules request. +func (client VirtualMachinesClient) ListApplicableSchedulesPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListApplicableSchedulesSender sends the ListApplicableSchedules request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListApplicableSchedulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListApplicableSchedulesResponder handles the response to the ListApplicableSchedules request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListApplicableSchedulesResponder(resp *http.Response) (result ApplicableSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start start a virtual machine. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +func (client VirtualMachinesClient) Start(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesStartFuture, err error) { + req, err := client.StartPreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client VirtualMachinesClient) StartPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) StartSender(req *http.Request) (future VirtualMachinesStartFuture, err error) { + var resp *http.Response + 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 VirtualMachinesClient) 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 stop a virtual machine This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +func (client VirtualMachinesClient) Stop(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesStopFuture, err error) { + req, err := client.StopPreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client VirtualMachinesClient) StopPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) StopSender(req *http.Request) (future VirtualMachinesStopFuture, err error) { + var resp *http.Response + 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 VirtualMachinesClient) 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 +} + +// Update modify properties of virtual machines. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual machine. +// labVirtualMachine - a virtual machine. +func (client VirtualMachinesClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (result LabVirtualMachine, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, labVirtualMachine) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachinesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithJSON(labVirtualMachine), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachinesClient) UpdateResponder(resp *http.Response) (result LabVirtualMachine, 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/devtestlabs/mgmt/2016-05-15/dtl/virtualmachineschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualmachineschedules.go new file mode 100644 index 000000000000..c6799a34be92 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualmachineschedules.go @@ -0,0 +1,527 @@ +package dtl + +// 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" +) + +// VirtualMachineSchedulesClient is the the DevTest Labs Client. +type VirtualMachineSchedulesClient struct { + BaseClient +} + +// NewVirtualMachineSchedulesClient creates an instance of the VirtualMachineSchedulesClient client. +func NewVirtualMachineSchedulesClient(subscriptionID string) VirtualMachineSchedulesClient { + return NewVirtualMachineSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineSchedulesClientWithBaseURI creates an instance of the VirtualMachineSchedulesClient client. +func NewVirtualMachineSchedulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSchedulesClient { + return VirtualMachineSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// virtualMachineName - the name of the virtual machine. +// name - the name of the schedule. +// schedule - a schedule. +func (client VirtualMachineSchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schedule, + Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, virtualMachineName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineSchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachineSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, 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 delete schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// virtualMachineName - the name of the virtual machine. +// name - the name of the schedule. +func (client VirtualMachineSchedulesClient) Delete(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, virtualMachineName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineSchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachineSchedulesClient) 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 +} + +// Execute execute a schedule. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// virtualMachineName - the name of the virtual machine. +// name - the name of the schedule. +func (client VirtualMachineSchedulesClient) Execute(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (result VirtualMachineSchedulesExecuteFuture, err error) { + req, err := client.ExecutePreparer(ctx, resourceGroupName, labName, virtualMachineName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + result, err = client.ExecuteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Execute", result.Response(), "Failure sending request") + return + } + + return +} + +// ExecutePreparer prepares the Execute request. +func (client VirtualMachineSchedulesClient) ExecutePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSender sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) ExecuteSender(req *http.Request) (future VirtualMachineSchedulesExecuteFuture, err error) { + var resp *http.Response + 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 +} + +// ExecuteResponder handles the response to the Execute request. The method always +// closes the http.Response Body. +func (client VirtualMachineSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get schedule. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// virtualMachineName - the name of the virtual machine. +// name - the name of the schedule. +// expand - specify the $expand query. Example: 'properties($select=status)' +func (client VirtualMachineSchedulesClient) Get(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (result Schedule, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, virtualMachineName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineSchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachineSchedulesClient) GetResponder(resp *http.Response) (result Schedule, 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 list schedules in a given virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// virtualMachineName - the name of the virtual machine. +// expand - specify the $expand query. Example: 'properties($select=status)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client VirtualMachineSchedulesClient) List(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedulePage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcs.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "List", resp, "Failure sending request") + return + } + + result.rwcs, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineSchedulesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachineSchedulesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSchedule, 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 VirtualMachineSchedulesClient) listNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.responseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineSchedulesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationScheduleIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby) + return +} + +// Update modify properties of schedules. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// virtualMachineName - the name of the virtual machine. +// name - the name of the schedule. +// schedule - a schedule. +func (client VirtualMachineSchedulesClient) Update(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (result Schedule, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, virtualMachineName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachineSchedulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 VirtualMachineSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, 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/devtestlabs/mgmt/2016-05-15/dtl/virtualnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualnetworks.go new file mode 100644 index 000000000000..f0af59dfae8f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl/virtualnetworks.go @@ -0,0 +1,444 @@ +package dtl + +// 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" +) + +// VirtualNetworksClient is the the DevTest Labs Client. +type VirtualNetworksClient struct { + BaseClient +} + +// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client. +func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { + return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworksClientWithBaseURI creates an instance of the VirtualNetworksClient client. +func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { + return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing virtual network. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual network. +// virtualNetwork - a virtual network. +func (client VirtualNetworksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork) (result VirtualNetworksCreateOrUpdateFuture, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, virtualNetwork) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithJSON(virtualNetwork), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) { + var resp *http.Response + 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 VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, 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 delete virtual network. This operation can take a while to complete. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual network. +func (client VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualNetworksDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) { + var resp *http.Response + 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 VirtualNetworksClient) 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 get virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual network. +// expand - specify the $expand query. Example: 'properties($expand=externalSubnets)' +func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result VirtualNetwork, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + return 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 VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, 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 list virtual networks in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($expand=externalSubnets)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client VirtualNetworksClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationVirtualNetworkPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcvn.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "List", resp, "Failure sending request") + return + } + + result.rwcvn, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 VirtualNetworksClient) ListResponder(resp *http.Response) (result ResponseWithContinuationVirtualNetwork, 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 VirtualNetworksClient) listNextResults(lastResults ResponseWithContinuationVirtualNetwork) (result ResponseWithContinuationVirtualNetwork, err error) { + req, err := lastResults.responseWithContinuationVirtualNetworkPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationVirtualNetworkIterator, err error) { + result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) + return +} + +// Update modify properties of virtual networks. +// Parameters: +// resourceGroupName - the name of the resource group. +// labName - the name of the lab. +// name - the name of the virtual network. +// virtualNetwork - a virtual network. +func (client VirtualNetworksClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (result VirtualNetwork, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, virtualNetwork) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualNetworksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithJSON(virtualNetwork), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return 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 VirtualNetworksClient) UpdateResponder(resp *http.Response) (result VirtualNetwork, 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/vendor.json b/vendor/vendor.json index 891fc7f11c8c..c8d7b2132bbf 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -90,6 +90,14 @@ "version": "v20.1.0", "versionExact": "v20.1.0" }, + { + "checksumSHA1": "eScauiDOG7qx2IieGVacFNMaviE=", + "path": "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl", + "revision": "2935c0241c74bd8549b843978dd6fc1be6f48b4a", + "revisionTime": "2018-08-31T14:25:13Z", + "version": "v20.1.0", + "versionExact": "v20.1.0" + }, { "checksumSHA1": "mdwBbEgubHb6UnwDspop+43Sx8k=", "path": "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid", diff --git a/website/azurerm.erb b/website/azurerm.erb index de3fa211570f..653c6839100f 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -84,6 +84,10 @@ azurerm_data_lake_store + > + azurerm_dev_test_lab + + > azurerm_eventhub_namespace @@ -491,6 +495,21 @@ + > + Dev Test Resources + + + > DNS Resources