From 16028d98b41257b7c614896e714c4b5a7333c805 Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Thu, 21 Mar 2019 16:06:43 +0100 Subject: [PATCH 1/7] Add resource_file to batch pool start_task --- azurerm/config.go | 2 +- azurerm/data_source_batch_account.go | 2 +- azurerm/data_source_batch_pool.go | 33 + azurerm/helpers/azure/batch_pool.go | 62 +- azurerm/resource_arm_batch_account.go | 2 +- azurerm/resource_arm_batch_pool.go | 85 ++- azurerm/resource_arm_batch_pool_test.go | 307 ++++++++- go.mod | 3 + go.sum | 7 +- .../batch/account.go | 18 +- .../batch/application.go | 97 +-- .../batch/applicationpackage.go | 264 ++++++-- .../batch/certificate.go | 12 +- .../batch/client.go | 2 +- .../batch/location.go | 4 +- .../batch/models.go | 590 ++++++++++++++---- .../batch/operations.go | 2 +- .../{2017-09-01 => 2018-12-01}/batch/pool.go | 25 +- .../batch/version.go | 2 +- vendor/modules.txt | 4 +- website/docs/d/batch_pool.html.markdown | 18 + website/docs/r/batch_pool.html.markdown | 20 + 22 files changed, 1326 insertions(+), 235 deletions(-) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/account.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/application.go (82%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/applicationpackage.go (54%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/certificate.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/client.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/location.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/models.go (81%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/operations.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/pool.go (96%) rename vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/{2017-09-01 => 2018-12-01}/batch/version.go (94%) diff --git a/azurerm/config.go b/azurerm/config.go index 7b00a91f1c34..627977c2ffca 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -13,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement" appinsights "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch" "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn" "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute" diff --git a/azurerm/data_source_batch_account.go b/azurerm/data_source_batch_account.go index 45491b9ffd6b..fb0b76e9995d 100644 --- a/azurerm/data_source_batch_account.go +++ b/azurerm/data_source_batch_account.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) diff --git a/azurerm/data_source_batch_pool.go b/azurerm/data_source_batch_pool.go index cb3f7d1448b6..1577b0e3d7a1 100644 --- a/azurerm/data_source_batch_pool.go +++ b/azurerm/data_source_batch_pool.go @@ -199,6 +199,39 @@ func dataSourceArmBatchPool() *schema.Resource { }, }, }, + + "resource_file": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_storage_container_name": { + Type: schema.TypeString, + Computed: true, + }, + "blob_prefix": { + Type: schema.TypeString, + Computed: true, + }, + "file_mode": { + Type: schema.TypeString, + Computed: true, + }, + "file_path": { + Type: schema.TypeString, + Computed: true, + }, + "http_url": { + Type: schema.TypeString, + Computed: true, + }, + "storage_container_url": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, }, }, }, diff --git a/azurerm/helpers/azure/batch_pool.go b/azurerm/helpers/azure/batch_pool.go index ee8031be0ba2..489de0b869a9 100644 --- a/azurerm/helpers/azure/batch_pool.go +++ b/azurerm/helpers/azure/batch_pool.go @@ -5,7 +5,7 @@ import ( "log" "regexp" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch" "github.com/hashicorp/terraform/helper/schema" ) @@ -124,6 +124,20 @@ func FlattenBatchPoolStartTask(startTask *batch.StartTask) []interface{} { result["user_identity"] = []interface{}{userIdentity} } + resourceFiles := make([]interface{}, 0) + if startTask.ResourceFiles != nil { + for _, armResourceFile := range *startTask.ResourceFiles { + resourceFile := make(map[string]interface{}) + resourceFile["auto_storage_container_name"] = armResourceFile.AutoStorageContainerName + resourceFile["storage_container_url"] = armResourceFile.StorageContainerURL + resourceFile["http_url"] = armResourceFile.HTTPURL + resourceFile["blob_prefix"] = armResourceFile.BlobPrefix + resourceFile["file_path"] = armResourceFile.FilePath + resourceFile["file_mode"] = armResourceFile.FileMode + resourceFiles = append(resourceFiles, resourceFile) + } + } + if startTask.EnvironmentSettings != nil { environment := make(map[string]interface{}) for _, envSetting := range *startTask.EnvironmentSettings { @@ -132,6 +146,7 @@ func FlattenBatchPoolStartTask(startTask *batch.StartTask) []interface{} { result["environment"] = environment } + result["resource_file"] = resourceFiles return append(results, result) } @@ -264,11 +279,56 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { return nil, fmt.Errorf("Error: either auto_user or user_name should be speicfied for Batch pool start task") } + resourceFileList := startTaskValue["resource_file"].([]interface{}) + resourceFiles := make([]batch.ResourceFile, 0) + for _, resourceFileValueTemp := range resourceFileList { + resourceFileValue := resourceFileValueTemp.(map[string]interface{}) + resourceFile := batch.ResourceFile{} + if autoStorageContainerNameValue, ok := resourceFileValue["auto_storage_container_name"]; ok { + autoStorageContainerName := autoStorageContainerNameValue.(string) + if autoStorageContainerName != "" { + resourceFile.AutoStorageContainerName = &autoStorageContainerName + } + } + if storageContainerURLValue, ok := resourceFileValue["storage_container_url"]; ok { + storageContainerURL := storageContainerURLValue.(string) + if storageContainerURL != "" { + resourceFile.StorageContainerURL = &storageContainerURL + } + } + if httpURLValue, ok := resourceFileValue["http_url"]; ok { + httpURL := httpURLValue.(string) + if httpURL != "" { + resourceFile.HTTPURL = &httpURL + } + } + if blobPrefixValue, ok := resourceFileValue["blob_prefix"]; ok { + blobPrefix := blobPrefixValue.(string) + if blobPrefix != "" { + resourceFile.BlobPrefix = &blobPrefix + } + } + if filePathValue, ok := resourceFileValue["file_path"]; ok { + filePath := filePathValue.(string) + if filePath != "" { + resourceFile.FilePath = &filePath + } + } + if fileModeValue, ok := resourceFileValue["file_mode"]; ok { + fileMode := fileModeValue.(string) + if fileMode != "" { + resourceFile.FileMode = &fileMode + } + } + resourceFiles = append(resourceFiles, resourceFile) + } + startTask := &batch.StartTask{ CommandLine: &startTaskCmdLine, MaxTaskRetryCount: &maxTaskRetryCount, WaitForSuccess: &waitForSuccess, UserIdentity: &userIdentity, + ResourceFiles: &resourceFiles, } // populate environment settings, if defined diff --git a/azurerm/resource_arm_batch_account.go b/azurerm/resource_arm_batch_account.go index 8eb7e547ca92..0c7425b4522c 100644 --- a/azurerm/resource_arm_batch_account.go +++ b/azurerm/resource_arm_batch_account.go @@ -5,7 +5,7 @@ import ( "log" "regexp" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" diff --git a/azurerm/resource_arm_batch_pool.go b/azurerm/resource_arm_batch_pool.go index e20d0237aadd..16d79d4dfa81 100644 --- a/azurerm/resource_arm_batch_pool.go +++ b/azurerm/resource_arm_batch_pool.go @@ -12,7 +12,7 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" @@ -275,6 +275,41 @@ func resourceArmBatchPool() *schema.Resource { }, }, }, + + "resource_file": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_storage_container_name": { + Type: schema.TypeString, + Optional: true, + // TODO ValidateFunc - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. + // TODO - for docs: https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#resourcefile + }, + "blob_prefix": { + Type: schema.TypeString, + Optional: true, + }, + "file_mode": { + Type: schema.TypeString, + Optional: true, + }, + "file_path": { + Type: schema.TypeString, + Optional: true, + }, + "http_url": { + Type: schema.TypeString, + Optional: true, + }, + "storage_container_url": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, }, }, }, @@ -362,6 +397,10 @@ func resourceArmBatchPoolCreate(d *schema.ResourceData, meta interface{}) error } parameters.PoolProperties.Certificates = certificateReferences + if err := validateCrossFieldRules(¶meters); err != nil { + return err + } + future, err := client.Create(ctx, resourceGroup, accountName, poolName, parameters, "", "") if err != nil { return fmt.Errorf("Error creating Batch pool %q (Resource Group %q): %+v", poolName, resourceGroup, err) @@ -461,6 +500,10 @@ func resourceArmBatchPoolUpdate(d *schema.ResourceData, meta interface{}) error } parameters.PoolProperties.Certificates = certificateReferences + if err := validateCrossFieldRules(¶meters); err != nil { + return err + } + result, err := client.Update(ctx, resourceGroup, accountName, poolName, parameters, "") if err != nil { return fmt.Errorf("Error updating Batch pool %q (Resource Group %q): %+v", poolName, resourceGroup, err) @@ -643,3 +686,43 @@ func validateUserIdentity(userIdentity *batch.UserIdentity) error { return nil } + +func validateCrossFieldRules(pool *batch.Pool) error { + // Perform validation across multiple fields as per https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#resourcefile + + if pool.StartTask != nil { + startTask := *pool.StartTask + if startTask.ResourceFiles != nil { + for _, referenceFile := range *startTask.ResourceFiles { + // Must specify exactly one of AutoStorageContainerName, StorageContainerUrl or HttpUrl + sourceCount := 0 + if referenceFile.AutoStorageContainerName != nil { + sourceCount++ + } + if referenceFile.StorageContainerURL != nil { + sourceCount++ + } + if referenceFile.HTTPURL != nil { + sourceCount++ + } + if sourceCount != 1 { + return fmt.Errorf("Exactly one of auto_storage_container_name, storage_container_url and http_url must be specified") + } + + if referenceFile.BlobPrefix != nil { + if referenceFile.AutoStorageContainerName == nil && referenceFile.StorageContainerURL == nil { + return fmt.Errorf("auto_storage_container_name or storage_container_url must be specified when using blob_prefix") + } + } + + if referenceFile.HTTPURL != nil { + if referenceFile.FilePath == nil { + return fmt.Errorf("file_path must be specified when using http_url") + } + } + } + } + } + + return nil +} diff --git a/azurerm/resource_arm_batch_pool_test.go b/azurerm/resource_arm_batch_pool_test.go index 9c956b528f51..14c0a7a2e3ae 100644 --- a/azurerm/resource_arm_batch_pool_test.go +++ b/azurerm/resource_arm_batch_pool_test.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" "os" + "regexp" "testing" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" @@ -278,6 +279,74 @@ func TestAccAzureRMBatchPoolCertificates(t *testing.T) { }) } +func TestAccAzureRMBatchPoolValidateResourceFileWithoutSource(t *testing.T) { + ri := tf.AccRandTimeInt() + rs := acctest.RandString(4) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBatchPoolDestroy, + Steps: []resource.TestStep{ + { + Config: testaccAzureRMBatchPoolValidateResourceFileWithoutSource(ri, rs, testLocation()), + ExpectError: regexp.MustCompile("Exactly one of auto_storage_container_name, storage_container_url and http_url must be specified"), + }, + }, + }) +} + +func TestAccAzureRMBatchPoolValidateResourceFileWithMultipleSources(t *testing.T) { + ri := tf.AccRandTimeInt() + rs := acctest.RandString(4) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBatchPoolDestroy, + Steps: []resource.TestStep{ + { + Config: testaccAzureRMBatchPoolValidateResourceFileWithMultipleSources(ri, rs, testLocation()), + ExpectError: regexp.MustCompile("Exactly one of auto_storage_container_name, storage_container_url and http_url must be specified"), + }, + }, + }) +} + +func TestAccAzureRMBatchPoolValidateResourceFileBlobPrefixWithoutAutoStorageContainerUrl(t *testing.T) { + ri := tf.AccRandTimeInt() + rs := acctest.RandString(4) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBatchPoolDestroy, + Steps: []resource.TestStep{ + { + Config: testaccAzureRMBatchPoolValidateResourceFileBlobPrefixWithoutAutoStorageContainerName(ri, rs, testLocation()), + ExpectError: regexp.MustCompile("auto_storage_container_name or storage_container_url must be specified when using blob_prefix"), + }, + }, + }) +} + +func TestAccAzureRMBatchPoolValidateResourceFileHttpURLWithoutFilePath(t *testing.T) { + ri := tf.AccRandTimeInt() + rs := acctest.RandString(4) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBatchPoolDestroy, + Steps: []resource.TestStep{ + { + Config: testaccAzureRMBatchPoolValidateResourceFileHttpURLWithoutFilePath(ri, rs, testLocation()), + ExpectError: regexp.MustCompile("file_path must be specified when using http_url"), + }, + }, + }) +} + func testCheckAzureRMBatchPoolExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API @@ -434,7 +503,7 @@ EOF offer = "UbuntuServer" sku = "16.04.0-LTS" version = "latest" - } + } } `, rInt, location, rString, rString, rString) } @@ -544,6 +613,242 @@ resource "azurerm_batch_pool" "test" { elevation_level = "NonAdmin" scope = "Task" } + } + + resource_file { + "http_url" = "https://raw.githubusercontent.com/terraform-providers/terraform-provider-azurerm/master/README.md" + "file_path" = "README.md" + } + } +} +`, rInt, location, rString, rString) +} + +func testaccAzureRMBatchPoolValidateResourceFileWithoutSource(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "testaccbatch%d" + location = "%s" +} + +resource "azurerm_batch_account" "test" { + name = "testaccbatch%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" +} + +resource "azurerm_batch_pool" "test" { + name = "testaccpool%s" + resource_group_name = "${azurerm_resource_group.test.name}" + account_name = "${azurerm_batch_account.test.name}" + node_agent_sku_id = "batch.node.ubuntu 16.04" + vm_size = "Standard_A1" + + fixed_scale { + target_dedicated_nodes = 1 + } + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04.0-LTS" + version = "latest" + } + + start_task { + command_line = "echo 'Hello World from $env'" + max_task_retry_count = 1 + wait_for_success = true + + environment = { + env = "TEST", + bu = "Research&Dev" + } + + user_identity { + auto_user { + elevation_level = "NonAdmin" + scope = "Task" + } + } + + resource_file { + # no valid values for sources + "auto_storage_container_name" = "" + "file_mode" = "0770" + } + } +} +`, rInt, location, rString, rString) +} + +func testaccAzureRMBatchPoolValidateResourceFileWithMultipleSources(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "testaccbatch%d" + location = "%s" +} + +resource "azurerm_batch_account" "test" { + name = "testaccbatch%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" +} + +resource "azurerm_batch_pool" "test" { + name = "testaccpool%s" + resource_group_name = "${azurerm_resource_group.test.name}" + account_name = "${azurerm_batch_account.test.name}" + node_agent_sku_id = "batch.node.ubuntu 16.04" + vm_size = "Standard_A1" + + fixed_scale { + target_dedicated_nodes = 1 + } + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04.0-LTS" + version = "latest" + } + + start_task { + command_line = "echo 'Hello World from $env'" + max_task_retry_count = 1 + wait_for_success = true + + environment = { + env = "TEST", + bu = "Research&Dev" + } + + user_identity { + auto_user { + elevation_level = "NonAdmin" + scope = "Task" + } + } + + resource_file { + "auto_storage_container_name" = "test" + "http_url" = "test" + "file_path" = "README.md" + } + } +} +`, rInt, location, rString, rString) +} + +func testaccAzureRMBatchPoolValidateResourceFileBlobPrefixWithoutAutoStorageContainerName(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "testaccbatch%d" + location = "%s" +} + +resource "azurerm_batch_account" "test" { + name = "testaccbatch%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" +} + +resource "azurerm_batch_pool" "test" { + name = "testaccpool%s" + resource_group_name = "${azurerm_resource_group.test.name}" + account_name = "${azurerm_batch_account.test.name}" + node_agent_sku_id = "batch.node.ubuntu 16.04" + vm_size = "Standard_A1" + + fixed_scale { + target_dedicated_nodes = 1 + } + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04.0-LTS" + version = "latest" + } + + start_task { + command_line = "echo 'Hello World from $env'" + max_task_retry_count = 1 + wait_for_success = true + + environment = { + env = "TEST", + bu = "Research&Dev" + } + + user_identity { + auto_user { + elevation_level = "NonAdmin" + scope = "Task" + } + } + + resource_file { + "http_url" = "test" + "blob_prefix" = "test" + "file_path" = "README.md" + } + } +} +`, rInt, location, rString, rString) +} + +func testaccAzureRMBatchPoolValidateResourceFileHttpURLWithoutFilePath(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "testaccbatch%d" + location = "%s" +} + +resource "azurerm_batch_account" "test" { + name = "testaccbatch%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" +} + +resource "azurerm_batch_pool" "test" { + name = "testaccpool%s" + resource_group_name = "${azurerm_resource_group.test.name}" + account_name = "${azurerm_batch_account.test.name}" + node_agent_sku_id = "batch.node.ubuntu 16.04" + vm_size = "Standard_A1" + + fixed_scale { + target_dedicated_nodes = 1 + } + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04.0-LTS" + version = "latest" + } + + start_task { + command_line = "echo 'Hello World from $env'" + max_task_retry_count = 1 + wait_for_success = true + + environment = { + env = "TEST", + bu = "Research&Dev" + } + + user_identity { + auto_user { + elevation_level = "NonAdmin" + scope = "Task" + } + } + + resource_file { + "http_url" = "test" + "file_path" = "" } } } diff --git a/go.mod b/go.mod index fa6fdf67e64b..6151e7868fac 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,9 @@ require ( github.com/Azure/go-autorest v11.7.0+incompatible github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-rundeck-api v0.0.0-20160826143032-f6af74d34d1e // indirect + github.com/apparentlymart/go-textseg v1.0.0 // indirect + github.com/aws/aws-sdk-go v1.8.34 // indirect + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/davecgh/go-spew v1.1.1 github.com/dnaeon/go-vcr v1.0.1 // indirect diff --git a/go.sum b/go.sum index 421eca9cf849..542def9c2a6e 100644 --- a/go.sum +++ b/go.sum @@ -40,10 +40,9 @@ github.com/apparentlymart/go-cidr v0.0.0-20170616213631-2bd8b58cf427/go.mod h1:E github.com/apparentlymart/go-rundeck-api v0.0.0-20160826143032-f6af74d34d1e/go.mod h1:U6OjNHcY3edY04ILn+KNrWZm3j15cPzW7PyjtIQOh1Y= github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331 h1:AIKxo1t7QE7MAqADwrmzMiaFC+QfHfXOk8lrmibN5Lk= github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20160115234725-4239b77079c7/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= +github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/armon/go-radix v0.0.0-20170727155443-1fca145dffbc/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.8.34 h1:zDNBtR25rYYUi7aEh2HRa2f2WTm6LSHWSAMCNY2WdXA= diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/account.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/account.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/account.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/account.go index edbd07fc8365..4813f580b5d6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/account.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/account.go @@ -102,7 +102,7 @@ func (client AccountClient) CreatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -189,7 +189,7 @@ func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -279,7 +279,7 @@ func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -366,7 +366,7 @@ func (client AccountClient) GetKeysPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -439,7 +439,7 @@ func (client AccountClient) ListPreparer(ctx context.Context) (*http.Request, er "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -552,7 +552,7 @@ func (client AccountClient) ListByResourceGroupPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -675,7 +675,7 @@ func (client AccountClient) RegenerateKeyPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -763,7 +763,7 @@ func (client AccountClient) SynchronizeAutoStorageKeysPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -848,7 +848,7 @@ func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/application.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/application.go similarity index 82% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/application.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/application.go index f158f2e78015..9e618b5c8df4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/application.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/application.go @@ -45,9 +45,9 @@ func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) Appl // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. +// applicationName - the name of the application. This must be unique within the account. // parameters - the parameters for the request. -func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationID string, parameters *ApplicationCreateParameters) (result Application, err error) { +func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (result Application, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Create") defer func() { @@ -62,11 +62,15 @@ func (client ApplicationClient) Create(ctx context.Context, resourceGroupName st {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationClient", "Create", err.Error()) } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationID, parameters) + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") return @@ -88,15 +92,15 @@ func (client ApplicationClient) Create(ctx context.Context, resourceGroupName st } // CreatePreparer prepares the Create request. -func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string, parameters *ApplicationCreateParameters) (*http.Request, error) { +func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -105,7 +109,7 @@ func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGrou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), autorest.WithQueryParameters(queryParameters)) if parameters != nil { preparer = autorest.DecoratePreparer(preparer, @@ -127,7 +131,7 @@ func (client ApplicationClient) CreateResponder(resp *http.Response) (result App err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -138,8 +142,8 @@ func (client ApplicationClient) CreateResponder(resp *http.Response) (result App // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. -func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationID string) (result autorest.Response, err error) { +// applicationName - the name of the application. This must be unique within the account. +func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Delete") defer func() { @@ -154,11 +158,15 @@ func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName st {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationClient", "Delete", err.Error()) } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationID) + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") return @@ -180,15 +188,15 @@ func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName st } // DeletePreparer prepares the Delete request. -func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { +func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -196,7 +204,7 @@ func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGrou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -224,8 +232,8 @@ func (client ApplicationClient) DeleteResponder(resp *http.Response) (result aut // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. -func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationID string) (result Application, err error) { +// applicationName - the name of the application. This must be unique within the account. +func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result Application, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Get") defer func() { @@ -240,11 +248,15 @@ func (client ApplicationClient) Get(ctx context.Context, resourceGroupName strin {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationClient", "Get", err.Error()) } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationID) + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") return @@ -266,15 +278,15 @@ func (client ApplicationClient) Get(ctx context.Context, resourceGroupName strin } // GetPreparer prepares the Get request. -func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { +func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -282,7 +294,7 @@ func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupNa preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -361,7 +373,7 @@ func (client ApplicationClient) ListPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -438,15 +450,15 @@ func (client ApplicationClient) ListComplete(ctx context.Context, resourceGroupN // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. +// applicationName - the name of the application. This must be unique within the account. // parameters - the parameters for the request. -func (client ApplicationClient) Update(ctx context.Context, resourceGroupName string, accountName string, applicationID string, parameters ApplicationUpdateParameters) (result autorest.Response, err error) { +func (client ApplicationClient) Update(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (result Application, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Update") defer func() { sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -455,11 +467,15 @@ func (client ApplicationClient) Update(ctx context.Context, resourceGroupName st {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationClient", "Update", err.Error()) } - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, applicationID, parameters) + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") return @@ -467,7 +483,7 @@ func (client ApplicationClient) Update(ctx context.Context, resourceGroupName st resp, err := client.UpdateSender(req) if err != nil { - result.Response = resp + result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") return } @@ -481,15 +497,15 @@ func (client ApplicationClient) Update(ctx context.Context, resourceGroupName st } // UpdatePreparer prepares the Update request. -func (client ApplicationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string, parameters ApplicationUpdateParameters) (*http.Request, error) { +func (client ApplicationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -498,7 +514,7 @@ func (client ApplicationClient) UpdatePreparer(ctx context.Context, resourceGrou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -513,12 +529,13 @@ func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client ApplicationClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ApplicationClient) UpdateResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = resp + result.Response = autorest.Response{Response: resp} return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/applicationpackage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/applicationpackage.go similarity index 54% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/applicationpackage.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/applicationpackage.go index 7b9173777c85..756b605561f1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/applicationpackage.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/applicationpackage.go @@ -45,16 +45,16 @@ func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID strin // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. -// version - the version of the application to activate. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. // parameters - the parameters for the request. -func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (result autorest.Response, err error) { +func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (result ApplicationPackage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Activate") defer func() { sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -64,12 +64,20 @@ func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGro Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationPackageClient", "Activate", err.Error()) } - req, err := client.ActivatePreparer(ctx, resourceGroupName, accountName, applicationID, version, parameters) + req, err := client.ActivatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") return @@ -77,7 +85,7 @@ func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGro resp, err := client.ActivateSender(req) if err != nil { - result.Response = resp + result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") return } @@ -91,16 +99,16 @@ func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGro } // ActivatePreparer prepares the Activate request. -func (client ApplicationPackageClient) ActivatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { +func (client ApplicationPackageClient) ActivatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), + "versionName": autorest.Encode("path", versionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -109,7 +117,7 @@ func (client ApplicationPackageClient) ActivatePreparer(ctx context.Context, res autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}/activate", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -124,13 +132,14 @@ func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http. // ActivateResponder handles the response to the Activate request. The method always // closes the http.Response Body. -func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result ApplicationPackage, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = resp + result.Response = autorest.Response{Response: resp} return } @@ -138,9 +147,10 @@ func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (r // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. -// version - the version of the application. -func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +// parameters - the parameters for the request. +func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (result ApplicationPackage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Create") defer func() { @@ -155,11 +165,19 @@ func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroup {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationPackageClient", "Create", err.Error()) } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationID, version) + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") return @@ -181,25 +199,30 @@ func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroup } // CreatePreparer prepares the Create request. -func (client ApplicationPackageClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { +func (client ApplicationPackageClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), + "versionName": autorest.Encode("path", versionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -216,7 +239,7 @@ func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (res err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -227,9 +250,9 @@ func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (res // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. -// version - the version of the application to delete. -func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string) (result autorest.Response, err error) { +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Delete") defer func() { @@ -244,11 +267,19 @@ func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroup {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationPackageClient", "Delete", err.Error()) } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationID, version) + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName, versionName) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") return @@ -270,16 +301,16 @@ func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroup } // DeletePreparer prepares the Delete request. -func (client ApplicationPackageClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { +func (client ApplicationPackageClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), + "versionName": autorest.Encode("path", versionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -287,7 +318,7 @@ func (client ApplicationPackageClient) DeletePreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -315,9 +346,9 @@ func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (res // Parameters: // resourceGroupName - the name of the resource group that contains the Batch account. // accountName - the name of the Batch account. -// applicationID - the ID of the application. -// version - the version of the application. -func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result ApplicationPackage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Get") defer func() { @@ -332,11 +363,19 @@ func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupNam {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("batch.ApplicationPackageClient", "Get", err.Error()) } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationID, version) + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName, versionName) if err != nil { err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") return @@ -358,16 +397,16 @@ func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupNam } // GetPreparer prepares the Get request. -func (client ApplicationPackageClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { +func (client ApplicationPackageClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), + "applicationName": autorest.Encode("path", applicationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), + "versionName": autorest.Encode("path", versionName), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -375,7 +414,7 @@ func (client ApplicationPackageClient) GetPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -399,3 +438,136 @@ func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result result.Response = autorest.Response{Response: resp} return } + +// List lists all of the application packages in the specified application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// maxresults - the maximum number of items to return in the response. +func (client ApplicationPackageClient) List(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") + defer func() { + sc := -1 + if result.lapr.Response.Response != nil { + sc = result.lapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, applicationName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure sending request") + return + } + + result.lapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationPackageClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) ListSender(req *http.Request) (*http.Response, error) { + return 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 ApplicationPackageClient) ListResponder(resp *http.Response) (result ListApplicationPackagesResult, 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 ApplicationPackageClient) listNextResults(ctx context.Context, lastResults ListApplicationPackagesResult) (result ListApplicationPackagesResult, err error) { + req, err := lastResults.listApplicationPackagesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationPackageClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, applicationName, maxresults) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/certificate.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/certificate.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/certificate.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/certificate.go index f9d3c6e27230..7a7f3d017c1f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/certificate.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/certificate.go @@ -104,7 +104,7 @@ func (client CertificateClient) CancelDeletionPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -198,7 +198,7 @@ func (client CertificateClient) CreatePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -300,7 +300,7 @@ func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -397,7 +397,7 @@ func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -488,7 +488,7 @@ func (client CertificateClient) ListByBatchAccountPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -629,7 +629,7 @@ func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/client.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/client.go index 0b2df1e39a3e..90fd26ca233d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/client.go @@ -1,4 +1,4 @@ -// Package batch implements the Azure ARM Batch service API version 2017-09-01. +// Package batch implements the Azure ARM Batch service API version 2018-12-01. // // package batch diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/location.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/location.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/location.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/location.go index 9d6a30cf2877..286fdd4ce570 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/location.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/location.go @@ -91,7 +91,7 @@ func (client LocationClient) CheckNameAvailabilityPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -168,7 +168,7 @@ func (client LocationClient) GetQuotasPreparer(ctx context.Context, locationName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/models.go similarity index 81% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/models.go index e3349e0a284b..29121ad183ba 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/models.go @@ -29,15 +29,15 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch" // AccountKeyType enumerates the values for account key type. type AccountKeyType string const ( - // Primary ... + // Primary The primary account key. Primary AccountKeyType = "Primary" - // Secondary ... + // Secondary The secondary account key. Secondary AccountKeyType = "Secondary" ) @@ -50,11 +50,14 @@ func PossibleAccountKeyTypeValues() []AccountKeyType { type AllocationState string const ( - // Resizing ... + // Resizing The pool is resizing; that is, compute nodes are being added to or removed from the pool. Resizing AllocationState = "Resizing" - // Steady ... + // Steady The pool is not resizing. There are no changes to the number of nodes in the pool in progress. A + // pool enters this state when it is created and when no operations are being performed on the pool to + // change the number of nodes. Steady AllocationState = "Steady" - // Stopping ... + // Stopping The pool was resizing, but the user has requested that the resize be stopped, but the stop + // request has not yet been completed. Stopping AllocationState = "Stopping" ) @@ -67,9 +70,10 @@ func PossibleAllocationStateValues() []AllocationState { type AutoUserScope string const ( - // AutoUserScopePool ... + // AutoUserScopePool Specifies that the task runs as the common auto user account which is created on every + // node in a pool. AutoUserScopePool AutoUserScope = "Pool" - // AutoUserScopeTask ... + // AutoUserScopeTask Specifies that the service should create a new user for the task. AutoUserScopeTask AutoUserScope = "Task" ) @@ -82,11 +86,11 @@ func PossibleAutoUserScopeValues() []AutoUserScope { type CachingType string const ( - // None ... + // None The caching mode for the disk is not enabled. None CachingType = "None" - // ReadOnly ... + // ReadOnly The caching mode for the disk is read only. ReadOnly CachingType = "ReadOnly" - // ReadWrite ... + // ReadWrite The caching mode for the disk is read and write. ReadWrite CachingType = "ReadWrite" ) @@ -99,9 +103,9 @@ func PossibleCachingTypeValues() []CachingType { type CertificateFormat string const ( - // Cer ... + // Cer The certificate is a base64-encoded X.509 certificate. Cer CertificateFormat = "Cer" - // Pfx ... + // Pfx The certificate is a PFX (PKCS#12) formatted certificate or certificate chain. Pfx CertificateFormat = "Pfx" ) @@ -114,11 +118,16 @@ func PossibleCertificateFormatValues() []CertificateFormat { type CertificateProvisioningState string const ( - // Deleting ... + // Deleting The user has requested that the certificate be deleted, but the delete operation has not yet + // completed. You may not reference the certificate when creating or updating pools. Deleting CertificateProvisioningState = "Deleting" - // Failed ... + // Failed The user requested that the certificate be deleted, but there are pools that still have + // references to the certificate, or it is still installed on one or more compute nodes. (The latter can + // occur if the certificate has been removed from the pool, but the node has not yet restarted. Nodes + // refresh their certificates only when they restart.) You may use the cancel certificate delete operation + // to cancel the delete, or the delete certificate operation to retry the delete. Failed CertificateProvisioningState = "Failed" - // Succeeded ... + // Succeeded The certificate is available for use in pools. Succeeded CertificateProvisioningState = "Succeeded" ) @@ -131,9 +140,9 @@ func PossibleCertificateProvisioningStateValues() []CertificateProvisioningState type CertificateStoreLocation string const ( - // CurrentUser ... + // CurrentUser Certificates should be installed to the CurrentUser certificate store. CurrentUser CertificateStoreLocation = "CurrentUser" - // LocalMachine ... + // LocalMachine Certificates should be installed to the LocalMachine certificate store. LocalMachine CertificateStoreLocation = "LocalMachine" ) @@ -146,11 +155,14 @@ func PossibleCertificateStoreLocationValues() []CertificateStoreLocation { type CertificateVisibility string const ( - // CertificateVisibilityRemoteUser ... + // CertificateVisibilityRemoteUser The certificate should be visible to the user accounts under which users + // remotely access the node. CertificateVisibilityRemoteUser CertificateVisibility = "RemoteUser" - // CertificateVisibilityStartTask ... + // CertificateVisibilityStartTask The certificate should be visible to the user account under which the + // start task is run. CertificateVisibilityStartTask CertificateVisibility = "StartTask" - // CertificateVisibilityTask ... + // CertificateVisibilityTask The certificate should be visible to the user accounts under which job tasks + // are run. CertificateVisibilityTask CertificateVisibility = "Task" ) @@ -163,13 +175,17 @@ func PossibleCertificateVisibilityValues() []CertificateVisibility { type ComputeNodeDeallocationOption string const ( - // Requeue ... + // Requeue Terminate running task processes and requeue the tasks. The tasks will run again when a node is + // available. Remove nodes as soon as tasks have been terminated. Requeue ComputeNodeDeallocationOption = "Requeue" - // RetainedData ... + // RetainedData Allow currently running tasks to complete, then wait for all task data retention periods to + // expire. Schedule no new tasks while waiting. Remove nodes when all task retention periods have expired. RetainedData ComputeNodeDeallocationOption = "RetainedData" - // TaskCompletion ... + // TaskCompletion Allow currently running tasks to complete. Schedule no new tasks while waiting. Remove + // nodes when all tasks have completed. TaskCompletion ComputeNodeDeallocationOption = "TaskCompletion" - // Terminate ... + // Terminate Terminate running tasks. The tasks will be completed with failureInfo indicating that they + // were terminated, and will not run again. Remove nodes as soon as tasks have been terminated. Terminate ComputeNodeDeallocationOption = "Terminate" ) @@ -182,9 +198,10 @@ func PossibleComputeNodeDeallocationOptionValues() []ComputeNodeDeallocationOpti type ComputeNodeFillType string const ( - // Pack ... + // Pack As many tasks as possible (maxTasksPerNode) should be assigned to each node in the pool before any + // tasks are assigned to the next node in the pool. Pack ComputeNodeFillType = "Pack" - // Spread ... + // Spread Tasks should be assigned evenly across all nodes in the pool. Spread ComputeNodeFillType = "Spread" ) @@ -197,9 +214,9 @@ func PossibleComputeNodeFillTypeValues() []ComputeNodeFillType { type ElevationLevel string const ( - // Admin ... + // Admin The user is a user with elevated access and operates with full Administrator permissions. Admin ElevationLevel = "Admin" - // NonAdmin ... + // NonAdmin The user is a standard user without elevated access. NonAdmin ElevationLevel = "NonAdmin" ) @@ -212,9 +229,9 @@ func PossibleElevationLevelValues() []ElevationLevel { type InboundEndpointProtocol string const ( - // TCP ... + // TCP Use TCP for the endpoint. TCP InboundEndpointProtocol = "TCP" - // UDP ... + // UDP Use UDP for the endpoint. UDP InboundEndpointProtocol = "UDP" ) @@ -227,9 +244,9 @@ func PossibleInboundEndpointProtocolValues() []InboundEndpointProtocol { type InterNodeCommunicationState string const ( - // Disabled ... + // Disabled Disable network communication between virtual machines. Disabled InterNodeCommunicationState = "Disabled" - // Enabled ... + // Enabled Enable network communication between virtual machines. Enabled InterNodeCommunicationState = "Enabled" ) @@ -238,13 +255,31 @@ func PossibleInterNodeCommunicationStateValues() []InterNodeCommunicationState { return []InterNodeCommunicationState{Disabled, Enabled} } +// LoginMode enumerates the values for login mode. +type LoginMode string + +const ( + // Batch The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running + // parallel processes. + Batch LoginMode = "Batch" + // Interactive The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having permissions + // associated with the interactive login mode. If this is the case for an application used in your task, + // then this option is recommended. + Interactive LoginMode = "Interactive" +) + +// PossibleLoginModeValues returns an array of possible values for the LoginMode const type. +func PossibleLoginModeValues() []LoginMode { + return []LoginMode{Batch, Interactive} +} + // NameAvailabilityReason enumerates the values for name availability reason. type NameAvailabilityReason string const ( - // AlreadyExists ... + // AlreadyExists The requested name is already in use. AlreadyExists NameAvailabilityReason = "AlreadyExists" - // Invalid ... + // Invalid The requested name is invalid. Invalid NameAvailabilityReason = "Invalid" ) @@ -257,9 +292,9 @@ func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { type NetworkSecurityGroupRuleAccess string const ( - // Allow ... + // Allow Allow access. Allow NetworkSecurityGroupRuleAccess = "Allow" - // Deny ... + // Deny Deny access. Deny NetworkSecurityGroupRuleAccess = "Deny" ) @@ -272,26 +307,24 @@ func PossibleNetworkSecurityGroupRuleAccessValues() []NetworkSecurityGroupRuleAc type PackageState string const ( - // Active ... + // Active The application package is ready for use. Active PackageState = "Active" - // Pending ... + // Pending The application package has been created but has not yet been activated. Pending PackageState = "Pending" - // Unmapped ... - Unmapped PackageState = "Unmapped" ) // PossiblePackageStateValues returns an array of possible values for the PackageState const type. func PossiblePackageStateValues() []PackageState { - return []PackageState{Active, Pending, Unmapped} + return []PackageState{Active, Pending} } // PoolAllocationMode enumerates the values for pool allocation mode. type PoolAllocationMode string const ( - // BatchService ... + // BatchService Pools will be allocated in subscriptions owned by the Batch service. BatchService PoolAllocationMode = "BatchService" - // UserSubscription ... + // UserSubscription Pools will be allocated in a subscription owned by the user. UserSubscription PoolAllocationMode = "UserSubscription" ) @@ -304,9 +337,11 @@ func PossiblePoolAllocationModeValues() []PoolAllocationMode { type PoolProvisioningState string const ( - // PoolProvisioningStateDeleting ... + // PoolProvisioningStateDeleting The user has requested that the pool be deleted, but the delete operation + // has not yet completed. PoolProvisioningStateDeleting PoolProvisioningState = "Deleting" - // PoolProvisioningStateSucceeded ... + // PoolProvisioningStateSucceeded The pool is available to run tasks subject to the availability of compute + // nodes. PoolProvisioningStateSucceeded PoolProvisioningState = "Succeeded" ) @@ -319,17 +354,17 @@ func PossiblePoolProvisioningStateValues() []PoolProvisioningState { type ProvisioningState string const ( - // ProvisioningStateCancelled ... + // ProvisioningStateCancelled The last operation for the account is cancelled. ProvisioningStateCancelled ProvisioningState = "Cancelled" - // ProvisioningStateCreating ... + // ProvisioningStateCreating The account is being created. ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... + // ProvisioningStateDeleting The account is being deleted. ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... + // ProvisioningStateFailed The last operation for the account is failed. ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateInvalid ... + // ProvisioningStateInvalid The account is in an invalid state. ProvisioningStateInvalid ProvisioningState = "Invalid" - // ProvisioningStateSucceeded ... + // ProvisioningStateSucceeded The account has been created and is ready for use. ProvisioningStateSucceeded ProvisioningState = "Succeeded" ) @@ -342,9 +377,9 @@ func PossibleProvisioningStateValues() []ProvisioningState { type StorageAccountType string const ( - // PremiumLRS ... + // PremiumLRS The data disk should use premium locally redundant storage. PremiumLRS StorageAccountType = "Premium_LRS" - // StandardLRS ... + // StandardLRS The data disk should use standard locally redundant storage. StandardLRS StorageAccountType = "Standard_LRS" ) @@ -839,34 +874,198 @@ type ActivateApplicationPackageParameters struct { // Application contains information about an application in a Batch account. type Application struct { autorest.Response `json:"-"` - // ID - A string that uniquely identifies the application within the account. + // ApplicationProperties - The properties associated with the Application. + *ApplicationProperties `json:"properties,omitempty"` + // ID - The ID of the resource. ID *string `json:"id,omitempty"` - // DisplayName - The display name for the application. - DisplayName *string `json:"displayName,omitempty"` - // Packages - The list of packages under this application. - Packages *[]ApplicationPackage `json:"packages,omitempty"` - // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. - AllowUpdates *bool `json:"allowUpdates,omitempty"` - // DefaultVersion - The package to use if a client requests the application but does not specify a version. - DefaultVersion *string `json:"defaultVersion,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` } -// ApplicationCreateParameters parameters for adding an Application. -type ApplicationCreateParameters struct { - // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. - AllowUpdates *bool `json:"allowUpdates,omitempty"` - // DisplayName - The display name for the application. - DisplayName *string `json:"displayName,omitempty"` +// MarshalJSON is the custom marshaler for Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ApplicationProperties != nil { + objectMap["properties"] = a.ApplicationProperties + } + 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.Etag != nil { + objectMap["etag"] = a.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Application struct. +func (a *Application) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationProperties ApplicationProperties + err = json.Unmarshal(*v, &applicationProperties) + if err != nil { + return err + } + a.ApplicationProperties = &applicationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + } + } + + return nil } // ApplicationPackage an application package which represents a particular version of an application. type ApplicationPackage struct { autorest.Response `json:"-"` - // ID - The ID of the application. + // ApplicationPackageProperties - The properties associated with the Application Package. + *ApplicationPackageProperties `json:"properties,omitempty"` + // ID - The ID of the resource. ID *string `json:"id,omitempty"` - // Version - The version of the application package. - Version *string `json:"version,omitempty"` - // State - The current state of the application package. Possible values include: 'Pending', 'Active', 'Unmapped' + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationPackage. +func (ap ApplicationPackage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ApplicationPackageProperties != nil { + objectMap["properties"] = ap.ApplicationPackageProperties + } + if ap.ID != nil { + objectMap["id"] = ap.ID + } + if ap.Name != nil { + objectMap["name"] = ap.Name + } + if ap.Type != nil { + objectMap["type"] = ap.Type + } + if ap.Etag != nil { + objectMap["etag"] = ap.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationPackage struct. +func (ap *ApplicationPackage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationPackageProperties ApplicationPackageProperties + err = json.Unmarshal(*v, &applicationPackageProperties) + if err != nil { + return err + } + ap.ApplicationPackageProperties = &applicationPackageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ap.Etag = &etag + } + } + } + + return nil +} + +// ApplicationPackageProperties properties of an application package +type ApplicationPackageProperties struct { + // State - The current state of the application package. Possible values include: 'Pending', 'Active' State PackageState `json:"state,omitempty"` // Format - The format of the application package, if the package is active. Format *string `json:"format,omitempty"` @@ -885,14 +1084,14 @@ type ApplicationPackageReference struct { Version *string `json:"version,omitempty"` } -// ApplicationUpdateParameters parameters for an update application request. -type ApplicationUpdateParameters struct { +// ApplicationProperties the properties associated with the Application. +type ApplicationProperties struct { + // DisplayName - The display name for the application. + DisplayName *string `json:"displayName,omitempty"` // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. AllowUpdates *bool `json:"allowUpdates,omitempty"` - // DefaultVersion - The package to use if a client requests the application but does not specify a version. + // DefaultVersion - The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. DefaultVersion *string `json:"defaultVersion,omitempty"` - // DisplayName - The display name for the application. - DisplayName *string `json:"displayName,omitempty"` } // AutoScaleRun ... @@ -936,7 +1135,7 @@ type AutoStorageProperties struct { // AutoUserSpecification ... type AutoUserSpecification struct { - // Scope - pool - specifies that the task runs as the common auto user account which is created on every node in a pool. task - specifies that the service should create a new user for the task. The default value is task. Possible values include: 'AutoUserScopeTask', 'AutoUserScopePool' + // Scope - The default value is task. Possible values include: 'AutoUserScopeTask', 'AutoUserScopePool' Scope AutoUserScope `json:"scope,omitempty"` // ElevationLevel - nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` @@ -1211,10 +1410,7 @@ func (future *CertificateDeleteFuture) Result(client CertificateClient) (ar auto // CertificateProperties certificate properties. type CertificateProperties struct { - // ProvisioningState - Values are: - // Succeeded - The certificate is available for use in pools. - // Deleting - The user has requested that the certificate be deleted, but the delete operation has not yet completed. You may not reference the certificate when creating or updating pools. - // Failed - The user requested that the certificate be deleted, but there are pools that still have references to the certificate, or it is still installed on one or more compute nodes. (The latter can occur if the certificate has been removed from the pool, but the node has not yet restarted. Nodes refresh their certificates only when they restart.) You may use the cancel certificate delete operation to cancel the delete, or the delete certificate operation to retry the delete. Possible values include: 'Succeeded', 'Deleting', 'Failed' + // ProvisioningState - Possible values include: 'Succeeded', 'Deleting', 'Failed' ProvisioningState CertificateProvisioningState `json:"provisioningState,omitempty"` ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` // PreviousProvisioningState - The previous provisioned state of the resource. Possible values include: 'Succeeded', 'Deleting', 'Failed' @@ -1238,12 +1434,7 @@ type CertificateReference struct { // StoreLocation - The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'CurrentUser', 'LocalMachine' StoreLocation CertificateStoreLocation `json:"storeLocation,omitempty"` // StoreName - This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. - StoreName *string `json:"storeName,omitempty"` - // Visibility - Values are: - // starttask - The user account under which the start task is run. - // task - The accounts under which job tasks are run. - // remoteuser - The accounts under which users remotely access the node. - // You can specify more than one visibility in this collection. The default is all accounts. + StoreName *string `json:"storeName,omitempty"` Visibility *[]CertificateVisibility `json:"visibility,omitempty"` } @@ -1287,10 +1478,25 @@ type CloudErrorBody struct { type CloudServiceConfiguration struct { // OsFamily - Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). OsFamily *string `json:"osFamily,omitempty"` - // TargetOSVersion - The default value is * which specifies the latest operating system version for the specified OS family. - TargetOSVersion *string `json:"targetOSVersion,omitempty"` - // CurrentOSVersion - This may differ from targetOSVersion if the pool state is Upgrading. In this case some virtual machines may be on the targetOSVersion and some may be on the currentOSVersion during the upgrade process. Once all virtual machines have upgraded, currentOSVersion is updated to be the same as targetOSVersion. - CurrentOSVersion *string `json:"currentOSVersion,omitempty"` + // OsVersion - The default value is * which specifies the latest operating system version for the specified OS family. + OsVersion *string `json:"osVersion,omitempty"` +} + +// ContainerConfiguration ... +type ContainerConfiguration struct { + Type *string `json:"type,omitempty"` + // ContainerImageNames - This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. + ContainerImageNames *[]string `json:"containerImageNames,omitempty"` + // ContainerRegistries - If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. + ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` +} + +// ContainerRegistry ... +type ContainerRegistry struct { + // RegistryServer - If omitted, the default is "docker.io". + RegistryServer *string `json:"registryServer,omitempty"` + UserName *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` } // DataDisk data Disk settings which will be used by the data disks associated to Compute Nodes in the @@ -1397,6 +1603,153 @@ type LinuxUserConfiguration struct { SSHPrivateKey *string `json:"sshPrivateKey,omitempty"` } +// ListApplicationPackagesResult the result of performing list application packages. +type ListApplicationPackagesResult struct { + autorest.Response `json:"-"` + // Value - The list of application packages. + Value *[]ApplicationPackage `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListApplicationPackagesResultIterator provides access to a complete listing of ApplicationPackage +// values. +type ListApplicationPackagesResultIterator struct { + i int + page ListApplicationPackagesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListApplicationPackagesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListApplicationPackagesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListApplicationPackagesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListApplicationPackagesResultIterator) Response() ListApplicationPackagesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListApplicationPackagesResultIterator) Value() ApplicationPackage { + if !iter.page.NotDone() { + return ApplicationPackage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListApplicationPackagesResultIterator type. +func NewListApplicationPackagesResultIterator(page ListApplicationPackagesResultPage) ListApplicationPackagesResultIterator { + return ListApplicationPackagesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lapr ListApplicationPackagesResult) IsEmpty() bool { + return lapr.Value == nil || len(*lapr.Value) == 0 +} + +// listApplicationPackagesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lapr ListApplicationPackagesResult) listApplicationPackagesResultPreparer(ctx context.Context) (*http.Request, error) { + if lapr.NextLink == nil || len(to.String(lapr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lapr.NextLink))) +} + +// ListApplicationPackagesResultPage contains a page of ApplicationPackage values. +type ListApplicationPackagesResultPage struct { + fn func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error) + lapr ListApplicationPackagesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListApplicationPackagesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.lapr) + if err != nil { + return err + } + page.lapr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListApplicationPackagesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListApplicationPackagesResultPage) NotDone() bool { + return !page.lapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListApplicationPackagesResultPage) Response() ListApplicationPackagesResult { + return page.lapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListApplicationPackagesResultPage) Values() []ApplicationPackage { + if page.lapr.IsEmpty() { + return nil + } + return *page.lapr.Value +} + +// Creates a new instance of the ListApplicationPackagesResultPage type. +func NewListApplicationPackagesResultPage(getNextPage func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error)) ListApplicationPackagesResultPage { + return ListApplicationPackagesResultPage{fn: getNextPage} +} + // ListApplicationsResult the result of performing list applications. type ListApplicationsResult struct { autorest.Response `json:"-"` @@ -2029,12 +2382,6 @@ func NewOperationListResultPage(getNextPage func(context.Context, OperationListR return OperationListResultPage{fn: getNextPage} } -// OSDisk ... -type OSDisk struct { - // Caching - Default value is none. Possible values include: 'None', 'ReadOnly', 'ReadWrite' - Caching CachingType `json:"caching,omitempty"` -} - // Pool contains information about a pool. type Pool struct { autorest.Response `json:"-"` @@ -2194,15 +2541,10 @@ type PoolProperties struct { // LastModified - This is the last time at which the pool level data, such as the targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute node changing state. LastModified *date.Time `json:"lastModified,omitempty"` CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - Values are: - // Succeeded - The pool is available to run tasks subject to the availability of compute nodes. - // Deleting - The user has requested that the pool be deleted, but the delete operation has not yet completed. Possible values include: 'PoolProvisioningStateSucceeded', 'PoolProvisioningStateDeleting' + // ProvisioningState - Possible values include: 'PoolProvisioningStateSucceeded', 'PoolProvisioningStateDeleting' ProvisioningState PoolProvisioningState `json:"provisioningState,omitempty"` ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` - // AllocationState - Values are: - // Steady - The pool is not resizing. There are no changes to the number of nodes in the pool in progress. A pool enters this state when it is created and when no operations are being performed on the pool to change the number of dedicated nodes. - // Resizing - The pool is resizing; that is, compute nodes are being added to or removed from the pool. - // Stopping - The pool was resizing, but the user has requested that the resize be stopped, but the stop request has not yet been completed. Possible values include: 'Steady', 'Resizing', 'Stopping' + // AllocationState - Possible values include: 'Steady', 'Resizing', 'Stopping' AllocationState AllocationState `json:"allocationState,omitempty"` AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). @@ -2305,9 +2647,16 @@ func (r Resource) MarshalJSON() ([]byte, error) { // ResourceFile ... type ResourceFile struct { - // BlobSource - This URL must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. - BlobSource *string `json:"blobSource,omitempty"` - FilePath *string `json:"filePath,omitempty"` + // AutoStorageContainerName - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. + AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` + // StorageContainerURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the blob, or set the ACL for the blob or its container to allow public access. + StorageContainerURL *string `json:"storageContainerUrl,omitempty"` + // HTTPURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL is Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. + HTTPURL *string `json:"httpUrl,omitempty"` + // BlobPrefix - The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. + BlobPrefix *string `json:"blobPrefix,omitempty"` + // FilePath - If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). + FilePath *string `json:"filePath,omitempty"` // FileMode - This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. FileMode *string `json:"fileMode,omitempty"` } @@ -2335,6 +2684,18 @@ type StartTask struct { MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` // WaitForSuccess - If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is false. WaitForSuccess *bool `json:"waitForSuccess,omitempty"` + // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` +} + +// TaskContainerSettings ... +type TaskContainerSettings struct { + // ContainerRunOptions - These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. + ContainerRunOptions *string `json:"containerRunOptions,omitempty"` + // ImageName - This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. + ImageName *string `json:"imageName,omitempty"` + // Registry - This setting can be omitted if was already provided at pool creation. + Registry *ContainerRegistry `json:"registry,omitempty"` } // TaskSchedulingPolicy ... @@ -2351,6 +2712,8 @@ type UserAccount struct { ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` // LinuxUserConfiguration - This property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` + // WindowsUserConfiguration - This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. + WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` } // UserIdentity specify either the userName or autoUser property, but not both. @@ -2364,7 +2727,6 @@ type UserIdentity struct { // VirtualMachineConfiguration ... type VirtualMachineConfiguration struct { ImageReference *ImageReference `json:"imageReference,omitempty"` - OsDisk *OSDisk `json:"osDisk,omitempty"` // NodeAgentSkuID - The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. NodeAgentSkuID *string `json:"nodeAgentSkuId,omitempty"` // WindowsConfiguration - This property must not be specified if the imageReference specifies a Linux OS image. @@ -2375,6 +2737,8 @@ type VirtualMachineConfiguration struct { // Windows_Server - The on-premises license is for Windows Server. // Windows_Client - The on-premises license is for Windows Client. LicenseType *string `json:"licenseType,omitempty"` + // ContainerConfiguration - If specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. + ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` } // WindowsConfiguration ... @@ -2382,3 +2746,9 @@ type WindowsConfiguration struct { // EnableAutomaticUpdates - If omitted, the default value is true. EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` } + +// WindowsUserConfiguration ... +type WindowsUserConfiguration struct { + // LoginMode - Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. Possible values include: 'Batch', 'Interactive' + LoginMode LoginMode `json:"loginMode,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/operations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/operations.go index d92776c57e24..697cff855351 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/operations.go @@ -76,7 +76,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/pool.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/pool.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/pool.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/pool.go index 92e0ebc94da7..088e58b15b8a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/pool.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/pool.go @@ -79,6 +79,8 @@ func (client PoolClient) Create(ctx context.Context, resourceGroupName string, a {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.NodeAgentSkuID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, }}, }}, {Target: "parameters.PoolProperties.ScaleSettings", Name: validation.Null, Rule: false, @@ -96,6 +98,15 @@ func (client PoolClient) Create(ctx context.Context, resourceGroupName string, a Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration.InboundNatPools", Name: validation.Null, Rule: true, Chain: nil}}}, }}, + {Target: "parameters.PoolProperties.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.StartTask.ContainerSettings.Registry", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings.Registry.UserName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.StartTask.ContainerSettings.Registry.Password", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, }}}}}); err != nil { return result, validation.NewError("batch.PoolClient", "Create", err.Error()) } @@ -124,7 +135,7 @@ func (client PoolClient) CreatePreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -225,7 +236,7 @@ func (client PoolClient) DeletePreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -321,7 +332,7 @@ func (client PoolClient) DisableAutoScalePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -412,7 +423,7 @@ func (client PoolClient) GetPreparer(ctx context.Context, resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -514,7 +525,7 @@ func (client PoolClient) ListByBatchAccountPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -655,7 +666,7 @@ func (client PoolClient) StopResizePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -750,7 +761,7 @@ func (client PoolClient) UpdatePreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-09-01" + const APIVersion = "2018-12-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/version.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/version.go index e702917772da..5c5c5f9133e7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " batch/2017-09-01" + return "Azure-SDK-For-Go/" + version.Number + " batch/2018-12-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/modules.txt b/vendor/modules.txt index 4bd3cb64b009..97c8381eddbc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -5,7 +5,7 @@ github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation -github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch +github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute @@ -77,7 +77,7 @@ github.com/Azure/go-autorest/autorest/azure/cli github.com/agext/levenshtein # github.com/apparentlymart/go-cidr v0.0.0-20170616213631-2bd8b58cf427 github.com/apparentlymart/go-cidr/cidr -# github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331 +# github.com/apparentlymart/go-textseg v1.0.0 github.com/apparentlymart/go-textseg/textseg # github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 github.com/armon/go-radix diff --git a/website/docs/d/batch_pool.html.markdown b/website/docs/d/batch_pool.html.markdown index 858c1980d125..c80ab8e6a089 100644 --- a/website/docs/d/batch_pool.html.markdown +++ b/website/docs/d/batch_pool.html.markdown @@ -79,6 +79,8 @@ A `start_task` block exports the following: * `user_identity` - A `user_identity` block that describes the user identity under which the start task runs. +* `resource_file` - (Optional) One or more `resource_file` blocks that describe the files to be downloaded to a compute node. + --- A `user_identity` block exports the following: @@ -110,3 +112,19 @@ A `certificate` block exports the following: -> **NOTE:** This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). * `visibility` - Which user accounts on the compute node have access to the private data of the certificate. + +--- + +A `resource_file` block exports the following: + +* `auto_storage_container_name` - The storage container name in the auto storage account. + +* `blob_prefix` - The blob prefix used when downloading blobs from an Azure Storage container. Only the blobs whose names begin with the specified prefix will be downloaded. If a prefix is not specified, all the files in the container will be downloaded. + +* `file_Mode` - The file permission mode attribute in octal format. This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a `resource_file` which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. + +* `file_path` - The location on the compute node to which to download the file, relative to the task's working directory. If the `http_url` property is specified, the `file_path` is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the `auto_storage_container_name` or `storage_container_url` property is specified, `file_path` is optional and is the directory to download the files to. In the case where `file_path` is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). + +* `http_url` - The URL of the file to download. If the URL is Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. + +* `storage_container_url` - The URL of the blob container within Azure Blob Storage. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the blob, or set the ACL for the blob or its container to allow public access. diff --git a/website/docs/r/batch_pool.html.markdown b/website/docs/r/batch_pool.html.markdown index 36659df6ffc1..746b1b6b1d36 100644 --- a/website/docs/r/batch_pool.html.markdown +++ b/website/docs/r/batch_pool.html.markdown @@ -162,6 +162,8 @@ A `start_task` block supports the following: * `user_identity` - (Required) A `user_identity` block that describes the user identity under which the start task runs. +* `resource_file` - (Optional) One or more `resource_file` blocks that describe the files to be downloaded to a compute node. + --- A `user_identity` block supports the following: @@ -194,6 +196,24 @@ A `certificate` block supports the following: * `visibility` - (Optional) Which user accounts on the compute node should have access to the private data of the certificate. +--- + +A `resource_file` block supports the following: + +* `auto_storage_container_name` - (Optional) The storage container name in the auto storage account. + +* `blob_prefix` - (Optional) The blob prefix to use when downloading blobs from an Azure Storage container. Only the blobs whose names begin with the specified prefix will be downloaded. The property is valid only when `auto_storage_container_name` or `storage_container_url` is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. + +* `file_Mode` - (Optional) The file permission mode attribute in octal format. This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a `resource_file` which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. + +* `file_path` - (Optional) The location on the compute node to which to download the file, relative to the task's working directory. If the `http_url` property is specified, the `file_path` is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the `auto_storage_container_name` or `storage_container_url` property is specified, `file_path` is optional and is the directory to download the files to. In the case where `file_path` is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). + +* `http_url` - (Optional) The URL of the file to download. If the URL is Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. + +* `storage_container_url` - (Optional) The URL of the blob container within Azure Blob Storage. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the blob, or set the ACL for the blob or its container to allow public access. + +~> **Please Note:** Exactly one of `auto_storage_container_name`, `storage_container_url` and `auto_user` must be specified. + ## Attributes Reference The following attributes are exported: From fac82df506927d0377c2b7cfb4adff13cce68b74 Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Mon, 8 Apr 2019 09:50:39 +0100 Subject: [PATCH 2/7] PR review comments --- azurerm/helpers/azure/batch_pool.go | 24 ++++++++++++++++++------ azurerm/resource_arm_batch_pool.go | 8 +++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/azurerm/helpers/azure/batch_pool.go b/azurerm/helpers/azure/batch_pool.go index 489de0b869a9..d1f27e7ce6f9 100644 --- a/azurerm/helpers/azure/batch_pool.go +++ b/azurerm/helpers/azure/batch_pool.go @@ -128,12 +128,24 @@ func FlattenBatchPoolStartTask(startTask *batch.StartTask) []interface{} { if startTask.ResourceFiles != nil { for _, armResourceFile := range *startTask.ResourceFiles { resourceFile := make(map[string]interface{}) - resourceFile["auto_storage_container_name"] = armResourceFile.AutoStorageContainerName - resourceFile["storage_container_url"] = armResourceFile.StorageContainerURL - resourceFile["http_url"] = armResourceFile.HTTPURL - resourceFile["blob_prefix"] = armResourceFile.BlobPrefix - resourceFile["file_path"] = armResourceFile.FilePath - resourceFile["file_mode"] = armResourceFile.FileMode + if armResourceFile.AutoStorageContainerName != nil { + resourceFile["auto_storage_container_name"] = *armResourceFile.AutoStorageContainerName + } + if armResourceFile.StorageContainerURL != nil { + resourceFile["storage_container_url"] = *armResourceFile.StorageContainerURL + } + if armResourceFile.HTTPURL != nil { + resourceFile["http_url"] = *armResourceFile.HTTPURL + } + if armResourceFile.BlobPrefix != nil { + resourceFile["blob_prefix"] = *armResourceFile.BlobPrefix + } + if armResourceFile.FilePath != nil { + resourceFile["file_path"] = *armResourceFile.FilePath + } + if armResourceFile.FileMode != nil { + resourceFile["file_mode"] = *armResourceFile.FileMode + } resourceFiles = append(resourceFiles, resourceFile) } } diff --git a/azurerm/resource_arm_batch_pool.go b/azurerm/resource_arm_batch_pool.go index 16d79d4dfa81..0e89d33d1457 100644 --- a/azurerm/resource_arm_batch_pool.go +++ b/azurerm/resource_arm_batch_pool.go @@ -284,8 +284,6 @@ func resourceArmBatchPool() *schema.Resource { "auto_storage_container_name": { Type: schema.TypeString, Optional: true, - // TODO ValidateFunc - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. - // TODO - for docs: https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#resourcefile }, "blob_prefix": { Type: schema.TypeString, @@ -397,7 +395,7 @@ func resourceArmBatchPoolCreate(d *schema.ResourceData, meta interface{}) error } parameters.PoolProperties.Certificates = certificateReferences - if err := validateCrossFieldRules(¶meters); err != nil { + if err := validateBatchPoolCrossFieldRules(¶meters); err != nil { return err } @@ -500,7 +498,7 @@ func resourceArmBatchPoolUpdate(d *schema.ResourceData, meta interface{}) error } parameters.PoolProperties.Certificates = certificateReferences - if err := validateCrossFieldRules(¶meters); err != nil { + if err := validateBatchPoolCrossFieldRules(¶meters); err != nil { return err } @@ -687,7 +685,7 @@ func validateUserIdentity(userIdentity *batch.UserIdentity) error { return nil } -func validateCrossFieldRules(pool *batch.Pool) error { +func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { // Perform validation across multiple fields as per https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#resourcefile if pool.StartTask != nil { From fd99b8e35cfff0b68f0214b27263289e17036437 Mon Sep 17 00:00:00 2001 From: kt Date: Fri, 12 Apr 2019 10:30:08 +0200 Subject: [PATCH 3/7] Apply suggestions from code review Co-Authored-By: stuartleeks --- website/docs/d/batch_pool.html.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/website/docs/d/batch_pool.html.markdown b/website/docs/d/batch_pool.html.markdown index c80ab8e6a089..32ca3c79e7c3 100644 --- a/website/docs/d/batch_pool.html.markdown +++ b/website/docs/d/batch_pool.html.markdown @@ -119,12 +119,12 @@ A `resource_file` block exports the following: * `auto_storage_container_name` - The storage container name in the auto storage account. -* `blob_prefix` - The blob prefix used when downloading blobs from an Azure Storage container. Only the blobs whose names begin with the specified prefix will be downloaded. If a prefix is not specified, all the files in the container will be downloaded. +* `blob_prefix` - The blob prefix used when downloading blobs from an Azure Storage container. -* `file_Mode` - The file permission mode attribute in octal format. This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a `resource_file` which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. +* `file_Mode` - The file permission mode attribute in octal format. -* `file_path` - The location on the compute node to which to download the file, relative to the task's working directory. If the `http_url` property is specified, the `file_path` is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the `auto_storage_container_name` or `storage_container_url` property is specified, `file_path` is optional and is the directory to download the files to. In the case where `file_path` is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). +* `file_path` - The location on the compute node to which to download the file, relative to the task's working directory. If the `http_url` property is specified, the `file_path` is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the `auto_storage_container_name` or `storage_container_url` property is specified. -* `http_url` - The URL of the file to download. If the URL is Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. +* `http_url` - The URL of the file to download. If the URL is Azure Blob Storage, it must be readable using anonymous access. -* `storage_container_url` - The URL of the blob container within Azure Blob Storage. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the blob, or set the ACL for the blob or its container to allow public access. +* `storage_container_url` - The URL of the blob container within Azure Blob Storage. From d2449d399eea932a30d9feb6b8cdad619bbeefa5 Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Fri, 12 Apr 2019 12:52:48 +0200 Subject: [PATCH 4/7] Fix indentation --- azurerm/resource_arm_batch_pool_test.go | 78 ++++++++++++------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/azurerm/resource_arm_batch_pool_test.go b/azurerm/resource_arm_batch_pool_test.go index 14c0a7a2e3ae..17ac384c547a 100644 --- a/azurerm/resource_arm_batch_pool_test.go +++ b/azurerm/resource_arm_batch_pool_test.go @@ -503,7 +503,7 @@ EOF offer = "UbuntuServer" sku = "16.04.0-LTS" version = "latest" - } + } } `, rInt, location, rString, rString, rString) } @@ -604,8 +604,8 @@ resource "azurerm_batch_pool" "test" { wait_for_success = true environment = { - env = "TEST", - bu = "Research&Dev" + env = "TEST", + bu = "Research&Dev" } user_identity { @@ -613,11 +613,11 @@ resource "azurerm_batch_pool" "test" { elevation_level = "NonAdmin" scope = "Task" } - } - - resource_file { - "http_url" = "https://raw.githubusercontent.com/terraform-providers/terraform-provider-azurerm/master/README.md" - "file_path" = "README.md" + } + + resource_file { + "http_url" = "https://raw.githubusercontent.com/terraform-providers/terraform-provider-azurerm/master/README.md" + "file_path" = "README.md" } } } @@ -661,8 +661,8 @@ resource "azurerm_batch_pool" "test" { wait_for_success = true environment = { - env = "TEST", - bu = "Research&Dev" + env = "TEST", + bu = "Research&Dev" } user_identity { @@ -670,12 +670,12 @@ resource "azurerm_batch_pool" "test" { elevation_level = "NonAdmin" scope = "Task" } - } - - resource_file { - # no valid values for sources - "auto_storage_container_name" = "" - "file_mode" = "0770" + } + + resource_file { + # no valid values for sources + "auto_storage_container_name" = "" + "file_mode" = "0770" } } } @@ -719,8 +719,8 @@ resource "azurerm_batch_pool" "test" { wait_for_success = true environment = { - env = "TEST", - bu = "Research&Dev" + env = "TEST", + bu = "Research&Dev" } user_identity { @@ -728,12 +728,12 @@ resource "azurerm_batch_pool" "test" { elevation_level = "NonAdmin" scope = "Task" } - } - - resource_file { - "auto_storage_container_name" = "test" - "http_url" = "test" - "file_path" = "README.md" + } + + resource_file { + "auto_storage_container_name" = "test" + "http_url" = "test" + "file_path" = "README.md" } } } @@ -777,8 +777,8 @@ resource "azurerm_batch_pool" "test" { wait_for_success = true environment = { - env = "TEST", - bu = "Research&Dev" + env = "TEST", + bu = "Research&Dev" } user_identity { @@ -786,12 +786,12 @@ resource "azurerm_batch_pool" "test" { elevation_level = "NonAdmin" scope = "Task" } - } - - resource_file { - "http_url" = "test" - "blob_prefix" = "test" - "file_path" = "README.md" + } + + resource_file { + "http_url" = "test" + "blob_prefix" = "test" + "file_path" = "README.md" } } } @@ -835,8 +835,8 @@ resource "azurerm_batch_pool" "test" { wait_for_success = true environment = { - env = "TEST", - bu = "Research&Dev" + env = "TEST", + bu = "Research&Dev" } user_identity { @@ -844,11 +844,11 @@ resource "azurerm_batch_pool" "test" { elevation_level = "NonAdmin" scope = "Task" } - } - - resource_file { - "http_url" = "test" - "file_path" = "" + } + + resource_file { + "http_url" = "test" + "file_path" = "" } } } From 5c1122670d667a8dcb4b10363b83c4af6ca39619 Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Sat, 13 Apr 2019 10:49:59 +0200 Subject: [PATCH 5/7] Make code terser --- azurerm/helpers/azure/batch_pool.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/azurerm/helpers/azure/batch_pool.go b/azurerm/helpers/azure/batch_pool.go index d1f27e7ce6f9..7bce4d14c7fa 100644 --- a/azurerm/helpers/azure/batch_pool.go +++ b/azurerm/helpers/azure/batch_pool.go @@ -296,38 +296,38 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { for _, resourceFileValueTemp := range resourceFileList { resourceFileValue := resourceFileValueTemp.(map[string]interface{}) resourceFile := batch.ResourceFile{} - if autoStorageContainerNameValue, ok := resourceFileValue["auto_storage_container_name"]; ok { - autoStorageContainerName := autoStorageContainerNameValue.(string) + if v, ok := resourceFileValue["auto_storage_container_name"]; ok { + autoStorageContainerName := v.(string) if autoStorageContainerName != "" { resourceFile.AutoStorageContainerName = &autoStorageContainerName } } - if storageContainerURLValue, ok := resourceFileValue["storage_container_url"]; ok { - storageContainerURL := storageContainerURLValue.(string) + if v, ok := resourceFileValue["storage_container_url"]; ok { + storageContainerURL := v.(string) if storageContainerURL != "" { resourceFile.StorageContainerURL = &storageContainerURL } } - if httpURLValue, ok := resourceFileValue["http_url"]; ok { - httpURL := httpURLValue.(string) + if v, ok := resourceFileValue["http_url"]; ok { + httpURL := v.(string) if httpURL != "" { resourceFile.HTTPURL = &httpURL } } - if blobPrefixValue, ok := resourceFileValue["blob_prefix"]; ok { - blobPrefix := blobPrefixValue.(string) + if v, ok := resourceFileValue["blob_prefix"]; ok { + blobPrefix := v.(string) if blobPrefix != "" { resourceFile.BlobPrefix = &blobPrefix } } - if filePathValue, ok := resourceFileValue["file_path"]; ok { - filePath := filePathValue.(string) + if v, ok := resourceFileValue["file_path"]; ok { + filePath := v.(string) if filePath != "" { resourceFile.FilePath = &filePath } } - if fileModeValue, ok := resourceFileValue["file_mode"]; ok { - fileMode := fileModeValue.(string) + if v, ok := resourceFileValue["file_mode"]; ok { + fileMode := v.(string) if fileMode != "" { resourceFile.FileMode = &fileMode } From 811a2dea9de323bc7f9f67b7ad1a27676e13c1de Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Sat, 13 Apr 2019 11:04:11 +0200 Subject: [PATCH 6/7] Fixup batch sdk reference for new files --- azurerm/resource_arm_batch_certificate.go | 2 +- go.mod | 2 -- go.sum | 3 +++ vendor/modules.txt | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/azurerm/resource_arm_batch_certificate.go b/azurerm/resource_arm_batch_certificate.go index 4a0787cf8cf4..26be3a33cf6e 100644 --- a/azurerm/resource_arm_batch_certificate.go +++ b/azurerm/resource_arm_batch_certificate.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2018-12-01/batch" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" diff --git a/go.mod b/go.mod index 6151e7868fac..891fb0a82331 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,6 @@ require ( github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-rundeck-api v0.0.0-20160826143032-f6af74d34d1e // indirect github.com/apparentlymart/go-textseg v1.0.0 // indirect - github.com/aws/aws-sdk-go v1.8.34 // indirect - github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/davecgh/go-spew v1.1.1 github.com/dnaeon/go-vcr v1.0.1 // indirect diff --git a/go.sum b/go.sum index 542def9c2a6e..ceb5c58523f7 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,9 @@ github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331 h1:AIKxo github.com/apparentlymart/go-textseg v0.0.0-20170531203952-b836f5c4d331/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20160115234725-4239b77079c7/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v0.0.0-20170727155443-1fca145dffbc/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= diff --git a/vendor/modules.txt b/vendor/modules.txt index 97c8381eddbc..f34de89315c4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -156,8 +156,8 @@ github.com/hashicorp/go-azure-helpers/response # github.com/hashicorp/go-cleanhttp v0.5.0 github.com/hashicorp/go-cleanhttp # github.com/hashicorp/go-getter v0.0.0-20180327010114-90bb99a48d86 -github.com/hashicorp/go-getter github.com/hashicorp/go-getter/helper/url +github.com/hashicorp/go-getter # github.com/hashicorp/go-hclog v0.0.0-20170903163258-8105cc0a3736 github.com/hashicorp/go-hclog # github.com/hashicorp/go-multierror v1.0.0 From 190a8c5838710c0e900ff43fd48392ef47c0af37 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Tue, 16 Apr 2019 10:12:14 +0200 Subject: [PATCH 7/7] batch pool: updating the docs comments from code review --- website/docs/d/batch_pool.html.markdown | 8 ++++---- website/docs/r/batch_pool.html.markdown | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/website/docs/d/batch_pool.html.markdown b/website/docs/d/batch_pool.html.markdown index 32ca3c79e7c3..24236b9ae43b 100644 --- a/website/docs/d/batch_pool.html.markdown +++ b/website/docs/d/batch_pool.html.markdown @@ -79,7 +79,7 @@ A `start_task` block exports the following: * `user_identity` - A `user_identity` block that describes the user identity under which the start task runs. -* `resource_file` - (Optional) One or more `resource_file` blocks that describe the files to be downloaded to a compute node. +* `resource_file` - (Optional) One or more `resource_file` blocks that describe the files to be downloaded to a compute node. --- @@ -121,10 +121,10 @@ A `resource_file` block exports the following: * `blob_prefix` - The blob prefix used when downloading blobs from an Azure Storage container. -* `file_Mode` - The file permission mode attribute in octal format. +* `file_mode` - The file permission mode attribute represented as a string in octal format (e.g. `"0644"`). -* `file_path` - The location on the compute node to which to download the file, relative to the task's working directory. If the `http_url` property is specified, the `file_path` is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the `auto_storage_container_name` or `storage_container_url` property is specified. +* `file_path` - The location on the compute node to which to download the file, relative to the task's working directory. If the `http_url` property is specified, the `file_path` is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the `auto_storage_container_name` or `storage_container_url` property is specified. * `http_url` - The URL of the file to download. If the URL is Azure Blob Storage, it must be readable using anonymous access. -* `storage_container_url` - The URL of the blob container within Azure Blob Storage. +* `storage_container_url` - The URL of the blob container within Azure Blob Storage. diff --git a/website/docs/r/batch_pool.html.markdown b/website/docs/r/batch_pool.html.markdown index 746b1b6b1d36..e6f9308665d7 100644 --- a/website/docs/r/batch_pool.html.markdown +++ b/website/docs/r/batch_pool.html.markdown @@ -162,7 +162,7 @@ A `start_task` block supports the following: * `user_identity` - (Required) A `user_identity` block that describes the user identity under which the start task runs. -* `resource_file` - (Optional) One or more `resource_file` blocks that describe the files to be downloaded to a compute node. +* `resource_file` - (Optional) One or more `resource_file` blocks that describe the files to be downloaded to a compute node. --- @@ -204,7 +204,7 @@ A `resource_file` block supports the following: * `blob_prefix` - (Optional) The blob prefix to use when downloading blobs from an Azure Storage container. Only the blobs whose names begin with the specified prefix will be downloaded. The property is valid only when `auto_storage_container_name` or `storage_container_url` is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. -* `file_Mode` - (Optional) The file permission mode attribute in octal format. This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a `resource_file` which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. +* `file_mode` - (Optional) The file permission mode represented as a string in octal format (e.g. `"0644"`). This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a `resource_file` which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. * `file_path` - (Optional) The location on the compute node to which to download the file, relative to the task's working directory. If the `http_url` property is specified, the `file_path` is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the `auto_storage_container_name` or `storage_container_url` property is specified, `file_path` is optional and is the directory to download the files to. In the case where `file_path` is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..').