diff --git a/go.mod b/go.mod index adee86f96e89..48b62f49ba69 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.1.2 github.com/hashicorp/go-azure-helpers v0.51.0 - github.com/hashicorp/go-azure-sdk v0.20230204.1161343 + github.com/hashicorp/go-azure-sdk v0.20230208.1165725 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 @@ -26,7 +26,7 @@ require ( github.com/rickb777/date v1.12.5-0.20200422084442-6300e543c4d9 github.com/sergi/go-diff v1.2.0 github.com/tombuildsstuff/giovanni v0.20.0 - github.com/tombuildsstuff/kermit v0.20221207.1110610 + github.com/tombuildsstuff/kermit v0.20230208.1135849 golang.org/x/crypto v0.5.0 golang.org/x/net v0.5.0 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index 1002893dcc9c..756cd5538b1f 100644 --- a/go.sum +++ b/go.sum @@ -207,8 +207,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.51.0 h1:8KSDGkGnWH6zOT60R3KUqsi0fk1vA7AMunaOUJZMM6k= github.com/hashicorp/go-azure-helpers v0.51.0/go.mod h1:lsykLR4KjTUO7MiRmNWiTiX8QQtw3ILjyOvT0f5h3rw= -github.com/hashicorp/go-azure-sdk v0.20230204.1161343 h1:s6zwEj43q+8HtRMTw00J/QLLePOQ/82BfLdWugoFTHg= -github.com/hashicorp/go-azure-sdk v0.20230204.1161343/go.mod h1:Rx0agw+UlqcYIWQMH1qkzK5MfxCVmLv9p3HwyHzGdWY= +github.com/hashicorp/go-azure-sdk v0.20230208.1165725 h1:L1iUUz0OZH6Y16c0M1yvl7oxEQ1E/i1o/rLwfzK2mds= +github.com/hashicorp/go-azure-sdk v0.20230208.1165725/go.mod h1:aHinadEuBi04I1i+yvpPMZUxvxRxl5JgBOwlzIIxozU= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -352,8 +352,8 @@ github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8 github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/tombuildsstuff/giovanni v0.20.0 h1:IM/I/iNWMXnPYwcSq8uxV7TKDlv7Nejq0bRK9i6O/C0= github.com/tombuildsstuff/giovanni v0.20.0/go.mod h1:66KVLYma2whJhEdxPSPL3GQHkulhK+C5CluKfHGfPF4= -github.com/tombuildsstuff/kermit v0.20221207.1110610 h1:WzvCKNwvnbCGTEu+YtTDgrOZ6r6Lb6G6CEEziFIPUms= -github.com/tombuildsstuff/kermit v0.20221207.1110610/go.mod h1:rLa19LUGz+w1EbdCcj+X4tK/goaTp1hQtdCHK7sbFz4= +github.com/tombuildsstuff/kermit v0.20230208.1135849 h1:GgoBJqearx3fEtmlqkPVcq1tzgHqQAHVN5L/5X2q+Bc= +github.com/tombuildsstuff/kermit v0.20230208.1135849/go.mod h1:rLa19LUGz+w1EbdCcj+X4tK/goaTp1hQtdCHK7sbFz4= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= diff --git a/internal/services/batch/batch_account.go b/internal/services/batch/batch_account.go index 9d0e9ec394c9..cfdbe764564b 100644 --- a/internal/services/batch/batch_account.go +++ b/internal/services/batch/batch_account.go @@ -3,42 +3,39 @@ package batch import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" ) // expandBatchAccountKeyVaultReference expands Batch account KeyVault reference -func expandBatchAccountKeyVaultReference(list []interface{}) (*batch.KeyVaultReference, error) { +func expandBatchAccountKeyVaultReference(list []interface{}) (*batchaccount.KeyVaultReference, error) { if len(list) == 0 || list[0] == nil { - return nil, fmt.Errorf("Error: key vault reference should be defined") + return nil, fmt.Errorf("key vault reference should be defined") } keyVaultRef := list[0].(map[string]interface{}) - keyVaultRefID := keyVaultRef["id"].(string) - keyVaultRefURL := keyVaultRef["url"].(string) - - ref := &batch.KeyVaultReference{ - ID: &keyVaultRefID, - URL: &keyVaultRefURL, + ref := &batchaccount.KeyVaultReference{ + Id: keyVaultRef["id"].(string), + Url: keyVaultRef["url"].(string), } return ref, nil } // flattenBatchAccountKeyvaultReference flattens a Batch account keyvault reference -func flattenBatchAccountKeyvaultReference(keyVaultReference *batch.KeyVaultReference) interface{} { +func flattenBatchAccountKeyvaultReference(keyVaultReference *batchaccount.KeyVaultReference) interface{} { result := make(map[string]interface{}) if keyVaultReference == nil { return []interface{}{} } - if keyVaultReference.ID != nil { - result["id"] = *keyVaultReference.ID + if keyVaultReference.Id != "" { + result["id"] = keyVaultReference.Id } - if keyVaultReference.URL != nil { - result["url"] = *keyVaultReference.URL + if keyVaultReference.Url != "" { + result["url"] = keyVaultReference.Url } return []interface{}{result} diff --git a/internal/services/batch/batch_account_data_source.go b/internal/services/batch/batch_account_data_source.go index aa1a7e8da469..735ccc22da1b 100644 --- a/internal/services/batch/batch_account_data_source.go +++ b/internal/services/batch/batch_account_data_source.go @@ -4,17 +4,16 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchAccount() *pluginsdk.Resource { @@ -87,7 +86,7 @@ func dataSourceBatchAccount() *pluginsdk.Resource { }, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -98,52 +97,57 @@ func dataSourceBatchAccountRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := batchaccount.NewBatchAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("making Read request on %s: %+v", id, err) + return fmt.Errorf("reading %s: %+v", id, err) } d.SetId(id.ID()) d.Set("name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("account_endpoint", resp.AccountEndpoint) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) - if props := resp.AccountProperties; props != nil { - if autoStorage := props.AutoStorage; autoStorage != nil { - d.Set("storage_account_id", autoStorage.StorageAccountID) - } - d.Set("pool_allocation_mode", props.PoolAllocationMode) - poolAllocationMode := d.Get("pool_allocation_mode").(string) - - if encryption := props.Encryption; encryption != nil { - d.Set("encryption", flattenEncryption(encryption)) - } + if props := model.Properties; props != nil { + d.Set("account_endpoint", props.AccountEndpoint) - if poolAllocationMode == string(batch.PoolAllocationModeBatchService) { - keys, err := client.GetKeys(ctx, id.ResourceGroup, id.BatchAccountName) - if err != nil { - return fmt.Errorf("cannot read keys for %s: %v", id, err) + if autoStorage := props.AutoStorage; autoStorage != nil { + d.Set("storage_account_id", autoStorage.StorageAccountId) } + d.Set("pool_allocation_mode", props.PoolAllocationMode) + poolAllocationMode := d.Get("pool_allocation_mode").(string) - d.Set("primary_access_key", keys.Primary) - d.Set("secondary_access_key", keys.Secondary) + if encryption := props.Encryption; encryption != nil { + d.Set("encryption", flattenEncryption(encryption)) + } - // set empty keyvault reference which is not needed in Batch Service allocation mode. - d.Set("key_vault_reference", []interface{}{}) - } else if poolAllocationMode == string(batch.PoolAllocationModeUserSubscription) { - if err := d.Set("key_vault_reference", flattenBatchAccountKeyvaultReference(props.KeyVaultReference)); err != nil { - return fmt.Errorf("flattening `key_vault_reference`: %+v", err) + if poolAllocationMode == string(batchaccount.PoolAllocationModeBatchService) { + keys, err := client.GetKeys(ctx, id) + if err != nil { + return fmt.Errorf("cannot read keys for %s: %v", id, err) + } + + if keysModel := keys.Model; keysModel != nil { + d.Set("primary_access_key", keysModel.Primary) + d.Set("secondary_access_key", keysModel.Secondary) + } + + // set empty keyvault reference which is not needed in Batch Service allocation mode. + d.Set("key_vault_reference", []interface{}{}) + } else if poolAllocationMode == string(batchaccount.PoolAllocationModeUserSubscription) { + if err := d.Set("key_vault_reference", flattenBatchAccountKeyvaultReference(props.KeyVaultReference)); err != nil { + return fmt.Errorf("flattening `key_vault_reference`: %+v", err) + } } } + return tags.FlattenAndSet(d, model.Tags) } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/batch/batch_account_resource.go b/internal/services/batch/batch_account_resource.go index 4a034f7010ca..1186e5c5d293 100644 --- a/internal/services/batch/batch_account_resource.go +++ b/internal/services/batch/batch_account_resource.go @@ -6,19 +6,18 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -40,7 +39,7 @@ func resourceBatchAccount() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AccountID(id) + _, err := batchaccount.ParseBatchAccountID(id) return err }), @@ -67,8 +66,8 @@ func resourceBatchAccount() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.AutoStorageAuthenticationModeStorageKeys), - string(batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity), + string(batchaccount.AutoStorageAuthenticationModeStorageKeys), + string(batchaccount.AutoStorageAuthenticationModeBatchAccountManagedIdentity), }, false), RequiredWith: []string{"storage_account_id"}, }, @@ -87,9 +86,9 @@ func resourceBatchAccount() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(batch.AuthenticationModeSharedKey), - string(batch.AuthenticationModeAAD), - string(batch.AuthenticationModeTaskAuthenticationToken), + string(batchaccount.AuthenticationModeSharedKey), + string(batchaccount.AuthenticationModeAAD), + string(batchaccount.AuthenticationModeTaskAuthenticationToken), }, false), }, }, @@ -97,10 +96,10 @@ func resourceBatchAccount() *pluginsdk.Resource { "pool_allocation_mode": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.PoolAllocationModeBatchService), + Default: string(batchaccount.PoolAllocationModeBatchService), ValidateFunc: validation.StringInSlice([]string{ - string(batch.PoolAllocationModeBatchService), - string(batch.PoolAllocationModeUserSubscription), + string(batchaccount.PoolAllocationModeBatchService), + string(batchaccount.PoolAllocationModeUserSubscription), }, false), }, @@ -165,7 +164,7 @@ func resourceBatchAccount() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -178,26 +177,24 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err log.Printf("[INFO] preparing arguments for Azure Batch account creation.") - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := batchaccount.NewBatchAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) location := azure.NormalizeLocation(d.Get("location").(string)) storageAccountId := d.Get("storage_account_id").(string) - poolAllocationMode := d.Get("pool_allocation_mode").(string) - t := d.Get("tags").(map[string]interface{}) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_batch_account", id.ID()) } } - identity, err := expandBatchAccountIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemOrUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -205,24 +202,25 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err encryptionRaw := d.Get("encryption").([]interface{}) encryption := expandEncryption(encryptionRaw) - parameters := batch.AccountCreateParameters{ - Location: &location, - AccountCreateProperties: &batch.AccountCreateProperties{ - PoolAllocationMode: batch.PoolAllocationMode(poolAllocationMode), - PublicNetworkAccess: batch.PublicNetworkAccessTypeEnabled, + poolAllocationMode := batchaccount.PoolAllocationMode(d.Get("pool_allocation_mode").(string)) + parameters := batchaccount.BatchAccountCreateParameters{ + Location: location, + Properties: &batchaccount.BatchAccountCreateProperties{ + PoolAllocationMode: &poolAllocationMode, + PublicNetworkAccess: utils.ToPtr(batchaccount.PublicNetworkAccessTypeEnabled), Encryption: encryption, AllowedAuthenticationModes: expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()), }, Identity: identity, - Tags: tags.Expand(t), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if enabled := d.Get("public_network_access_enabled").(bool); !enabled { - parameters.AccountCreateProperties.PublicNetworkAccess = batch.PublicNetworkAccessTypeDisabled + parameters.Properties.PublicNetworkAccess = utils.ToPtr(batchaccount.PublicNetworkAccessTypeDisabled) } // if pool allocation mode is UserSubscription, a key vault reference needs to be set - if poolAllocationMode == string(batch.PoolAllocationModeUserSubscription) { + if poolAllocationMode == batchaccount.PoolAllocationModeUserSubscription { keyVaultReferenceSet := d.Get("key_vault_reference").([]interface{}) keyVaultReference, err := expandBatchAccountKeyVaultReference(keyVaultReferenceSet) if err != nil { @@ -233,12 +231,12 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("creating %s: When setting pool allocation mode to UserSubscription, a Key Vault reference needs to be set", id) } - parameters.KeyVaultReference = keyVaultReference + parameters.Properties.KeyVaultReference = keyVaultReference if v, ok := d.GetOk("allowed_authentication_modes"); ok { authModes := v.(*pluginsdk.Set).List() for _, mode := range authModes { - if batch.AuthenticationMode(mode.(string)) == batch.AuthenticationModeSharedKey { + if batchaccount.AuthenticationMode(mode.(string)) == batchaccount.AuthenticationModeSharedKey { return fmt.Errorf("creating %s: When setting pool allocation mode to UserSubscription, `allowed_authentication_modes=[StorageKeys]` is not allowed. ", id) } } @@ -246,8 +244,7 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err } authMode := d.Get("storage_account_authentication_mode").(string) - if batch.AutoStorageAuthenticationMode(authMode) == batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity && - identity.Type == batch.ResourceIdentityTypeNone { + if batchaccount.AutoStorageAuthenticationMode(authMode) == batchaccount.AutoStorageAuthenticationModeBatchAccountManagedIdentity && identity.Type == "None" { return fmt.Errorf(" storage_account_authentication_mode=`BatchAccountManagedIdentity` can only be set when identity.type is `SystemAssigned` or `UserAssigned`") } @@ -255,28 +252,23 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err if authMode == "" { return fmt.Errorf("`storage_account_authentication_mode` is required when `storage_account_id` ") } - parameters.AccountCreateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: &storageAccountId, - AuthenticationMode: batch.AutoStorageAuthenticationMode(authMode), + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: &storageAccountId, + AuthenticationMode: utils.ToPtr(batchaccount.AutoStorageAuthenticationMode(authMode)), } } nodeIdentity := d.Get("storage_account_node_identity").(string) if nodeIdentity != "" { - parameters.AccountCreateProperties.AutoStorage.NodeIdentityReference = &batch.ComputeNodeIdentityReference{ - ResourceID: utils.String(nodeIdentity), + parameters.Properties.AutoStorage.NodeIdentityReference = &batchaccount.ComputeNodeIdentityReference{ + ResourceId: utils.String(nodeIdentity), } } - future, err := client.Create(ctx, id.ResourceGroup, id.BatchAccountName, parameters) - if err != nil { + if err := client.CreateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceBatchAccountRead(d, meta) @@ -287,77 +279,83 @@ func resourceBatchAccountRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := batchaccount.ParseBatchAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") - log.Printf("[DEBUG] Batch Account %q was not found in Resource Group %q - removing from state!", id.BatchAccountName, id.ResourceGroup) + log.Printf("[DEBUG] Batch Account %s - removing from state!", *id) return nil } - return fmt.Errorf("reading the state of Batch account %q: %+v", id.BatchAccountName, err) + return fmt.Errorf("reading %s: %+v", *id, err) } d.Set("name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + if location := model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - identity, err := flattenBatchAccountIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + identity, err := identity.FlattenSystemOrUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - if props := resp.AccountProperties; props != nil { - d.Set("account_endpoint", props.AccountEndpoint) - if autoStorage := props.AutoStorage; autoStorage != nil { - d.Set("storage_account_id", *autoStorage.StorageAccountID) - d.Set("storage_account_authentication_mode", autoStorage.AuthenticationMode) + if props := model.Properties; props != nil { - if autoStorage.NodeIdentityReference != nil { - d.Set("storage_account_node_identity", autoStorage.NodeIdentityReference.ResourceID) + d.Set("account_endpoint", props.AccountEndpoint) + if autoStorage := props.AutoStorage; autoStorage != nil { + d.Set("storage_account_id", autoStorage.StorageAccountId) + d.Set("storage_account_authentication_mode", autoStorage.AuthenticationMode) + + if autoStorage.NodeIdentityReference != nil { + d.Set("storage_account_node_identity", autoStorage.NodeIdentityReference.ResourceId) + } + } else { + d.Set("storage_account_authentication_mode", "") + d.Set("storage_account_id", "") } - } else { - d.Set("storage_account_authentication_mode", "") - d.Set("storage_account_id", "") - } - if props.PublicNetworkAccess != "" { - d.Set("public_network_access_enabled", props.PublicNetworkAccess == batch.PublicNetworkAccessTypeEnabled) - } + if v := props.PublicNetworkAccess; v != nil { + d.Set("public_network_access_enabled", *v == batchaccount.PublicNetworkAccessTypeEnabled) + } - d.Set("pool_allocation_mode", props.PoolAllocationMode) + d.Set("pool_allocation_mode", props.PoolAllocationMode) - if err := d.Set("encryption", flattenEncryption(props.Encryption)); err != nil { - return fmt.Errorf("setting `encryption`: %+v", err) - } + if err := d.Set("encryption", flattenEncryption(props.Encryption)); err != nil { + return fmt.Errorf("setting `encryption`: %+v", err) + } - if err := d.Set("allowed_authentication_modes", flattenAllowedAuthenticationModes(props.AllowedAuthenticationModes)); err != nil { - return fmt.Errorf("setting `allowed_authentication_modes`: %+v", err) - } - } + if err := d.Set("allowed_authentication_modes", flattenAllowedAuthenticationModes(props.AllowedAuthenticationModes)); err != nil { + return fmt.Errorf("setting `allowed_authentication_modes`: %+v", err) + } - if d.Get("pool_allocation_mode").(string) == string(batch.PoolAllocationModeBatchService) && - isShardKeyAllowed(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) { - keys, err := client.GetKeys(ctx, id.ResourceGroup, id.BatchAccountName) - if err != nil { - return fmt.Errorf("Cannot read keys for Batch account %q (resource group %q): %v", id.BatchAccountName, id.ResourceGroup, err) - } + if d.Get("pool_allocation_mode").(string) == string(batchaccount.PoolAllocationModeBatchService) && + isShardKeyAllowed(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) { + keys, err := client.GetKeys(ctx, *id) + if err != nil { + return fmt.Errorf("cannot read keys for Batch account %s: %v", *id, err) + } - d.Set("primary_access_key", keys.Primary) - d.Set("secondary_access_key", keys.Secondary) + if keysModel := keys.Model; keysModel != nil { + d.Set("primary_access_key", keysModel.Primary) + d.Set("secondary_access_key", keysModel.Secondary) + } + } + return tags.FlattenAndSet(d, model.Tags) + } } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -367,14 +365,14 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err log.Printf("[INFO] preparing arguments for Azure Batch account update.") - id, err := parse.AccountID(d.Id()) + id, err := batchaccount.ParseBatchAccountID(d.Id()) if err != nil { return err } t := d.Get("tags").(map[string]interface{}) - identity, err := expandBatchAccountIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemOrUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -382,8 +380,8 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err encryptionRaw := d.Get("encryption").([]interface{}) encryption := expandEncryption(encryptionRaw) - parameters := batch.AccountUpdateParameters{ - AccountUpdateProperties: &batch.AccountUpdateProperties{ + parameters := batchaccount.BatchAccountUpdateParameters{ + Properties: &batchaccount.BatchAccountUpdateProperties{ Encryption: encryption, }, Identity: identity, @@ -393,48 +391,46 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err if d.HasChange("allowed_authentication_modes") { allowedAuthModes := d.Get("allowed_authentication_modes").(*pluginsdk.Set).List() if len(allowedAuthModes) == 0 { - parameters.AllowedAuthenticationModes = &[]batch.AuthenticationMode{} // remove all modes need explicit set it to empty array not nil + parameters.Properties.AllowedAuthenticationModes = &[]batchaccount.AuthenticationMode{} // remove all modes need explicit set it to empty array not nil } else { - parameters.AllowedAuthenticationModes = expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) + parameters.Properties.AllowedAuthenticationModes = expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) } } if d.HasChange("storage_account_id") { if v, ok := d.GetOk("storage_account_id"); ok { - parameters.AccountUpdateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: utils.String(v.(string)), + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: utils.String(v.(string)), } } else { - // remove the storage account from the batch account - parameters.AccountUpdateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: nil, + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: nil, } } } authMode := d.Get("storage_account_authentication_mode").(string) - if batch.AutoStorageAuthenticationMode(authMode) == batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity && - identity.Type == batch.ResourceIdentityTypeNone { + if batchaccount.AutoStorageAuthenticationMode(authMode) == batchaccount.AutoStorageAuthenticationModeBatchAccountManagedIdentity && identity.Type == "None" { return fmt.Errorf(" storage_account_authentication_mode=`BatchAccountManagedIdentity` can only be set when identity.type is `SystemAssigned` or `UserAssigned`") } storageAccountId := d.Get("storage_account_id").(string) if storageAccountId != "" { - parameters.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: &storageAccountId, - AuthenticationMode: batch.AutoStorageAuthenticationMode(authMode), + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: &storageAccountId, + AuthenticationMode: utils.ToPtr(batchaccount.AutoStorageAuthenticationMode(authMode)), } } nodeIdentity := d.Get("storage_account_node_identity").(string) if nodeIdentity != "" { - parameters.AutoStorage.NodeIdentityReference = &batch.ComputeNodeIdentityReference{ - ResourceID: utils.String(nodeIdentity), + parameters.Properties.AutoStorage.NodeIdentityReference = &batchaccount.ComputeNodeIdentityReference{ + ResourceId: utils.String(nodeIdentity), } } - if _, err = client.Update(ctx, id.ResourceGroup, id.BatchAccountName, parameters); err != nil { - return fmt.Errorf("updating Batch account %q (Resource Group %q): %+v", id.BatchAccountName, id.ResourceGroup, err) + if _, err = client.Update(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } d.SetId(id.ID()) @@ -447,73 +443,21 @@ func resourceBatchAccountDelete(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := batchaccount.ParseBatchAccountID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName) - if err != nil { - return fmt.Errorf("deleting Batch account %q (Resource Group %q): %+v", id.BatchAccountName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of Batch account %q (Resource Group %q): %+v", id.BatchAccountName, id.ResourceGroup, err) - } + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandBatchAccountIdentity(input []interface{}) (*batch.AccountIdentity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := batch.AccountIdentity{ - Type: batch.ResourceIdentityType(string(expanded.Type)), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*batch.UserAssignedIdentities) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &batch.UserAssignedIdentities{ - // intentionally empty - } - } - } - return &out, nil -} - -func flattenBatchAccountIdentity(input *batch.AccountIdentity) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transform.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transform.TenantId = *input.TenantID - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } - } - - return identity.FlattenSystemAndUserAssignedMap(transform) -} - -func expandEncryption(e []interface{}) *batch.EncryptionProperties { - defaultEnc := batch.EncryptionProperties{ - KeySource: batch.KeySourceMicrosoftBatch, +func expandEncryption(e []interface{}) *batchaccount.EncryptionProperties { + defaultEnc := batchaccount.EncryptionProperties{ + KeySource: utils.ToPtr(batchaccount.KeySourceMicrosoftPointBatch), } if len(e) == 0 || e[0] == nil { @@ -522,9 +466,9 @@ func expandEncryption(e []interface{}) *batch.EncryptionProperties { v := e[0].(map[string]interface{}) keyId := v["key_vault_key_id"].(string) - encryptionProperty := batch.EncryptionProperties{ - KeySource: batch.KeySourceMicrosoftKeyVault, - KeyVaultProperties: &batch.KeyVaultProperties{ + encryptionProperty := batchaccount.EncryptionProperties{ + KeySource: utils.ToPtr(batchaccount.KeySourceMicrosoftPointKeyVault), + KeyVaultProperties: &batchaccount.KeyVaultProperties{ KeyIdentifier: &keyId, }, } @@ -532,19 +476,19 @@ func expandEncryption(e []interface{}) *batch.EncryptionProperties { return &encryptionProperty } -func expandAllowedAuthenticationModes(input []interface{}) *[]batch.AuthenticationMode { +func expandAllowedAuthenticationModes(input []interface{}) *[]batchaccount.AuthenticationMode { if len(input) == 0 { return nil } - allowedAuthModes := make([]batch.AuthenticationMode, 0) + allowedAuthModes := make([]batchaccount.AuthenticationMode, 0) for _, mode := range input { - allowedAuthModes = append(allowedAuthModes, batch.AuthenticationMode(mode.(string))) + allowedAuthModes = append(allowedAuthModes, batchaccount.AuthenticationMode(mode.(string))) } return &allowedAuthModes } -func flattenAllowedAuthenticationModes(input *[]batch.AuthenticationMode) []string { +func flattenAllowedAuthenticationModes(input *[]batchaccount.AuthenticationMode) []string { if input == nil || len(*input) == 0 { return []string{} } @@ -556,8 +500,8 @@ func flattenAllowedAuthenticationModes(input *[]batch.AuthenticationMode) []stri return allowedAuthModes } -func flattenEncryption(encryptionProperties *batch.EncryptionProperties) []interface{} { - if encryptionProperties == nil || encryptionProperties.KeySource == batch.KeySourceMicrosoftBatch { +func flattenEncryption(encryptionProperties *batchaccount.EncryptionProperties) []interface{} { + if encryptionProperties == nil || *encryptionProperties.KeySource == batchaccount.KeySourceMicrosoftPointBatch { return []interface{}{} } @@ -573,7 +517,7 @@ func isShardKeyAllowed(input []interface{}) bool { return false } for _, authMod := range input { - if strings.EqualFold(authMod.(string), string(batch.AuthenticationModeSharedKey)) { + if strings.EqualFold(authMod.(string), string(batchaccount.AuthenticationModeSharedKey)) { return true } } diff --git a/internal/services/batch/batch_account_resource_test.go b/internal/services/batch/batch_account_resource_test.go index bb9637f1acd0..7d32b1c7bc74 100644 --- a/internal/services/batch/batch_account_resource_test.go +++ b/internal/services/batch/batch_account_resource_test.go @@ -6,10 +6,10 @@ import ( "os" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -279,17 +279,17 @@ func TestAccBatchAccount_removeStorageAccount(t *testing.T) { } func (t BatchAccountResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.AccountID(state.ID) + id, err := batchaccount.ParseBatchAccountID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.AccountClient.Get(ctx, id.ResourceGroup, id.BatchAccountName) + resp, err := clients.Batch.AccountClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Batch Application %q (Resource Group %q) does not exist", id.BatchAccountName, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.AccountProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchAccountResource) basic(data acceptance.TestData) string { diff --git a/internal/services/batch/batch_application_data_source.go b/internal/services/batch/batch_application_data_source.go index 77758c9938c8..d4e886e12cec 100644 --- a/internal/services/batch/batch_application_data_source.go +++ b/internal/services/batch/batch_application_data_source.go @@ -4,13 +4,13 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchApplication() *pluginsdk.Resource { @@ -60,11 +60,11 @@ func dataSourceBatchApplicationRead(d *pluginsdk.ResourceData, meta interface{}) defer cancel() subscriptionId := meta.(*clients.Client).Account.SubscriptionId - id := parse.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := application.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("reading %s: %+v", id, err) @@ -72,14 +72,16 @@ func dataSourceBatchApplicationRead(d *pluginsdk.ResourceData, meta interface{}) d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ApplicationName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("account_name", id.BatchAccountName) - if applicationProperties := resp.ApplicationProperties; applicationProperties != nil { - d.Set("allow_updates", applicationProperties.AllowUpdates) - d.Set("default_version", applicationProperties.DefaultVersion) - d.Set("display_name", applicationProperties.DisplayName) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("allow_updates", props.AllowUpdates) + d.Set("default_version", props.DefaultVersion) + d.Set("display_name", props.DisplayName) + } } return nil diff --git a/internal/services/batch/batch_application_resource.go b/internal/services/batch/batch_application_resource.go index 20d67d7a446d..6fa35b2aa5ce 100644 --- a/internal/services/batch/batch_application_resource.go +++ b/internal/services/batch/batch_application_resource.go @@ -5,11 +5,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -31,7 +31,7 @@ func resourceBatchApplication() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApplicationID(id) + _, err := application.ParseApplicationID(id) return err }), @@ -79,31 +79,31 @@ func resourceBatchApplicationCreate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := application.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { - return tf.ImportAsExistsError("azurerm_batch_application", *resp.ID) + if !response.WasNotFound(resp.HttpResponse) { + return tf.ImportAsExistsError("azurerm_batch_application", id.ID()) } allowUpdates := d.Get("allow_updates").(bool) defaultVersion := d.Get("default_version").(string) displayName := d.Get("display_name").(string) - parameters := batch.Application{ - ApplicationProperties: &batch.ApplicationProperties{ + parameters := application.Application{ + Properties: &application.ApplicationProperties{ AllowUpdates: utils.Bool(allowUpdates), DefaultVersion: utils.String(defaultVersion), DisplayName: utils.String(displayName), }, } - if _, err := client.Create(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, ¶meters); err != nil { + if _, err := client.Create(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -117,28 +117,31 @@ func resourceBatchApplicationRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Batch Application %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("reading Batch Application %q (Account Name %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ApplicationName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("account_name", id.BatchAccountName) - if applicationProperties := resp.ApplicationProperties; applicationProperties != nil { - d.Set("allow_updates", applicationProperties.AllowUpdates) - d.Set("default_version", applicationProperties.DefaultVersion) - d.Set("display_name", applicationProperties.DisplayName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("allow_updates", props.AllowUpdates) + d.Set("default_version", props.DefaultVersion) + d.Set("display_name", props.DisplayName) + } } return nil @@ -149,7 +152,7 @@ func resourceBatchApplicationUpdate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } @@ -158,16 +161,16 @@ func resourceBatchApplicationUpdate(d *pluginsdk.ResourceData, meta interface{}) defaultVersion := d.Get("default_version").(string) displayName := d.Get("display_name").(string) - parameters := batch.Application{ - ApplicationProperties: &batch.ApplicationProperties{ + parameters := application.Application{ + Properties: &application.ApplicationProperties{ AllowUpdates: utils.Bool(allowUpdates), DefaultVersion: utils.String(defaultVersion), DisplayName: utils.String(displayName), }, } - if _, err := client.Update(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters); err != nil { - return fmt.Errorf("updating Batch Application %q (Account Name %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + if _, err := client.Update(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceBatchApplicationRead(d, meta) @@ -178,13 +181,13 @@ func resourceBatchApplicationDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("deleting Batch Application %q (Account Name %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/batch/batch_application_resource_test.go b/internal/services/batch/batch_application_resource_test.go index 883d03c6eac3..0e55a6bec808 100644 --- a/internal/services/batch/batch_application_resource_test.go +++ b/internal/services/batch/batch_application_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -68,17 +68,17 @@ func TestAccBatchApplication_complete(t *testing.T) { } func (t BatchApplicationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApplicationID(state.ID) + id, err := application.ParseApplicationID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.ApplicationClient.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := clients.Batch.ApplicationClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Batch Application %q (Account Name %q / Resource Group %q) does not exist", id.Name, id.BatchAccountName, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.ApplicationProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchApplicationResource) template(data acceptance.TestData, displayName string) string { diff --git a/internal/services/batch/batch_certificate_data_source.go b/internal/services/batch/batch_certificate_data_source.go index 8a88a7cc977d..b046b1198abc 100644 --- a/internal/services/batch/batch_certificate_data_source.go +++ b/internal/services/batch/batch_certificate_data_source.go @@ -4,13 +4,13 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchCertificate() *pluginsdk.Resource { @@ -62,11 +62,11 @@ func dataSourceBatchCertificateRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := certificate.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("making Read request on %s: %+v", id, err) @@ -74,15 +74,38 @@ func dataSourceBatchCertificateRead(d *pluginsdk.ResourceData, meta interface{}) d.SetId(id.ID()) - d.Set("name", resp.Name) + if model := resp.Model; model != nil { + d.Set("name", model.Name) + } d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + format := "" + if v := props.Format; v != nil { + format = string(*v) + } + d.Set("format", format) + + publicData := "" + if v := props.PublicData; v != nil { + publicData = *v + } + d.Set("public_data", publicData) - if props := resp.CertificateProperties; props != nil { - d.Set("format", props.Format) - d.Set("public_data", props.PublicData) - d.Set("thumbprint", props.Thumbprint) - d.Set("thumbprint_algorithm", props.ThumbprintAlgorithm) + thumbprint := "" + if v := props.Thumbprint; v != nil { + thumbprint = *v + } + d.Set("thumbprint", thumbprint) + + thumbprintAlgorithm := "" + if v := props.ThumbprintAlgorithm; v != nil { + thumbprintAlgorithm = *v + } + d.Set("thumbprint_algorithm", thumbprintAlgorithm) + } } return nil diff --git a/internal/services/batch/batch_certificate_resource.go b/internal/services/batch/batch_certificate_resource.go index 6fe8fb35f495..ab5b3839f2a7 100644 --- a/internal/services/batch/batch_certificate_resource.go +++ b/internal/services/batch/batch_certificate_resource.go @@ -5,18 +5,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceBatchCertificate() *pluginsdk.Resource { @@ -34,7 +33,7 @@ func resourceBatchCertificate() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CertificateID(id) + _, err := certificate.ParseCertificateID(id) return err }), @@ -66,8 +65,8 @@ func resourceBatchCertificate() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.CertificateFormatCer), - string(batch.CertificateFormatPfx), + string(certificate.CertificateFormatCer), + string(certificate.CertificateFormatPfx), }, false), }, @@ -108,45 +107,45 @@ func resourceBatchCertificateCreate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] preparing arguments for Azure Batch certificate creation.") - certificate := d.Get("certificate").(string) + cert := d.Get("certificate").(string) format := d.Get("format").(string) password := d.Get("password").(string) thumbprint := d.Get("thumbprint").(string) thumbprintAlgorithm := d.Get("thumbprint_algorithm").(string) name := thumbprintAlgorithm + "-" + thumbprint - id := parse.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), name) + id := certificate.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), name) if err := validateBatchCertificateFormatAndPassword(format, password); err != nil { return err } if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_batch_certificate", id.ID()) } } - certificateProperties := batch.CertificateCreateOrUpdateProperties{ - Data: &certificate, - Format: batch.CertificateFormat(format), + certificateProperties := certificate.CertificateCreateOrUpdateProperties{ + Data: cert, + Format: pointer.To(certificate.CertificateFormat(format)), Thumbprint: &thumbprint, ThumbprintAlgorithm: &thumbprintAlgorithm, } if password != "" { certificateProperties.Password = &password } - parameters := batch.CertificateCreateOrUpdateParameters{ - Name: &name, - CertificateCreateOrUpdateProperties: &certificateProperties, + parameters := certificate.CertificateCreateOrUpdateParameters{ + Name: &name, + Properties: &certificateProperties, } - _, err := client.Create(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, "", "") + _, err := client.Create(ctx, id, parameters, certificate.CreateOperationOptions{}) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -160,30 +159,51 @@ func resourceBatchCertificateRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") - log.Printf("[DEBUG] Batch certificate %q was not found in Account %q / Resource Group %q - removing from state!", id.Name, id.BatchAccountName, id.ResourceGroup) + log.Printf("%s was not found - removing from state!", *id) return nil } - return fmt.Errorf("retrieving Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.CertificateName) d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.CertificateProperties; props != nil { - d.Set("format", props.Format) - d.Set("public_data", props.PublicData) - d.Set("thumbprint", props.Thumbprint) - d.Set("thumbprint_algorithm", props.ThumbprintAlgorithm) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + format := "" + if v := props.Format; v != nil { + format = string(*v) + } + d.Set("format", format) + + publicData := "" + if v := props.PublicData; v != nil { + publicData = *v + } + d.Set("public_data", publicData) + + thumbprint := "" + if v := props.Thumbprint; v != nil { + thumbprint = *v + } + d.Set("thumbprint", thumbprint) + + thumbprintAlgorithm := "" + if v := props.ThumbprintAlgorithm; v != nil { + thumbprintAlgorithm = *v + } + d.Set("thumbprint_algorithm", thumbprintAlgorithm) + } } return nil @@ -196,12 +216,12 @@ func resourceBatchCertificateUpdate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] preparing arguments for Azure Batch certificate update.") - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - certificate := d.Get("certificate").(string) + cert := d.Get("certificate").(string) format := d.Get("format").(string) password := d.Get("password").(string) thumbprint := d.Get("thumbprint").(string) @@ -211,28 +231,24 @@ func resourceBatchCertificateUpdate(d *pluginsdk.ResourceData, meta interface{}) return err } - parameters := batch.CertificateCreateOrUpdateParameters{ - Name: &id.Name, - CertificateCreateOrUpdateProperties: &batch.CertificateCreateOrUpdateProperties{ - Data: &certificate, - Format: batch.CertificateFormat(format), + parameters := certificate.CertificateCreateOrUpdateParameters{ + Name: &id.CertificateName, + Properties: &certificate.CertificateCreateOrUpdateProperties{ + Data: cert, + Format: pointer.To(certificate.CertificateFormat(format)), Password: &password, Thumbprint: &thumbprint, ThumbprintAlgorithm: &thumbprintAlgorithm, }, } - if _, err = client.Update(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, ""); err != nil { - return fmt.Errorf("updating Batch certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + if _, err = client.Update(ctx, *id, parameters, certificate.UpdateOperationOptions{}); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } - read, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + _, err = client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) - } - - if read.ID == nil { - return fmt.Errorf("Cannot read ID for Batch certificate %q (Account: %q, Resource Group %q) ID", id.Name, id.BatchAccountName, id.ResourceGroup) + return fmt.Errorf("retrieving %s: %+v", *id, err) } return resourceBatchCertificateRead(d, meta) @@ -243,20 +259,13 @@ func resourceBatchCertificateDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) - if err != nil { - return fmt.Errorf("deleting Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) - } + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/batch/batch_certificate_resource_test.go b/internal/services/batch/batch_certificate_resource_test.go index d891a02d0e18..5cd09e59f562 100644 --- a/internal/services/batch/batch_certificate_resource_test.go +++ b/internal/services/batch/batch_certificate_resource_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -83,17 +83,17 @@ func TestAccBatchCertificate_CerWithPassword(t *testing.T) { } func (t BatchCertificateResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.CertificateID(state.ID) + id, err := certificate.ParseCertificateID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.CertificateClient.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := clients.Batch.CertificateClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Batch Certificate %q (Account Name %q / Resource Group %q) does not exist", id.Name, id.BatchAccountName, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.CertificateProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchCertificateResource) pfxWithPassword(data acceptance.TestData) string { diff --git a/internal/services/batch/batch_job_resource.go b/internal/services/batch/batch_job_resource.go index e99be46aa630..e9fbda4728f1 100644 --- a/internal/services/batch/batch_job_resource.go +++ b/internal/services/batch/batch_job_resource.go @@ -7,6 +7,8 @@ import ( batchDataplane "github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch" "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" @@ -40,7 +42,7 @@ func (r BatchJobResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.PoolID, + ValidateFunc: pool.ValidatePoolID, }, "display_name": { Type: pluginsdk.TypeString, @@ -95,18 +97,18 @@ func (r BatchJobResource) Create() sdk.ResourceFunc { return fmt.Errorf("decoding %+v", err) } - poolId, err := parse.PoolID(model.BatchPoolId) + poolId, err := pool.ParsePoolID(model.BatchPoolId) if err != nil { return err } - accountId := parse.NewAccountID(poolId.SubscriptionId, poolId.ResourceGroup, poolId.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(poolId.SubscriptionId, poolId.ResourceGroupName, poolId.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err } - id := parse.NewJobID(poolId.SubscriptionId, poolId.ResourceGroup, poolId.BatchAccountName, poolId.Name, model.Name) + id := parse.NewJobID(poolId.SubscriptionId, poolId.ResourceGroupName, poolId.BatchAccountName, poolId.PoolName, model.Name) existing, err := r.getJob(ctx, client, id) if err != nil { @@ -127,7 +129,7 @@ func (r BatchJobResource) Create() sdk.ResourceFunc { }, CommonEnvironmentSettings: r.expandEnvironmentSettings(model.CommonEnvironmentProperties), PoolInfo: &batchDataplane.PoolInformation{ - PoolID: &poolId.Name, + PoolID: &poolId.PoolName, }, } @@ -149,7 +151,7 @@ func (r BatchJobResource) Read() sdk.ResourceFunc { if err != nil { return err } - accountId := parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err @@ -165,7 +167,7 @@ func (r BatchJobResource) Read() sdk.ResourceFunc { model := BatchJobModel{ Name: id.Name, - BatchPoolId: parse.NewPoolID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.PoolName).ID(), + BatchPoolId: pool.NewPoolID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.PoolName).ID(), TaskRetryMaximum: 0, } @@ -216,7 +218,7 @@ func (r BatchJobResource) Update() sdk.ResourceFunc { if err != nil { return err } - accountId := parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err @@ -238,7 +240,7 @@ func (r BatchJobResource) Delete() sdk.ResourceFunc { if err != nil { return err } - accountId := parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err diff --git a/internal/services/batch/batch_job_resource_test.go b/internal/services/batch/batch_job_resource_test.go index 2a81e620a5e9..42cb37aa9960 100644 --- a/internal/services/batch/batch_job_resource_test.go +++ b/internal/services/batch/batch_job_resource_test.go @@ -5,6 +5,7 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -95,7 +96,7 @@ func (r BatchJobResource) Exists(ctx context.Context, clients *clients.Client, s return nil, err } - client, err := clients.Batch.JobClient(ctx, parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName)) + client, err := clients.Batch.JobClient(ctx, batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName)) if err != nil { return nil, err } diff --git a/internal/services/batch/batch_pool.go b/internal/services/batch/batch_pool.go index 7eb2a6874970..f1a98078ff00 100644 --- a/internal/services/batch/batch_pool.go +++ b/internal/services/batch/batch_pool.go @@ -6,14 +6,14 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) // flattenBatchPoolAutoScaleSettings flattens the auto scale settings for a Batch pool -func flattenBatchPoolAutoScaleSettings(settings *batch.AutoScaleSettings) []interface{} { +func flattenBatchPoolAutoScaleSettings(settings *pool.AutoScaleSettings) []interface{} { results := make([]interface{}, 0) if settings == nil { @@ -27,15 +27,13 @@ func flattenBatchPoolAutoScaleSettings(settings *batch.AutoScaleSettings) []inte result["evaluation_interval"] = *settings.EvaluationInterval } - if settings.Formula != nil { - result["formula"] = *settings.Formula - } + result["formula"] = settings.Formula return append(results, result) } // flattenBatchPoolFixedScaleSettings flattens the fixed scale settings for a Batch pool -func flattenBatchPoolFixedScaleSettings(d *pluginsdk.ResourceData, settings *batch.FixedScaleSettings) []interface{} { +func flattenBatchPoolFixedScaleSettings(d *pluginsdk.ResourceData, settings *pool.FixedScaleSettings) []interface{} { results := make([]interface{}, 0) if settings == nil { @@ -66,7 +64,7 @@ func flattenBatchPoolFixedScaleSettings(d *pluginsdk.ResourceData, settings *bat } // flattenBatchPoolImageReference flattens the Batch pool image reference -func flattenBatchPoolImageReference(image *batch.ImageReference) []interface{} { +func flattenBatchPoolImageReference(image *pool.ImageReference) []interface{} { results := make([]interface{}, 0) if image == nil { log.Printf("[DEBUG] image is nil") @@ -86,15 +84,15 @@ func flattenBatchPoolImageReference(image *batch.ImageReference) []interface{} { if image.Version != nil { result["version"] = *image.Version } - if image.ID != nil { - result["id"] = *image.ID + if image.Id != nil { + result["id"] = *image.Id } return append(results, result) } // flattenBatchPoolStartTask flattens a Batch pool start task -func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *batch.StartTask) []interface{} { +func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *pool.StartTask) []interface{} { results := make([]interface{}, 0) if startTask == nil { @@ -111,8 +109,10 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat if startTask.ContainerSettings != nil { containerSettings := make(map[string]interface{}) - containerSettings["image_name"] = *startTask.ContainerSettings.ImageName - containerSettings["working_directory"] = string(startTask.ContainerSettings.WorkingDirectory) + containerSettings["image_name"] = startTask.ContainerSettings.ImageName + if startTask.ContainerSettings.WorkingDirectory != nil { + containerSettings["working_directory"] = string(*startTask.ContainerSettings.WorkingDirectory) + } if startTask.ContainerSettings.ContainerRunOptions != nil { containerSettings["run_options"] = *startTask.ContainerSettings.ContainerRunOptions } @@ -134,7 +134,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat } result["wait_for_success"] = waitForSuccess - maxTaskRetryCount := int32(0) + maxTaskRetryCount := int64(0) if startTask.MaxTaskRetryCount != nil { maxTaskRetryCount = *startTask.MaxTaskRetryCount } @@ -146,12 +146,13 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat if startTask.UserIdentity.AutoUser != nil { autoUser := make(map[string]interface{}) - elevationLevel := string(startTask.UserIdentity.AutoUser.ElevationLevel) - scope := string(startTask.UserIdentity.AutoUser.Scope) - - autoUser["elevation_level"] = elevationLevel - autoUser["scope"] = scope + if startTask.UserIdentity.AutoUser.ElevationLevel != nil { + autoUser["elevation_level"] = string(*startTask.UserIdentity.AutoUser.ElevationLevel) + } + if startTask.UserIdentity.AutoUser.Scope != nil { + autoUser["scope"] = string(*startTask.UserIdentity.AutoUser.Scope) + } userIdentity["auto_user"] = []interface{}{autoUser} } else { userIdentity["user_name"] = *startTask.UserIdentity.UserName @@ -167,11 +168,11 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat if armResourceFile.AutoStorageContainerName != nil { resourceFile["auto_storage_container_name"] = *armResourceFile.AutoStorageContainerName } - if armResourceFile.StorageContainerURL != nil { - resourceFile["storage_container_url"] = *armResourceFile.StorageContainerURL + if armResourceFile.StorageContainerUrl != nil { + resourceFile["storage_container_url"] = *armResourceFile.StorageContainerUrl } - if armResourceFile.HTTPURL != nil { - resourceFile["http_url"] = *armResourceFile.HTTPURL + if armResourceFile.HTTPUrl != nil { + resourceFile["http_url"] = *armResourceFile.HTTPUrl } if armResourceFile.BlobPrefix != nil { resourceFile["blob_prefix"] = *armResourceFile.BlobPrefix @@ -183,7 +184,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat resourceFile["file_mode"] = *armResourceFile.FileMode } if armResourceFile.IdentityReference != nil { - resourceFile["user_assigned_identity_id"] = *armResourceFile.IdentityReference.ResourceID + resourceFile["user_assigned_identity_id"] = *armResourceFile.IdentityReference.ResourceId } resourceFiles = append(resourceFiles, resourceFile) } @@ -192,7 +193,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat environment := make(map[string]interface{}) if startTask.EnvironmentSettings != nil { for _, envSetting := range *startTask.EnvironmentSettings { - environment[*envSetting.Name] = *envSetting.Value + environment[envSetting.Name] = *envSetting.Value } } @@ -204,7 +205,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat } // flattenBatchPoolCertificateReferences flattens a Batch pool certificate reference -func flattenBatchPoolCertificateReferences(armCertificates *[]batch.CertificateReference) []interface{} { +func flattenBatchPoolCertificateReferences(armCertificates *[]pool.CertificateReference) []interface{} { if armCertificates == nil { return []interface{}{} } @@ -212,10 +213,11 @@ func flattenBatchPoolCertificateReferences(armCertificates *[]batch.CertificateR for _, armCertificate := range *armCertificates { certificate := map[string]interface{}{} - if armCertificate.ID != nil { - certificate["id"] = *armCertificate.ID + + certificate["id"] = armCertificate.Id + if armCertificate.StoreLocation != nil { + certificate["store_location"] = string(*armCertificate.StoreLocation) } - certificate["store_location"] = string(armCertificate.StoreLocation) if armCertificate.StoreName != nil { certificate["store_name"] = *armCertificate.StoreName } @@ -232,16 +234,14 @@ func flattenBatchPoolCertificateReferences(armCertificates *[]batch.CertificateR } // flattenBatchPoolContainerConfiguration flattens a Batch pool container configuration -func flattenBatchPoolContainerConfiguration(d *pluginsdk.ResourceData, armContainerConfiguration *batch.ContainerConfiguration) interface{} { +func flattenBatchPoolContainerConfiguration(d *pluginsdk.ResourceData, armContainerConfiguration *pool.ContainerConfiguration) interface{} { result := make(map[string]interface{}) if armContainerConfiguration == nil { return nil } - if armContainerConfiguration.Type != nil { - result["type"] = *armContainerConfiguration.Type - } + result["type"] = armContainerConfiguration.Type names := &pluginsdk.Set{F: pluginsdk.HashString} if armContainerConfiguration.ContainerImageNames != nil { @@ -256,7 +256,7 @@ func flattenBatchPoolContainerConfiguration(d *pluginsdk.ResourceData, armContai return []interface{}{result} } -func flattenBatchPoolContainerRegistries(d *pluginsdk.ResourceData, armContainerRegistries *[]batch.ContainerRegistry) []interface{} { +func flattenBatchPoolContainerRegistries(d *pluginsdk.ResourceData, armContainerRegistries *[]pool.ContainerRegistry) []interface{} { results := make([]interface{}, 0) if armContainerRegistries == nil { @@ -271,7 +271,7 @@ func flattenBatchPoolContainerRegistries(d *pluginsdk.ResourceData, armContainer return results } -func flattenBatchPoolContainerRegistry(d *pluginsdk.ResourceData, armContainerRegistry *batch.ContainerRegistry) map[string]interface{} { +func flattenBatchPoolContainerRegistry(d *pluginsdk.ResourceData, armContainerRegistry *pool.ContainerRegistry) map[string]interface{} { result := make(map[string]interface{}) if armContainerRegistry == nil { @@ -282,14 +282,16 @@ func flattenBatchPoolContainerRegistry(d *pluginsdk.ResourceData, armContainerRe result["registry_server"] = *registryServer } - if userName := armContainerRegistry.UserName; userName != nil { + if userName := armContainerRegistry.Username; userName != nil { result["user_name"] = *userName // Locate the password only if user_name is defined result["password"] = findBatchPoolContainerRegistryPassword(d, result["registry_server"].(string), result["user_name"].(string)) } if identity := armContainerRegistry.IdentityReference; identity != nil { - result["user_assigned_identity_id"] = identity.ResourceID + if identity.ResourceId != nil { + result["user_assigned_identity_id"] = *identity.ResourceId + } } return result @@ -328,18 +330,18 @@ func findSensitiveInfoForMountConfig(targetType string, sourceType string, sourc return "" } -func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountConfiguration) map[string]interface{} { +func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *pool.MountConfiguration) map[string]interface{} { mountConfig := make(map[string]interface{}) switch { case config.AzureBlobFileSystemConfiguration != nil: azureBlobFileSysConfigList := make([]interface{}, 0) azureBlobFileSysConfig := make(map[string]interface{}) - azureBlobFileSysConfig["account_name"] = *config.AzureBlobFileSystemConfiguration.AccountName - azureBlobFileSysConfig["container_name"] = *config.AzureBlobFileSystemConfiguration.ContainerName - azureBlobFileSysConfig["relative_mount_path"] = *config.AzureBlobFileSystemConfiguration.RelativeMountPath - azureBlobFileSysConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", *config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) - azureBlobFileSysConfig["sas_key"] = findSensitiveInfoForMountConfig("sas_key", "account_name", *config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) + azureBlobFileSysConfig["account_name"] = config.AzureBlobFileSystemConfiguration.AccountName + azureBlobFileSysConfig["container_name"] = config.AzureBlobFileSystemConfiguration.ContainerName + azureBlobFileSysConfig["relative_mount_path"] = config.AzureBlobFileSystemConfiguration.RelativeMountPath + azureBlobFileSysConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) + azureBlobFileSysConfig["sas_key"] = findSensitiveInfoForMountConfig("sas_key", "account_name", config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) if config.AzureBlobFileSystemConfiguration.IdentityReference != nil { azureBlobFileSysConfig["identity_id"] = flattenBatchPoolIdentityReferenceToIdentityID(config.AzureBlobFileSystemConfiguration.IdentityReference) } @@ -351,10 +353,10 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC case config.AzureFileShareConfiguration != nil: azureFileShareConfigList := make([]interface{}, 0) azureFileShareConfig := make(map[string]interface{}) - azureFileShareConfig["account_name"] = *config.AzureFileShareConfiguration.AccountName - azureFileShareConfig["azure_file_url"] = *config.AzureFileShareConfiguration.AzureFileURL - azureFileShareConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", *config.AzureFileShareConfiguration.AccountName, "azure_file_share", d) - azureFileShareConfig["relative_mount_path"] = *config.AzureFileShareConfiguration.RelativeMountPath + azureFileShareConfig["account_name"] = config.AzureFileShareConfiguration.AccountName + azureFileShareConfig["azure_file_url"] = config.AzureFileShareConfiguration.AzureFileUrl + azureFileShareConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", config.AzureFileShareConfiguration.AccountName, "azure_file_share", d) + azureFileShareConfig["relative_mount_path"] = config.AzureFileShareConfiguration.RelativeMountPath if config.AzureFileShareConfiguration.MountOptions != nil { azureFileShareConfig["mount_options"] = *config.AzureFileShareConfiguration.MountOptions @@ -367,10 +369,10 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC cifsMountConfigList := make([]interface{}, 0) cifsMountConfig := make(map[string]interface{}) - cifsMountConfig["user_name"] = *config.CifsMountConfiguration.Username - cifsMountConfig["password"] = findSensitiveInfoForMountConfig("password", "user_name", *config.CifsMountConfiguration.Username, "cifs_mount", d) - cifsMountConfig["source"] = *config.CifsMountConfiguration.Source - cifsMountConfig["relative_mount_path"] = *config.CifsMountConfiguration.RelativeMountPath + cifsMountConfig["user_name"] = config.CifsMountConfiguration.Username + cifsMountConfig["password"] = findSensitiveInfoForMountConfig("password", "user_name", config.CifsMountConfiguration.Username, "cifs_mount", d) + cifsMountConfig["source"] = config.CifsMountConfiguration.Source + cifsMountConfig["relative_mount_path"] = config.CifsMountConfiguration.RelativeMountPath if config.CifsMountConfiguration.MountOptions != nil { cifsMountConfig["mount_options"] = *config.CifsMountConfiguration.MountOptions @@ -382,8 +384,8 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC nfsMountConfigList := make([]interface{}, 0) nfsMountConfig := make(map[string]interface{}) - nfsMountConfig["source"] = *config.NfsMountConfiguration.Source - nfsMountConfig["relative_mount_path"] = *config.NfsMountConfiguration.RelativeMountPath + nfsMountConfig["source"] = config.NfsMountConfiguration.Source + nfsMountConfig["relative_mount_path"] = config.NfsMountConfiguration.RelativeMountPath if config.NfsMountConfiguration.MountOptions != nil { nfsMountConfig["mount_options"] = *config.NfsMountConfiguration.MountOptions @@ -398,23 +400,25 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC return mountConfig } -func flattenBatchPoolIdentityReferenceToIdentityID(ref *batch.ComputeNodeIdentityReference) string { - if ref != nil && ref.ResourceID != nil { - return *ref.ResourceID +func flattenBatchPoolIdentityReferenceToIdentityID(ref *pool.ComputeNodeIdentityReference) string { + if ref != nil && ref.ResourceId != nil { + return *ref.ResourceId } return "" } -func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserAccount) map[string]interface{} { +func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *pool.UserAccount) map[string]interface{} { userAccount := make(map[string]interface{}) - userAccount["name"] = *account.Name - userAccount["elevation_level"] = string(account.ElevationLevel) + userAccount["name"] = account.Name + if account.ElevationLevel != nil { + userAccount["elevation_level"] = string(*account.ElevationLevel) + } userAccountIndex := -1 if num, ok := d.GetOk("user_accounts.#"); ok { n := num.(int) for i := 0; i < n; i++ { - if src, nameOk := d.GetOk(fmt.Sprintf("user_accounts.%d.name", i)); nameOk && src == *account.Name { + if src, nameOk := d.GetOk(fmt.Sprintf("user_accounts.%d.name", i)); nameOk && src == account.Name { userAccount["password"] = d.Get(fmt.Sprintf("user_accounts.%d.password", i)).(string) userAccountIndex = i break @@ -425,8 +429,8 @@ func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserA if account.LinuxUserConfiguration != nil { linuxUserConfig := make(map[string]interface{}) - if account.LinuxUserConfiguration.UID != nil { - linuxUserConfig["uid"] = *account.LinuxUserConfiguration.UID + if account.LinuxUserConfiguration.Uid != nil { + linuxUserConfig["uid"] = *account.LinuxUserConfiguration.Uid linuxUserConfig["gid"] = *account.LinuxUserConfiguration.Gid } @@ -443,7 +447,9 @@ func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserA if account.WindowsUserConfiguration != nil { loginMode := make(map[string]interface{}) - loginMode["login_mode"] = string(account.WindowsUserConfiguration.LoginMode) + if account.WindowsUserConfiguration.LoginMode != nil { + loginMode["login_mode"] = string(*account.WindowsUserConfiguration.LoginMode) + } userAccount["windows_user_configuration"] = []interface{}{ loginMode, } @@ -452,17 +458,17 @@ func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserA } // ExpandBatchPoolImageReference expands Batch pool image reference -func ExpandBatchPoolImageReference(list []interface{}) (*batch.ImageReference, error) { +func ExpandBatchPoolImageReference(list []interface{}) (*pool.ImageReference, error) { if len(list) == 0 || list[0] == nil { - return nil, fmt.Errorf("Error: storage image reference should be defined") + return nil, fmt.Errorf("storage image reference should be defined") } storageImageRef := list[0].(map[string]interface{}) - imageRef := &batch.ImageReference{} + imageRef := &pool.ImageReference{} if storageImageRef["id"] != nil && storageImageRef["id"] != "" { storageImageRefID := storageImageRef["id"].(string) - imageRef.ID = &storageImageRefID + imageRef.Id = &storageImageRefID } if storageImageRef["offer"] != nil && storageImageRef["offer"] != "" { @@ -489,7 +495,7 @@ func ExpandBatchPoolImageReference(list []interface{}) (*batch.ImageReference, e } // ExpandBatchPoolContainerConfiguration expands the Batch pool container configuration -func ExpandBatchPoolContainerConfiguration(list []interface{}) (*batch.ContainerConfiguration, error) { +func ExpandBatchPoolContainerConfiguration(list []interface{}) (*pool.ContainerConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, nil } @@ -501,8 +507,8 @@ func ExpandBatchPoolContainerConfiguration(list []interface{}) (*batch.Container return nil, err } - obj := &batch.ContainerConfiguration{ - Type: utils.String(block["type"].(string)), + obj := &pool.ContainerConfiguration{ + Type: pool.ContainerType(block["type"].(string)), ContainerRegistries: containerRegistries, ContainerImageNames: utils.ExpandStringSlice(block["container_image_names"].(*pluginsdk.Set).List()), } @@ -510,8 +516,8 @@ func ExpandBatchPoolContainerConfiguration(list []interface{}) (*batch.Container return obj, nil } -func expandBatchPoolContainerRegistries(list []interface{}) (*[]batch.ContainerRegistry, error) { - result := []batch.ContainerRegistry{} +func expandBatchPoolContainerRegistries(list []interface{}) (*[]pool.ContainerRegistry, error) { + result := []pool.ContainerRegistry{} for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -524,25 +530,25 @@ func expandBatchPoolContainerRegistries(list []interface{}) (*[]batch.ContainerR return &result, nil } -func expandBatchPoolContainerRegistry(ref map[string]interface{}) (*batch.ContainerRegistry, error) { +func expandBatchPoolContainerRegistry(ref map[string]interface{}) (*pool.ContainerRegistry, error) { if len(ref) == 0 { - return nil, fmt.Errorf("Error: container registry reference should be defined") + return nil, fmt.Errorf("container registry reference should be defined") } - containerRegistry := batch.ContainerRegistry{} + containerRegistry := pool.ContainerRegistry{} if v := ref["registry_server"]; v != nil && v != "" { containerRegistry.RegistryServer = pointer.FromString(v.(string)) } if v := ref["user_name"]; v != nil && v != "" { - containerRegistry.UserName = pointer.FromString(v.(string)) + containerRegistry.Username = pointer.FromString(v.(string)) } if v := ref["password"]; v != nil && v != "" { containerRegistry.Password = pointer.FromString(v.(string)) } if v := ref["user_assigned_identity_id"]; v != nil && v != "" { - containerRegistry.IdentityReference = &batch.ComputeNodeIdentityReference{ - ResourceID: pointer.FromString(v.(string)), + containerRegistry.IdentityReference = &pool.ComputeNodeIdentityReference{ + ResourceId: pointer.FromString(v.(string)), } } @@ -550,8 +556,8 @@ func expandBatchPoolContainerRegistry(ref map[string]interface{}) (*batch.Contai } // ExpandBatchPoolCertificateReferences expands Batch pool certificate references -func ExpandBatchPoolCertificateReferences(list []interface{}) (*[]batch.CertificateReference, error) { - var result []batch.CertificateReference +func ExpandBatchPoolCertificateReferences(list []interface{}) (*[]pool.CertificateReference, error) { + var result []pool.CertificateReference for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -564,7 +570,7 @@ func ExpandBatchPoolCertificateReferences(list []interface{}) (*[]batch.Certific return &result, nil } -func expandBatchPoolCertificateReference(ref map[string]interface{}) (*batch.CertificateReference, error) { +func expandBatchPoolCertificateReference(ref map[string]interface{}) (*pool.CertificateReference, error) { if len(ref) == 0 { return nil, fmt.Errorf("Error: storage image reference should be defined") } @@ -573,16 +579,16 @@ func expandBatchPoolCertificateReference(ref map[string]interface{}) (*batch.Cer storeLocation := ref["store_location"].(string) storeName := ref["store_name"].(string) visibilityRefs := ref["visibility"].(*pluginsdk.Set) - var visibility []batch.CertificateVisibility + var visibility []pool.CertificateVisibility if visibilityRefs != nil { for _, visibilityRef := range visibilityRefs.List() { - visibility = append(visibility, batch.CertificateVisibility(visibilityRef.(string))) + visibility = append(visibility, pool.CertificateVisibility(visibilityRef.(string))) } } - certificateReference := &batch.CertificateReference{ - ID: &id, - StoreLocation: batch.CertificateStoreLocation(storeLocation), + certificateReference := &pool.CertificateReference{ + Id: id, + StoreLocation: pointer.To(pool.CertificateStoreLocation(storeLocation)), StoreName: &storeName, Visibility: &visibility, } @@ -590,7 +596,7 @@ func expandBatchPoolCertificateReference(ref map[string]interface{}) (*batch.Cer } // ExpandBatchPoolStartTask expands Batch pool start task -func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { +func ExpandBatchPoolStartTask(list []interface{}) (*pool.StartTask, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("batch pool start task should be defined") } @@ -599,10 +605,10 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { startTaskCmdLine := startTaskValue["command_line"].(string) - maxTaskRetryCount := int32(1) + maxTaskRetryCount := int64(1) if v := startTaskValue["task_retry_maximum"].(int); v > 0 { - maxTaskRetryCount = int32(v) + maxTaskRetryCount = int64(v) } waitForSuccess := startTaskValue["wait_for_success"].(bool) @@ -613,15 +619,15 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { } userIdentityValue := userIdentityList[0].(map[string]interface{}) - userIdentity := batch.UserIdentity{} + userIdentity := pool.UserIdentity{} if autoUserValue, ok := userIdentityValue["auto_user"]; ok { autoUser := autoUserValue.([]interface{}) if len(autoUser) != 0 { autoUserMap := autoUser[0].(map[string]interface{}) - userIdentity.AutoUser = &batch.AutoUserSpecification{ - ElevationLevel: batch.ElevationLevel(autoUserMap["elevation_level"].(string)), - Scope: batch.AutoUserScope(autoUserMap["scope"].(string)), + userIdentity.AutoUser = &pool.AutoUserSpecification{ + ElevationLevel: pointer.To(pool.ElevationLevel(autoUserMap["elevation_level"].(string))), + Scope: pointer.To(pool.AutoUserScope(autoUserMap["scope"].(string))), } } } @@ -633,13 +639,13 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { } resourceFileList := startTaskValue["resource_file"].([]interface{}) - resourceFiles := make([]batch.ResourceFile, 0) + resourceFiles := make([]pool.ResourceFile, 0) for _, resourceFileValueTemp := range resourceFileList { if resourceFileValueTemp == nil { continue } resourceFileValue := resourceFileValueTemp.(map[string]interface{}) - resourceFile := batch.ResourceFile{} + resourceFile := pool.ResourceFile{} if v, ok := resourceFileValue["auto_storage_container_name"]; ok { autoStorageContainerName := v.(string) if autoStorageContainerName != "" { @@ -649,13 +655,13 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { if v, ok := resourceFileValue["storage_container_url"]; ok { storageContainerURL := v.(string) if storageContainerURL != "" { - resourceFile.StorageContainerURL = &storageContainerURL + resourceFile.StorageContainerUrl = &storageContainerURL } } if v, ok := resourceFileValue["http_url"]; ok { httpURL := v.(string) if httpURL != "" { - resourceFile.HTTPURL = &httpURL + resourceFile.HTTPUrl = &httpURL } } if v, ok := resourceFileValue["blob_prefix"]; ok { @@ -679,8 +685,8 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { if v, ok := resourceFileValue["user_assigned_identity_id"]; ok { resourceId := v.(string) if resourceId != "" { - identityReference := batch.ComputeNodeIdentityReference{ - ResourceID: utils.String(resourceId), + identityReference := pool.ComputeNodeIdentityReference{ + ResourceId: utils.String(resourceId), } resourceFile.IdentityReference = &identityReference } @@ -688,7 +694,7 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { resourceFiles = append(resourceFiles, resourceFile) } - startTask := &batch.StartTask{ + startTask := &pool.StartTask{ CommandLine: &startTaskCmdLine, MaxTaskRetryCount: &maxTaskRetryCount, WaitForSuccess: &waitForSuccess, @@ -701,12 +707,12 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { } if startTaskValue["container"] != nil && len(startTaskValue["container"].([]interface{})) > 0 { - var containerSettings batch.TaskContainerSettings + var containerSettings pool.TaskContainerSettings containerSettingsList := startTaskValue["container"].([]interface{}) if len(containerSettingsList) > 0 && containerSettingsList[0] != nil { settingMap := containerSettingsList[0].(map[string]interface{}) - containerSettings.ImageName = utils.String(settingMap["image_name"].(string)) + containerSettings.ImageName = settingMap["image_name"].(string) if containerRunOptions, ok := settingMap["run_options"]; ok { containerSettings.ContainerRunOptions = utils.String(containerRunOptions.(string)) } @@ -717,7 +723,7 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { } } if workingDir, ok := settingMap["working_directory"]; ok { - containerSettings.WorkingDirectory = batch.ContainerWorkingDirectory(workingDir.(string)) + containerSettings.WorkingDirectory = pointer.To(pool.ContainerWorkingDirectory(workingDir.(string))) } } startTask.ContainerSettings = &containerSettings @@ -726,21 +732,21 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { return startTask, nil } -func expandBatchPoolVirtualMachineConfig(d *pluginsdk.ResourceData) (*batch.VirtualMachineConfiguration, error) { - var result batch.VirtualMachineConfiguration +func expandBatchPoolVirtualMachineConfig(d *pluginsdk.ResourceData) (*pool.VirtualMachineConfiguration, error) { + var result pool.VirtualMachineConfiguration - result.NodeAgentSkuID = utils.String(d.Get("node_agent_sku_id").(string)) + result.NodeAgentSkuId = d.Get("node_agent_sku_id").(string) storageImageReferenceSet := d.Get("storage_image_reference").([]interface{}) if imageReference, err := ExpandBatchPoolImageReference(storageImageReferenceSet); err == nil { if imageReference != nil { // if an image reference ID is specified, the user wants use a custom image. This property is mutually exclusive with other properties. - if imageReference.ID != nil && (imageReference.Offer != nil || imageReference.Publisher != nil || imageReference.Sku != nil || imageReference.Version != nil) { + if imageReference.Id != nil && (imageReference.Offer != nil || imageReference.Publisher != nil || imageReference.Sku != nil || imageReference.Version != nil) { return nil, fmt.Errorf("properties version, offer, publish cannot be defined when using a custom image id") - } else if imageReference.ID == nil && (imageReference.Offer == nil || imageReference.Publisher == nil || imageReference.Sku == nil || imageReference.Version == nil) { + } else if imageReference.Id == nil && (imageReference.Offer == nil || imageReference.Publisher == nil || imageReference.Sku == nil || imageReference.Version == nil) { return nil, fmt.Errorf("properties version, offer, publish and sku are mandatory when not using a custom image") } - result.ImageReference = imageReference + result.ImageReference = *imageReference } } else { return nil, fmt.Errorf("storage_image_reference either is empty or contains parsing errors") @@ -783,45 +789,45 @@ func expandBatchPoolVirtualMachineConfig(d *pluginsdk.ResourceData) (*batch.Virt return &result, nil } -func expandBatchPoolOSDisk(ref interface{}) (*batch.OSDisk, error) { +func expandBatchPoolOSDisk(ref interface{}) (*pool.OSDisk, error) { if ref == nil { return nil, fmt.Errorf("os_disk_placement is empty") } - return &batch.OSDisk{ - EphemeralOSDiskSettings: &batch.DiffDiskSettings{ - Placement: batch.DiffDiskPlacement(ref.(string)), + return &pool.OSDisk{ + EphemeralOSDiskSettings: &pool.DiffDiskSettings{ + Placement: pointer.To(pool.DiffDiskPlacement(ref.(string))), }, }, nil } -func expandBatchPoolNodeReplacementConfig(list []interface{}) (*batch.NodePlacementConfiguration, error) { +func expandBatchPoolNodeReplacementConfig(list []interface{}) (*pool.NodePlacementConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("node_placement is empty") } item := list[0].(map[string]interface{})["policy"].(string) - return &batch.NodePlacementConfiguration{ - Policy: batch.NodePlacementPolicyType(item), + return &pool.NodePlacementConfiguration{ + Policy: pointer.To(pool.NodePlacementPolicyType(item)), }, nil } -func expandBatchPoolWindowsConfiguration(list []interface{}) (*batch.WindowsConfiguration, error) { +func expandBatchPoolWindowsConfiguration(list []interface{}) (*pool.WindowsConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("windows is empty") } item := list[0].(map[string]interface{})["enable_automatic_updates"].(bool) - return &batch.WindowsConfiguration{ + return &pool.WindowsConfiguration{ EnableAutomaticUpdates: utils.Bool(item), }, nil } -func expandBatchPoolExtensions(list []interface{}) (*[]batch.VMExtension, error) { +func expandBatchPoolExtensions(list []interface{}) (*[]pool.VmExtension, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("extensions is empty") } - var result []batch.VMExtension + var result []pool.VmExtension for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -835,15 +841,15 @@ func expandBatchPoolExtensions(list []interface{}) (*[]batch.VMExtension, error) return &result, nil } -func expandBatchPoolExtension(ref map[string]interface{}) (*batch.VMExtension, error) { +func expandBatchPoolExtension(ref map[string]interface{}) (*pool.VmExtension, error) { if len(ref) == 0 { return nil, fmt.Errorf("extension is empty") } - result := batch.VMExtension{ - Name: utils.String(ref["name"].(string)), - Publisher: utils.String(ref["publisher"].(string)), - Type: utils.String(ref["type"].(string)), + result := pool.VmExtension{ + Name: ref["name"].(string), + Publisher: ref["publisher"].(string), + Type: ref["type"].(string), } if autoUpgradeMinorVersion, ok := ref["auto_upgrade_minor_version"]; ok { @@ -855,11 +861,11 @@ func expandBatchPoolExtension(ref map[string]interface{}) (*batch.VMExtension, e } if settings, ok := ref["settings_json"]; ok { - result.Settings = utils.String(settings.(string)) + result.Settings = pointer.To(settings) } if protectedSettings, ok := ref["protected_settings"]; ok { - result.ProtectedSettings = utils.String(protectedSettings.(string)) + result.ProtectedSettings = pointer.To(protectedSettings) } if tmpItem, ok := ref["provision_after_extensions"]; ok { @@ -869,18 +875,18 @@ func expandBatchPoolExtension(ref map[string]interface{}) (*batch.VMExtension, e return &result, nil } -func expandBatchPoolDiskEncryptionConfiguration(list []interface{}) (*batch.DiskEncryptionConfiguration, error) { +func expandBatchPoolDiskEncryptionConfiguration(list []interface{}) (*pool.DiskEncryptionConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("disk_encryption is empty") } - var result batch.DiskEncryptionConfiguration + var result pool.DiskEncryptionConfiguration - var targetList []batch.DiskEncryptionTarget + var targetList []pool.DiskEncryptionTarget for _, tempItem := range list { item := tempItem.(map[string]interface{}) if dataDiskEncryptionTarget, ok := item["disk_encryption_target"]; ok { - targetList = append(targetList, batch.DiskEncryptionTarget(dataDiskEncryptionTarget.(string))) + targetList = append(targetList, pool.DiskEncryptionTarget(dataDiskEncryptionTarget.(string))) } else { return nil, fmt.Errorf("disk_encryption_target either is empty or contains parsing errors") } @@ -890,11 +896,11 @@ func expandBatchPoolDiskEncryptionConfiguration(list []interface{}) (*batch.Disk return &result, nil } -func expandBatchPoolDataDisks(list []interface{}) (*[]batch.DataDisk, error) { +func expandBatchPoolDataDisks(list []interface{}) (*[]pool.DataDisk, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("data_disk is empty") } - var result []batch.DataDisk + var result []pool.DataDisk for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -904,23 +910,23 @@ func expandBatchPoolDataDisks(list []interface{}) (*[]batch.DataDisk, error) { return &result, nil } -func expandBatchPoolDataDisk(ref map[string]interface{}) batch.DataDisk { - return batch.DataDisk{ - Lun: utils.Int32(int32(ref["lun"].(int))), - Caching: batch.CachingType(ref["caching"].(string)), - DiskSizeGB: utils.Int32(int32(ref["disk_size_gb"].(int))), - StorageAccountType: batch.StorageAccountType(ref["storage_account_type"].(string)), +func expandBatchPoolDataDisk(ref map[string]interface{}) pool.DataDisk { + return pool.DataDisk{ + Lun: int64(ref["lun"].(int)), + Caching: pointer.To(pool.CachingType(ref["caching"].(string))), + DiskSizeGB: int64(ref["disk_size_gb"].(int)), + StorageAccountType: pointer.To(pool.StorageAccountType(ref["storage_account_type"].(string))), } } -func expandCommonEnvironmentProperties(env map[string]interface{}) *[]batch.EnvironmentSetting { - envSettings := make([]batch.EnvironmentSetting, 0) +func expandCommonEnvironmentProperties(env map[string]interface{}) *[]pool.EnvironmentSetting { + envSettings := make([]pool.EnvironmentSetting, 0) for k, v := range env { theValue := v.(string) theKey := k - envSetting := batch.EnvironmentSetting{ - Name: &theKey, + envSetting := pool.EnvironmentSetting{ + Name: theKey, Value: &theValue, } @@ -930,15 +936,15 @@ func expandCommonEnvironmentProperties(env map[string]interface{}) *[]batch.Envi } // ExpandBatchMetaData expands Batch pool metadata -func ExpandBatchMetaData(input map[string]interface{}) *[]batch.MetadataItem { - output := []batch.MetadataItem{} +func ExpandBatchMetaData(input map[string]interface{}) *[]pool.MetadataItem { + output := []pool.MetadataItem{} for k, v := range input { name := k value := v.(string) - output = append(output, batch.MetadataItem{ - Name: &name, - Value: &value, + output = append(output, pool.MetadataItem{ + Name: name, + Value: value, }) } @@ -946,7 +952,7 @@ func ExpandBatchMetaData(input map[string]interface{}) *[]batch.MetadataItem { } // FlattenBatchMetaData flattens a Batch pool metadata -func FlattenBatchMetaData(metadatas *[]batch.MetadataItem) map[string]interface{} { +func FlattenBatchMetaData(metadatas *[]pool.MetadataItem) map[string]interface{} { output := make(map[string]interface{}) if metadatas == nil { @@ -954,18 +960,14 @@ func FlattenBatchMetaData(metadatas *[]batch.MetadataItem) map[string]interface{ } for _, metadata := range *metadatas { - if metadata.Name == nil || metadata.Value == nil { - continue - } - - output[*metadata.Name] = *metadata.Value + output[metadata.Name] = metadata.Value } return output } -func ExpandBatchPoolMountConfigurations(d *pluginsdk.ResourceData) (*[]batch.MountConfiguration, error) { - var result []batch.MountConfiguration +func ExpandBatchPoolMountConfigurations(d *pluginsdk.ResourceData) (*[]pool.MountConfiguration, error) { + var result []pool.MountConfiguration if mountConfigs, ok := d.GetOk("mount"); ok { mountConfigList := mountConfigs.([]interface{}) @@ -979,8 +981,8 @@ func ExpandBatchPoolMountConfigurations(d *pluginsdk.ResourceData) (*[]batch.Mou return nil, fmt.Errorf("mount either is empty or contains parsing errors") } -func expandBatchPoolMountConfiguration(ref map[string]interface{}) batch.MountConfiguration { - var result batch.MountConfiguration +func expandBatchPoolMountConfiguration(ref map[string]interface{}) pool.MountConfiguration { + var result pool.MountConfiguration if azureBlobFileSystemConfiguration, err := expandBatchPoolAzureBlobFileSystemConfiguration(ref["azure_blob_file_system"].([]interface{})); err == nil { result.AzureBlobFileSystemConfiguration = azureBlobFileSystemConfiguration } @@ -1000,16 +1002,16 @@ func expandBatchPoolMountConfiguration(ref map[string]interface{}) batch.MountCo return result } -func expandBatchPoolAzureBlobFileSystemConfiguration(list []interface{}) (*batch.AzureBlobFileSystemConfiguration, interface{}) { +func expandBatchPoolAzureBlobFileSystemConfiguration(list []interface{}) (*pool.AzureBlobFileSystemConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("azure_blob_file_system is empty") } configMap := list[0].(map[string]interface{}) - result := batch.AzureBlobFileSystemConfiguration{ - AccountName: utils.String(configMap["account_name"].(string)), - ContainerName: utils.String(configMap["container_name"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.AzureBlobFileSystemConfiguration{ + AccountName: configMap["account_name"].(string), + ContainerName: configMap["container_name"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if accountKey, ok := configMap["account_key"]; ok { @@ -1026,17 +1028,17 @@ func expandBatchPoolAzureBlobFileSystemConfiguration(list []interface{}) (*batch return &result, nil } -func expandBatchPoolAzureFileShareConfiguration(list []interface{}) (*batch.AzureFileShareConfiguration, interface{}) { +func expandBatchPoolAzureFileShareConfiguration(list []interface{}) (*pool.AzureFileShareConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("azure_file_share is empty") } configMap := list[0].(map[string]interface{}) - result := batch.AzureFileShareConfiguration{ - AccountName: utils.String(configMap["account_name"].(string)), - AccountKey: utils.String(configMap["account_key"].(string)), - AzureFileURL: utils.String(configMap["azure_file_url"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.AzureFileShareConfiguration{ + AccountName: configMap["account_name"].(string), + AccountKey: configMap["account_key"].(string), + AzureFileUrl: configMap["azure_file_url"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if mountOptions, ok := configMap["mount_options"]; ok { @@ -1046,17 +1048,17 @@ func expandBatchPoolAzureFileShareConfiguration(list []interface{}) (*batch.Azur return &result, nil } -func expandBatchPoolCIFSMountConfiguration(list []interface{}) (*batch.CIFSMountConfiguration, interface{}) { +func expandBatchPoolCIFSMountConfiguration(list []interface{}) (*pool.CIFSMountConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("cifs_mount is empty") } configMap := list[0].(map[string]interface{}) - result := batch.CIFSMountConfiguration{ - Username: utils.String(configMap["user_name"].(string)), - Source: utils.String(configMap["source"].(string)), - Password: utils.String(configMap["password"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.CIFSMountConfiguration{ + Username: configMap["user_name"].(string), + Source: configMap["source"].(string), + Password: configMap["password"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if mountOptions, ok := configMap["mount_options"]; ok { @@ -1066,15 +1068,15 @@ func expandBatchPoolCIFSMountConfiguration(list []interface{}) (*batch.CIFSMount return &result, nil } -func expandBatchPoolNFSMountConfiguration(list []interface{}) (*batch.NFSMountConfiguration, interface{}) { +func expandBatchPoolNFSMountConfiguration(list []interface{}) (*pool.NFSMountConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("nfs_mount is empty") } configMap := list[0].(map[string]interface{}) - result := batch.NFSMountConfiguration{ - Source: utils.String(configMap["source"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.NFSMountConfiguration{ + Source: configMap["source"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if mountOptions, ok := configMap["mount_options"]; ok { @@ -1083,37 +1085,37 @@ func expandBatchPoolNFSMountConfiguration(list []interface{}) (*batch.NFSMountCo return &result, nil } -func expandBatchPoolIdentityReference(ref map[string]interface{}) (*batch.ComputeNodeIdentityReference, error) { - var result batch.ComputeNodeIdentityReference +func expandBatchPoolIdentityReference(ref map[string]interface{}) (*pool.ComputeNodeIdentityReference, error) { + var result pool.ComputeNodeIdentityReference if iid, ok := ref["identity_id"]; ok && iid != "" { - result.ResourceID = utils.String(iid.(string)) + result.ResourceId = utils.String(iid.(string)) return &result, nil } return nil, fmt.Errorf("identity_id is empty") } // ExpandBatchPoolNetworkConfiguration expands Batch pool network configuration -func ExpandBatchPoolNetworkConfiguration(list []interface{}) (*batch.NetworkConfiguration, error) { +func ExpandBatchPoolNetworkConfiguration(list []interface{}) (*pool.NetworkConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, nil } networkConfigValue := list[0].(map[string]interface{}) - networkConfiguration := &batch.NetworkConfiguration{} + networkConfiguration := &pool.NetworkConfiguration{} if v, ok := networkConfigValue["dynamic_vnet_assignment_scope"]; ok { - networkConfiguration.DynamicVNetAssignmentScope = batch.DynamicVNetAssignmentScope(v.(string)) + networkConfiguration.DynamicVNetAssignmentScope = pointer.To(pool.DynamicVNetAssignmentScope(v.(string))) } if v, ok := networkConfigValue["subnet_id"]; ok { if value := v.(string); value != "" { - networkConfiguration.SubnetID = &value + networkConfiguration.SubnetId = &value } } if v, ok := networkConfigValue["public_ips"]; ok { if networkConfiguration.PublicIPAddressConfiguration == nil { - networkConfiguration.PublicIPAddressConfiguration = &batch.PublicIPAddressConfiguration{} + networkConfiguration.PublicIPAddressConfiguration = &pool.PublicIPAddressConfiguration{} } publicIPsRaw := v.(*pluginsdk.Set).List() @@ -1130,43 +1132,43 @@ func ExpandBatchPoolNetworkConfiguration(list []interface{}) (*batch.NetworkConf if v, ok := networkConfigValue["public_address_provisioning_type"]; ok { if networkConfiguration.PublicIPAddressConfiguration == nil { - networkConfiguration.PublicIPAddressConfiguration = &batch.PublicIPAddressConfiguration{} + networkConfiguration.PublicIPAddressConfiguration = &pool.PublicIPAddressConfiguration{} } if value := v.(string); value != "" { - networkConfiguration.PublicIPAddressConfiguration.Provision = batch.IPAddressProvisioningType(value) + networkConfiguration.PublicIPAddressConfiguration.Provision = pointer.To(pool.IPAddressProvisioningType(value)) } } return networkConfiguration, nil } -func ExpandBatchPoolTaskSchedulingPolicy(d *pluginsdk.ResourceData) (*batch.TaskSchedulingPolicy, error) { - var result batch.TaskSchedulingPolicy +func ExpandBatchPoolTaskSchedulingPolicy(d *pluginsdk.ResourceData) (*pool.TaskSchedulingPolicy, error) { + var result pool.TaskSchedulingPolicy if taskSchedulingPolicyString, ok := d.GetOk("task_scheduling_policy"); ok { taskSchedulingPolicy := taskSchedulingPolicyString.([]interface{}) if len(taskSchedulingPolicy) > 0 { item := taskSchedulingPolicy[0].(map[string]interface{}) - result.NodeFillType = batch.ComputeNodeFillType(item["node_fill_type"].(string)) + result.NodeFillType = pool.ComputeNodeFillType(item["node_fill_type"].(string)) } return &result, nil } return nil, fmt.Errorf("task_scheduling_policy either is empty or contains parsing errors") } -func expandPoolEndpointConfiguration(list []interface{}) (*batch.PoolEndpointConfiguration, error) { +func expandPoolEndpointConfiguration(list []interface{}) (*pool.PoolEndpointConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, nil } - inboundNatPools := make([]batch.InboundNatPool, len(list)) + inboundNatPools := make([]pool.InboundNatPool, len(list)) for i, inboundNatPoolsValue := range list { inboundNatPool := inboundNatPoolsValue.(map[string]interface{}) name := inboundNatPool["name"].(string) - protocol := batch.InboundEndpointProtocol(inboundNatPool["protocol"].(string)) + protocol := pool.InboundEndpointProtocol(inboundNatPool["protocol"].(string)) backendPort := int32(inboundNatPool["backend_port"].(int)) frontendPortRange := inboundNatPool["frontend_port_range"].(string) parts := strings.Split(frontendPortRange, "-") @@ -1181,37 +1183,37 @@ func expandPoolEndpointConfiguration(list []interface{}) (*batch.PoolEndpointCon networkSecurityGroupRules := expandPoolNetworkSecurityGroupRule(inboundNatPool["network_security_group_rules"].([]interface{})) - inboundNatPools[i] = batch.InboundNatPool{ - Name: &name, + inboundNatPools[i] = pool.InboundNatPool{ + Name: name, Protocol: protocol, - BackendPort: &backendPort, - FrontendPortRangeStart: utils.Int32(int32(frontendPortRangeStart)), - FrontendPortRangeEnd: utils.Int32(int32(frontendPortRangeEnd)), + BackendPort: int64(backendPort), + FrontendPortRangeStart: int64(frontendPortRangeStart), + FrontendPortRangeEnd: int64(frontendPortRangeEnd), NetworkSecurityGroupRules: &networkSecurityGroupRules, } } - return &batch.PoolEndpointConfiguration{ - InboundNatPools: &inboundNatPools, + return &pool.PoolEndpointConfiguration{ + InboundNatPools: inboundNatPools, }, nil } -func expandPoolNetworkSecurityGroupRule(list []interface{}) []batch.NetworkSecurityGroupRule { +func expandPoolNetworkSecurityGroupRule(list []interface{}) []pool.NetworkSecurityGroupRule { if len(list) == 0 || list[0] == nil { - return []batch.NetworkSecurityGroupRule{} + return []pool.NetworkSecurityGroupRule{} } - networkSecurityGroupRule := make([]batch.NetworkSecurityGroupRule, 0) + networkSecurityGroupRule := make([]pool.NetworkSecurityGroupRule, 0) for _, groupRule := range list { groupRuleMap := groupRule.(map[string]interface{}) priority := int32(groupRuleMap["priority"].(int)) sourceAddressPrefix := groupRuleMap["source_address_prefix"].(string) - access := batch.NetworkSecurityGroupRuleAccess(groupRuleMap["access"].(string)) + access := pool.NetworkSecurityGroupRuleAccess(groupRuleMap["access"].(string)) - networkSecurityGroupRuleObject := batch.NetworkSecurityGroupRule{ - Priority: &priority, - SourceAddressPrefix: &sourceAddressPrefix, + networkSecurityGroupRuleObject := pool.NetworkSecurityGroupRule{ + Priority: int64(priority), + SourceAddressPrefix: sourceAddressPrefix, Access: access, } @@ -1224,9 +1226,9 @@ func expandPoolNetworkSecurityGroupRule(list []interface{}) []batch.NetworkSecur networkSecurityGroupRuleObject.SourcePortRanges = &portRangesResult } - networkSecurityGroupRule = append(networkSecurityGroupRule, batch.NetworkSecurityGroupRule{ - Priority: &priority, - SourceAddressPrefix: &sourceAddressPrefix, + networkSecurityGroupRule = append(networkSecurityGroupRule, pool.NetworkSecurityGroupRule{ + Priority: int64(priority), + SourceAddressPrefix: sourceAddressPrefix, Access: access, }) } @@ -1234,52 +1236,41 @@ func expandPoolNetworkSecurityGroupRule(list []interface{}) []batch.NetworkSecur return networkSecurityGroupRule } -func flattenBatchPoolNetworkConfiguration(input *batch.NetworkConfiguration) []interface{} { +func flattenBatchPoolNetworkConfiguration(input *pool.NetworkConfiguration) []interface{} { if input == nil { return []interface{}{} } subnetId := "" - if input.SubnetID != nil { - subnetId = *input.SubnetID + if input.SubnetId != nil { + subnetId = *input.SubnetId } publicIPAddressIds := make([]interface{}, 0) publicAddressProvisioningType := "" if config := input.PublicIPAddressConfiguration; config != nil { publicIPAddressIds = utils.FlattenStringSlice(config.IPAddressIds) - publicAddressProvisioningType = string(config.Provision) + if config.Provision != nil { + publicAddressProvisioningType = string(*config.Provision) + } } endpointConfigs := make([]interface{}, 0) if config := input.EndpointConfiguration; config != nil && config.InboundNatPools != nil { - for _, inboundNatPool := range *config.InboundNatPools { - name := "" - if inboundNatPool.Name != nil { - name = *inboundNatPool.Name - } + for _, inboundNatPool := range config.InboundNatPools { + name := inboundNatPool.Name - backendPort := 0 - if inboundNatPool.BackendPort != nil { - backendPort = int(*inboundNatPool.BackendPort) - } + backendPort := inboundNatPool.BackendPort - frontendPortRange := "" - if inboundNatPool.FrontendPortRangeStart != nil && inboundNatPool.FrontendPortRangeEnd != nil { - frontendPortRange = fmt.Sprintf("%d-%d", *inboundNatPool.FrontendPortRangeStart, *inboundNatPool.FrontendPortRangeEnd) - } + frontendPortRange := fmt.Sprintf("%d-%d", inboundNatPool.FrontendPortRangeStart, inboundNatPool.FrontendPortRangeEnd) networkSecurities := make([]interface{}, 0) if sgRules := inboundNatPool.NetworkSecurityGroupRules; sgRules != nil { for _, networkSecurity := range *sgRules { - priority := 0 - if networkSecurity.Priority != nil { - priority = int(*networkSecurity.Priority) - } - sourceAddressPrefix := "" - if networkSecurity.SourceAddressPrefix != nil { - sourceAddressPrefix = *networkSecurity.SourceAddressPrefix - } + priority := networkSecurity.Priority + + sourceAddressPrefix := networkSecurity.SourceAddressPrefix + sourcePortRanges := make([]interface{}, 0) if networkSecurity.SourcePortRanges != nil { for _, sourcePortRange := range *networkSecurity.SourcePortRanges { @@ -1305,9 +1296,14 @@ func flattenBatchPoolNetworkConfiguration(input *batch.NetworkConfiguration) []i } } + dynamicVNetAssignmentScope := "" + if input.DynamicVNetAssignmentScope != nil { + dynamicVNetAssignmentScope = string(*input.DynamicVNetAssignmentScope) + } + return []interface{}{ map[string]interface{}{ - "dynamic_vnet_assignment_scope": string(input.DynamicVNetAssignmentScope), + "dynamic_vnet_assignment_scope": dynamicVNetAssignmentScope, "endpoint_configuration": endpointConfigs, "public_address_provisioning_type": publicAddressProvisioningType, "public_ips": pluginsdk.NewSet(pluginsdk.HashString, publicIPAddressIds), @@ -1316,8 +1312,8 @@ func flattenBatchPoolNetworkConfiguration(input *batch.NetworkConfiguration) []i } } -func ExpandBatchPoolUserAccounts(d *pluginsdk.ResourceData) (*[]batch.UserAccount, error) { - var result []batch.UserAccount +func ExpandBatchPoolUserAccounts(d *pluginsdk.ResourceData) (*[]pool.UserAccount, error) { + var result []pool.UserAccount if userAccountList, ok := d.GetOk("user_accounts"); ok { userAccounts := userAccountList.([]interface{}) @@ -1333,25 +1329,25 @@ func ExpandBatchPoolUserAccounts(d *pluginsdk.ResourceData) (*[]batch.UserAccoun return nil, fmt.Errorf("user_accounts either is empty or contains parsing errors") } -func expandBatchPoolUserAccount(ref map[string]interface{}) batch.UserAccount { - result := batch.UserAccount{ - Name: utils.String(ref["name"].(string)), - Password: utils.String(ref["password"].(string)), - ElevationLevel: batch.ElevationLevel(ref["elevation_level"].(string)), +func expandBatchPoolUserAccount(ref map[string]interface{}) pool.UserAccount { + result := pool.UserAccount{ + Name: ref["name"].(string), + Password: ref["password"].(string), + ElevationLevel: pointer.To(pool.ElevationLevel(ref["elevation_level"].(string))), } if linuxUserConfig, ok := ref["linux_user_configuration"]; ok { if linuxUserConfig != nil && len(linuxUserConfig.([]interface{})) > 0 { linuxUserConfigMap := linuxUserConfig.([]interface{})[0].(map[string]interface{}) - var linuxUserConfig batch.LinuxUserConfiguration + var linuxUserConfig pool.LinuxUserConfiguration if uid, ok := linuxUserConfigMap["uid"]; ok { - linuxUserConfig = batch.LinuxUserConfiguration{ - UID: utils.Int32(int32(uid.(int))), - Gid: utils.Int32(int32(linuxUserConfigMap["gid"].(int))), + linuxUserConfig = pool.LinuxUserConfiguration{ + Uid: utils.Int64(int64(uid.(int))), + Gid: utils.Int64(int64(linuxUserConfigMap["gid"].(int))), } } if sshPrivateKey, ok := linuxUserConfigMap["ssh_private_key"]; ok { - linuxUserConfig.SSHPrivateKey = utils.String(sshPrivateKey.(string)) + linuxUserConfig.SshPrivateKey = utils.String(sshPrivateKey.(string)) } result.LinuxUserConfiguration = &linuxUserConfig } @@ -1360,8 +1356,8 @@ func expandBatchPoolUserAccount(ref map[string]interface{}) batch.UserAccount { if winUserConfig, ok := ref["windows_user_configuration"]; ok { if winUserConfig != nil && len(winUserConfig.([]interface{})) > 0 { winUserConfigMap := winUserConfig.([]interface{})[0].(map[string]interface{}) - result.WindowsUserConfiguration = &batch.WindowsUserConfiguration{ - LoginMode: batch.LoginMode(winUserConfigMap["login_mode"].(string)), + result.WindowsUserConfiguration = &pool.WindowsUserConfiguration{ + LoginMode: pointer.To(pool.LoginMode(winUserConfigMap["login_mode"].(string))), } } } diff --git a/internal/services/batch/batch_pool_data_source.go b/internal/services/batch/batch_pool_data_source.go index 789f72881473..ec7827bf3d17 100644 --- a/internal/services/batch/batch_pool_data_source.go +++ b/internal/services/batch/batch_pool_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchPool() *pluginsdk.Resource { @@ -722,11 +722,11 @@ func dataSourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := pool.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -734,142 +734,157 @@ func dataSourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error d.SetId(id.ID()) - d.Set("name", id.Name) + d.Set("name", id.PoolName) d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.PoolProperties; props != nil { - d.Set("vm_size", props.VMSize) - d.Set("max_tasks_per_node", props.TaskSlotsPerNode) - d.Set("inter_node_communication", string(props.InterNodeCommunication)) - - if scaleSettings := props.ScaleSettings; scaleSettings != nil { - if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { - return fmt.Errorf("flattening `auto_scale`: %+v", err) - } - if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { - return fmt.Errorf("flattening `fixed_scale `: %+v", err) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + d.Set("vm_size", props.VMSize) + d.Set("inter_node_communication", props.InterNodeCommunication) + d.Set("max_tasks_per_node", props.TaskSlotsPerNode) + + if scaleSettings := props.ScaleSettings; scaleSettings != nil { + if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { + return fmt.Errorf("flattening `auto_scale`: %+v", err) + } + if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { + return fmt.Errorf("flattening `fixed_scale `: %+v", err) + } } - } - if props.UserAccounts != nil { - userAccounts := make([]interface{}, 0) - for _, userAccount := range *props.UserAccounts { - userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + if props.UserAccounts != nil { + userAccounts := make([]interface{}, 0) + for _, userAccount := range *props.UserAccounts { + userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + } + d.Set("user_accounts", userAccounts) } - d.Set("user_accounts", userAccounts) - } - if props.MountConfiguration != nil { - mountConfigs := make([]interface{}, 0) - for _, mountConfig := range *props.MountConfiguration { - mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + if props.MountConfiguration != nil { + mountConfigs := make([]interface{}, 0) + for _, mountConfig := range *props.MountConfiguration { + mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + } + d.Set("mount_configuration", mountConfigs) } - d.Set("mount_configuration", mountConfigs) - } - if props.DeploymentConfiguration != nil { - if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { - config := props.DeploymentConfiguration.VirtualMachineConfiguration - if config.ContainerConfiguration != nil { - d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) - } - if config.DataDisks != nil { - dataDisks := make([]interface{}, 0) - for _, item := range *config.DataDisks { - dataDisk := make(map[string]interface{}) - dataDisk["lun"] = *item.Lun - dataDisk["disk_size_gb"] = *item.DiskSizeGB - dataDisk["caching"] = string(item.Caching) - dataDisk["storage_account_type"] = string(item.StorageAccountType) - dataDisks = append(dataDisks, dataDisk) + if props.DeploymentConfiguration != nil { + if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { + config := props.DeploymentConfiguration.VirtualMachineConfiguration + if config.ContainerConfiguration != nil { + d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) } - d.Set("data_disks", dataDisks) - } - if config.DiskEncryptionConfiguration != nil { - diskEncryptionConfiguration := make([]interface{}, 0) - if config.DiskEncryptionConfiguration.Targets != nil { - for _, item := range *config.DiskEncryptionConfiguration.Targets { - target := make(map[string]interface{}) - target["disk_encryption_target"] = string(item) - diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + if config.DataDisks != nil { + dataDisks := make([]interface{}, 0) + for _, item := range *config.DataDisks { + dataDisk := make(map[string]interface{}) + dataDisk["lun"] = item.Lun + dataDisk["disk_size_gb"] = item.DiskSizeGB + + caching := "" + if item.Caching != nil { + caching = string(*item.Caching) + } + dataDisk["caching"] = caching + + storageAccountType := "" + if item.StorageAccountType != nil { + storageAccountType = string(*item.StorageAccountType) + } + dataDisk["storage_account_type"] = storageAccountType + + dataDisks = append(dataDisks, dataDisk) } + d.Set("data_disks", dataDisks) } - d.Set("disk_encryption", diskEncryptionConfiguration) - } - if config.Extensions != nil { - extensions := make([]interface{}, 0) - n := len(*config.Extensions) - for _, item := range *config.Extensions { - extension := make(map[string]interface{}) - extension["name"] = *item.Name - extension["publisher"] = *item.Publisher - extension["type"] = *item.Type - if item.TypeHandlerVersion != nil { - extension["type_handler_version"] = *item.TypeHandlerVersion - } - if item.AutoUpgradeMinorVersion != nil { - extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion - } - if item.Settings != nil { - extension["settings_json"] = item.Settings + if config.DiskEncryptionConfiguration != nil { + diskEncryptionConfiguration := make([]interface{}, 0) + if config.DiskEncryptionConfiguration.Targets != nil { + for _, item := range *config.DiskEncryptionConfiguration.Targets { + target := make(map[string]interface{}) + target["disk_encryption_target"] = string(item) + diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + } } + d.Set("disk_encryption", diskEncryptionConfiguration) + } + if config.Extensions != nil { + extensions := make([]interface{}, 0) + n := len(*config.Extensions) + for _, item := range *config.Extensions { + extension := make(map[string]interface{}) + extension["name"] = item.Name + extension["publisher"] = item.Publisher + extension["type"] = item.Type + if item.TypeHandlerVersion != nil { + extension["type_handler_version"] = *item.TypeHandlerVersion + } + if item.AutoUpgradeMinorVersion != nil { + extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion + } + if item.Settings != nil { + extension["settings_json"] = item.Settings + } - for i := 0; i < n; i++ { - if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == *item.Name { - extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) - break + for i := 0; i < n; i++ { + if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == item.Name { + extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) + break + } } - } - if item.ProvisionAfterExtensions != nil { - extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + if item.ProvisionAfterExtensions != nil { + extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + } + extensions = append(extensions, extension) } - extensions = append(extensions, extension) + d.Set("extensions", extensions) } - d.Set("extensions", extensions) - } - if config.ImageReference != nil { - d.Set("storage_image_reference", flattenBatchPoolImageReference(config.ImageReference)) - } - if config.LicenseType != nil { - d.Set("license_type", *config.LicenseType) - } - if config.NodeAgentSkuID != nil { - d.Set("node_agent_sku_id", *config.NodeAgentSkuID) - } - if config.NodePlacementConfiguration != nil { - nodePlacementConfiguration := make([]interface{}, 0) - nodePlacementConfig := make(map[string]interface{}) - nodePlacementConfig["policy"] = string(config.NodePlacementConfiguration.Policy) - nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) - d.Set("node_placement", nodePlacementConfiguration) - } - if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil { - d.Set("os_disk_placement", string(config.OsDisk.EphemeralOSDiskSettings.Placement)) - } - if config.WindowsConfiguration != nil { - windowsConfig := []interface{}{ - map[string]interface{}{ - "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, - }, + + d.Set("storage_image_reference", flattenBatchPoolImageReference(&config.ImageReference)) + + if config.LicenseType != nil { + d.Set("license_type", *config.LicenseType) + } + + d.Set("node_agent_sku_id", config.NodeAgentSkuId) + + if config.NodePlacementConfiguration != nil { + nodePlacementConfiguration := make([]interface{}, 0) + nodePlacementConfig := make(map[string]interface{}) + nodePlacementConfig["policy"] = string(*config.NodePlacementConfiguration.Policy) + nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) + d.Set("node_placement", nodePlacementConfiguration) + } + osDiskPlacement := "" + if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil && config.OsDisk.EphemeralOSDiskSettings.Placement != nil { + osDiskPlacement = string(*config.OsDisk.EphemeralOSDiskSettings.Placement) + } + d.Set("os_disk_placement", osDiskPlacement) + if config.WindowsConfiguration != nil { + windowsConfig := []interface{}{ + map[string]interface{}{ + "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, + }, + } + d.Set("windows", windowsConfig) } - d.Set("windows", windowsConfig) } } - } - if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { - return fmt.Errorf("setting `certificate`: %v", err) - } + if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { + return fmt.Errorf("setting `certificate`: %v", err) + } - d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) - d.Set("metadata", FlattenBatchMetaData(props.Metadata)) + d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) + d.Set("metadata", FlattenBatchMetaData(props.Metadata)) - if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { - return fmt.Errorf("setting `network_configuration`: %v", err) + if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { + return fmt.Errorf("setting `network_configuration`: %v", err) + } } } - return nil } diff --git a/internal/services/batch/batch_pool_resource.go b/internal/services/batch/batch_pool_resource.go index 68c75a01919e..21137ccedb77 100644 --- a/internal/services/batch/batch_pool_resource.go +++ b/internal/services/batch/batch_pool_resource.go @@ -8,16 +8,16 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -41,7 +41,7 @@ func resourceBatchPool() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.PoolID(id) + _, err := pool.ParsePoolID(id) return err }), Schema: map[string]*pluginsdk.Schema{ @@ -92,10 +92,10 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ComputeNodeDeallocationOptionRequeue), - string(batch.ComputeNodeDeallocationOptionRetainedData), - string(batch.ComputeNodeDeallocationOptionTaskCompletion), - string(batch.ComputeNodeDeallocationOptionTerminate), + string(pool.ComputeNodeDeallocationOptionRequeue), + string(pool.ComputeNodeDeallocationOptionRetainedData), + string(pool.ComputeNodeDeallocationOptionTaskCompletion), + string(pool.ComputeNodeDeallocationOptionTerminate), }, false), }, "target_dedicated_nodes": { @@ -453,11 +453,11 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - Default: string(batch.DynamicVNetAssignmentScopeNone), + Default: string(pool.DynamicVNetAssignmentScopeNone), DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validation.StringInSlice([]string{ - string(batch.DynamicVNetAssignmentScopeNone), - string(batch.DynamicVNetAssignmentScopeJob), + string(pool.DynamicVNetAssignmentScopeNone), + string(pool.DynamicVNetAssignmentScopeJob), }, false), }, "subnet_id": { @@ -479,9 +479,9 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.IPAddressProvisioningTypeBatchManaged), - string(batch.IPAddressProvisioningTypeUserManaged), - string(batch.IPAddressProvisioningTypeNoPublicIPAddresses), + string(pool.IPAddressProvisioningTypeBatchManaged), + string(pool.IPAddressProvisioningTypeUserManaged), + string(pool.IPAddressProvisioningTypeNoPublicIPAddresses), }, false), }, "endpoint_configuration": { @@ -501,8 +501,8 @@ func resourceBatchPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.InboundEndpointProtocolTCP), - string(batch.InboundEndpointProtocolUDP), + string(pool.InboundEndpointProtocolTCP), + string(pool.InboundEndpointProtocolUDP), }, false), }, "backend_port": { @@ -537,8 +537,8 @@ func resourceBatchPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.NetworkSecurityGroupRuleAccessAllow), - string(batch.NetworkSecurityGroupRuleAccessDeny), + string(pool.NetworkSecurityGroupRuleAccessAllow), + string(pool.NetworkSecurityGroupRuleAccessDeny), }, false), }, "source_address_prefix": { @@ -580,11 +580,11 @@ func resourceBatchPool() *pluginsdk.Resource { "caching": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.CachingTypeReadOnly), + Default: string(pool.CachingTypeReadOnly), ValidateFunc: validation.StringInSlice([]string{ - string(batch.CachingTypeNone), - string(batch.CachingTypeReadOnly), - string(batch.CachingTypeReadWrite), + string(pool.CachingTypeNone), + string(pool.CachingTypeReadOnly), + string(pool.CachingTypeReadWrite), }, false), }, "disk_size_gb": { @@ -595,10 +595,10 @@ func resourceBatchPool() *pluginsdk.Resource { "storage_account_type": { Type: pluginsdk.TypeString, Optional: true, - Default: batch.StorageAccountTypeStandardLRS, + Default: pool.StorageAccountTypeStandardLRS, ValidateFunc: validation.StringInSlice([]string{ - string(batch.StorageAccountTypeStandardLRS), - string(batch.StorageAccountTypePremiumLRS), + string(pool.StorageAccountTypeStandardLRS), + string(pool.StorageAccountTypePremiumLRS), }, false), }, }, @@ -613,8 +613,8 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.DiskEncryptionTargetTemporaryDisk), - string(batch.DiskEncryptionTargetOsDisk), + string(pool.DiskEncryptionTargetTemporaryDisk), + string(pool.DiskEncryptionTargetOsDisk), }, false), }, }, @@ -678,10 +678,10 @@ func resourceBatchPool() *pluginsdk.Resource { "policy": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.NodePlacementPolicyTypeRegional), + Default: string(pool.NodePlacementPolicyTypeRegional), ValidateFunc: validation.StringInSlice([]string{ - string(batch.NodePlacementPolicyTypeZonal), - string(batch.NodePlacementPolicyTypeRegional), + string(pool.NodePlacementPolicyTypeZonal), + string(pool.NodePlacementPolicyTypeRegional), }, false), }, }, @@ -697,16 +697,16 @@ func resourceBatchPool() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.StringInSlice( []string{ - string(batch.DiffDiskPlacementCacheDisk), + string(pool.DiffDiskPlacementCacheDisk), }, false), }, "inter_node_communication": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.InterNodeCommunicationStateEnabled), + Default: string(pool.InterNodeCommunicationStateEnabled), ValidateFunc: validation.StringInSlice([]string{ - string(batch.InterNodeCommunicationStateEnabled), - string(batch.InterNodeCommunicationStateDisabled), + string(pool.InterNodeCommunicationStateEnabled), + string(pool.InterNodeCommunicationStateDisabled), }, false), }, "task_scheduling_policy": { @@ -720,8 +720,8 @@ func resourceBatchPool() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ComputeNodeFillTypeSpread), - string(batch.ComputeNodeFillTypePack), + string(pool.ComputeNodeFillTypeSpread), + string(pool.ComputeNodeFillTypePack), }, false), }, }, @@ -747,8 +747,8 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ElevationLevelNonAdmin), - string(batch.ElevationLevelAdmin), + string(pool.ElevationLevelNonAdmin), + string(pool.ElevationLevelAdmin), }, false), }, "linux_user_configuration": { @@ -781,8 +781,8 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.LoginModeBatch), - string(batch.LoginModeInteractive), + string(pool.LoginModeBatch), + string(pool.LoginModeInteractive), }, false), }, }, @@ -814,27 +814,27 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := pool.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_batch_pool", id.ID()) } } - parameters := batch.Pool{ - PoolProperties: &batch.PoolProperties{ + parameters := pool.Pool{ + Properties: &pool.PoolProperties{ VMSize: utils.String(d.Get("vm_size").(string)), DisplayName: utils.String(d.Get("display_name").(string)), - InterNodeCommunication: batch.InterNodeCommunicationState(d.Get("inter_node_communication").(string)), - TaskSlotsPerNode: utils.Int32(int32(d.Get("max_tasks_per_node").(int))), + InterNodeCommunication: pointer.To(pool.InterNodeCommunicationState(d.Get("inter_node_communication").(string))), + TaskSlotsPerNode: utils.Int64(int64(d.Get("max_tasks_per_node").(int))), }, } @@ -842,15 +842,15 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error if err != nil { log.Printf(`[DEBUG] expanding "user_accounts": %v`, err) } - parameters.PoolProperties.UserAccounts = userAccounts + parameters.Properties.UserAccounts = userAccounts taskSchedulingPolicy, err := ExpandBatchPoolTaskSchedulingPolicy(d) if err != nil { log.Printf(`[DEBUG] expanding "task_scheduling_policy": %v`, err) } - parameters.PoolProperties.TaskSchedulingPolicy = taskSchedulingPolicy + parameters.Properties.TaskSchedulingPolicy = taskSchedulingPolicy - identity, err := expandBatchPoolIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -861,7 +861,7 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("expanding scale settings: %+v", err) } - parameters.PoolProperties.ScaleSettings = scaleSettings + parameters.Properties.ScaleSettings = scaleSettings if startTaskValue, startTaskOk := d.GetOk("start_task"); startTaskOk { startTaskList := startTaskValue.([]interface{}) @@ -877,11 +877,11 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("creating %s: %+v", id, userIdentityError) } - parameters.PoolProperties.StartTask = startTask + parameters.Properties.StartTask = startTask } if vmDeploymentConfiguration, deploymentErr := expandBatchPoolVirtualMachineConfig(d); deploymentErr == nil { - parameters.PoolProperties.DeploymentConfiguration = &batch.DeploymentConfiguration{ + parameters.Properties.DeploymentConfiguration = &pool.DeploymentConfiguration{ VirtualMachineConfiguration: vmDeploymentConfiguration, } } @@ -891,33 +891,33 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("expanding `certificate`: %+v", err) } - parameters.PoolProperties.Certificates = certificateReferences + parameters.Properties.Certificates = certificateReferences - if err := validateBatchPoolCrossFieldRules(¶meters); err != nil { + if err := validateBatchPoolCrossFieldRules(parameters.Properties); err != nil { return err } metaDataRaw := d.Get("metadata").(map[string]interface{}) - parameters.PoolProperties.Metadata = ExpandBatchMetaData(metaDataRaw) + parameters.Properties.Metadata = ExpandBatchMetaData(metaDataRaw) mountConfiguration, err := ExpandBatchPoolMountConfigurations(d) if err != nil { log.Printf(`[DEBUG] expanding "mount": %v`, err) } - parameters.PoolProperties.MountConfiguration = mountConfiguration + parameters.Properties.MountConfiguration = mountConfiguration networkConfiguration := d.Get("network_configuration").([]interface{}) - parameters.PoolProperties.NetworkConfiguration, err = ExpandBatchPoolNetworkConfiguration(networkConfiguration) + parameters.Properties.NetworkConfiguration, err = ExpandBatchPoolNetworkConfiguration(networkConfiguration) if err != nil { return fmt.Errorf("expanding `network_configuration`: %+v", err) } - _, err = client.Create(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, "", "") + _, err = client.Create(ctx, id, parameters, pool.CreateOperationOptions{}) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - read, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + read, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } @@ -925,9 +925,11 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error d.SetId(id.ID()) // if the pool is not Steady after the create operation, wait for it to be Steady - if props := read.PoolProperties; props != nil && props.AllocationState != batch.AllocationStateSteady { - if err = waitForBatchPoolPendingResizeOperation(ctx, client, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("waiting for %s", id) + if model := read.Model; model != nil { + if props := model.Properties; props != nil && props.AllocationState != nil && *props.AllocationState != pool.AllocationStateSteady { + if err = waitForBatchPoolPendingResizeOperation(ctx, client, id); err != nil { + return fmt.Errorf("waiting for %s", id) + } } } @@ -939,39 +941,41 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PoolID(d.Id()) + id, err := pool.ParsePoolID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", *id, err) } - if resp.PoolProperties.AllocationState != batch.AllocationStateSteady { - log.Printf("[INFO] there is a pending resize operation on this pool...") - stopPendingResizeOperation := d.Get("stop_pending_resize_operation").(bool) - if !stopPendingResizeOperation { - return fmt.Errorf("updating %s because of pending resize operation. Set flag `stop_pending_resize_operation` to true to force update", *id) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil && props.AllocationState != nil && *props.AllocationState != pool.AllocationStateSteady { + log.Printf("[INFO] there is a pending resize operation on this pool...") + stopPendingResizeOperation := d.Get("stop_pending_resize_operation").(bool) + if !stopPendingResizeOperation { + return fmt.Errorf("updating %s because of pending resize operation. Set flag `stop_pending_resize_operation` to true to force update", *id) + } - log.Printf("[INFO] stopping the pending resize operation on this pool...") - if _, err = client.StopResize(ctx, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("stopping resize operation for %s: %+v", *id, err) - } + log.Printf("[INFO] stopping the pending resize operation on this pool...") + if _, err = client.StopResize(ctx, *id); err != nil { + return fmt.Errorf("stopping resize operation for %s: %+v", *id, err) + } - // waiting for the pool to be in steady state - if err = waitForBatchPoolPendingResizeOperation(ctx, client, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("waiting for %s", *id) + // waiting for the pool to be in steady state + if err = waitForBatchPoolPendingResizeOperation(ctx, client, *id); err != nil { + return fmt.Errorf("waiting for %s", *id) + } } } - parameters := batch.Pool{ - PoolProperties: &batch.PoolProperties{}, + parameters := pool.Pool{ + Properties: &pool.PoolProperties{}, } - identity, err := expandBatchPoolIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -982,19 +986,19 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("expanding scale settings: %+v", err) } - parameters.PoolProperties.ScaleSettings = scaleSettings + parameters.Properties.ScaleSettings = scaleSettings taskSchedulingPolicy, err := ExpandBatchPoolTaskSchedulingPolicy(d) if err != nil { log.Printf(`[DEBUG] expanding "task_scheduling_policy": %v`, err) } - parameters.PoolProperties.TaskSchedulingPolicy = taskSchedulingPolicy + parameters.Properties.TaskSchedulingPolicy = taskSchedulingPolicy userAccounts, err := ExpandBatchPoolUserAccounts(d) if err != nil { log.Printf(`[DEBUG] expanding "user_accounts": %v`, err) } - parameters.PoolProperties.UserAccounts = userAccounts + parameters.Properties.UserAccounts = userAccounts if startTaskValue, startTaskOk := d.GetOk("start_task"); startTaskOk { startTaskList := startTaskValue.([]interface{}) @@ -1010,16 +1014,16 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("creating %s: %+v", *id, userIdentityError) } - parameters.PoolProperties.StartTask = startTask + parameters.Properties.StartTask = startTask } certificates := d.Get("certificate").([]interface{}) certificateReferences, err := ExpandBatchPoolCertificateReferences(certificates) if err != nil { return fmt.Errorf("expanding `certificate`: %+v", err) } - parameters.PoolProperties.Certificates = certificateReferences + parameters.Properties.Certificates = certificateReferences - if err := validateBatchPoolCrossFieldRules(¶meters); err != nil { + if err := validateBatchPoolCrossFieldRules(parameters.Properties); err != nil { return err } @@ -1027,24 +1031,26 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error log.Printf("[DEBUG] Updating the MetaData for %s", *id) metaDataRaw := d.Get("metadata").(map[string]interface{}) - parameters.PoolProperties.Metadata = ExpandBatchMetaData(metaDataRaw) + parameters.Properties.Metadata = ExpandBatchMetaData(metaDataRaw) } mountConfiguration, err := ExpandBatchPoolMountConfigurations(d) if err != nil { log.Printf(`[DEBUG] expanding "mount": %v`, err) } - parameters.PoolProperties.MountConfiguration = mountConfiguration + parameters.Properties.MountConfiguration = mountConfiguration - result, err := client.Update(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, "") + result, err := client.Update(ctx, *id, parameters, pool.UpdateOperationOptions{}) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } // if the pool is not Steady after the update, wait for it to be Steady - if props := result.PoolProperties; props != nil && props.AllocationState != batch.AllocationStateSteady { - if err := waitForBatchPoolPendingResizeOperation(ctx, client, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("waiting for %s", *id) + if model := result.Model; model != nil { + if props := model.Properties; props != nil && props.AllocationState != nil && *props.AllocationState != pool.AllocationStateSteady { + if err := waitForBatchPoolPendingResizeOperation(ctx, client, *id); err != nil { + return fmt.Errorf("waiting for %s", *id) + } } } @@ -1056,14 +1062,14 @@ func resourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PoolID(d.Id()) + id, err := pool.ParsePoolID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil @@ -1071,158 +1077,173 @@ func resourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.PoolName) d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - identity, err := flattenBatchPoolIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + if model := resp.Model; model != nil { + identity, err := identity.FlattenUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - if props := resp.PoolProperties; props != nil { - d.Set("display_name", props.DisplayName) - d.Set("vm_size", props.VMSize) - d.Set("inter_node_communication", string(props.InterNodeCommunication)) + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + d.Set("vm_size", props.VMSize) + d.Set("inter_node_communication", props.InterNodeCommunication) - if scaleSettings := props.ScaleSettings; scaleSettings != nil { - if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { - return fmt.Errorf("flattening `auto_scale`: %+v", err) - } - if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { - return fmt.Errorf("flattening `fixed_scale `: %+v", err) + if scaleSettings := props.ScaleSettings; scaleSettings != nil { + if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { + return fmt.Errorf("flattening `auto_scale`: %+v", err) + } + if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { + return fmt.Errorf("flattening `fixed_scale `: %+v", err) + } } - } - if props.TaskSchedulingPolicy != nil && props.TaskSchedulingPolicy.NodeFillType != "" { - taskSchedulingPolicy := make([]interface{}, 0) - nodeFillType := make(map[string]interface{}) - nodeFillType["node_fill_type"] = string(props.TaskSchedulingPolicy.NodeFillType) - taskSchedulingPolicy = append(taskSchedulingPolicy, nodeFillType) - d.Set("task_scheduling_policy", taskSchedulingPolicy) - } + if props.TaskSchedulingPolicy != nil && props.TaskSchedulingPolicy.NodeFillType != "" { + taskSchedulingPolicy := make([]interface{}, 0) + nodeFillType := make(map[string]interface{}) + nodeFillType["node_fill_type"] = string(props.TaskSchedulingPolicy.NodeFillType) + taskSchedulingPolicy = append(taskSchedulingPolicy, nodeFillType) + d.Set("task_scheduling_policy", taskSchedulingPolicy) + } - if props.UserAccounts != nil { - userAccounts := make([]interface{}, 0) - for _, userAccount := range *props.UserAccounts { - userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + if props.UserAccounts != nil { + userAccounts := make([]interface{}, 0) + for _, userAccount := range *props.UserAccounts { + userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + } + d.Set("user_accounts", userAccounts) } - d.Set("user_accounts", userAccounts) - } - d.Set("max_tasks_per_node", props.TaskSlotsPerNode) + d.Set("max_tasks_per_node", props.TaskSlotsPerNode) - if props.DeploymentConfiguration != nil { - if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { - config := props.DeploymentConfiguration.VirtualMachineConfiguration - if config.ContainerConfiguration != nil { - d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) - } - if config.DataDisks != nil { - dataDisks := make([]interface{}, 0) - for _, item := range *config.DataDisks { - dataDisk := make(map[string]interface{}) - dataDisk["lun"] = *item.Lun - dataDisk["disk_size_gb"] = *item.DiskSizeGB - dataDisk["caching"] = string(item.Caching) - dataDisk["storage_account_type"] = string(item.StorageAccountType) - dataDisks = append(dataDisks, dataDisk) + if props.DeploymentConfiguration != nil { + if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { + config := props.DeploymentConfiguration.VirtualMachineConfiguration + if config.ContainerConfiguration != nil { + d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) } - d.Set("data_disks", dataDisks) - } - if config.DiskEncryptionConfiguration != nil { - diskEncryptionConfiguration := make([]interface{}, 0) - if config.DiskEncryptionConfiguration.Targets != nil { - for _, item := range *config.DiskEncryptionConfiguration.Targets { - target := make(map[string]interface{}) - target["disk_encryption_target"] = string(item) - diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + if config.DataDisks != nil { + dataDisks := make([]interface{}, 0) + for _, item := range *config.DataDisks { + dataDisk := make(map[string]interface{}) + dataDisk["lun"] = item.Lun + dataDisk["disk_size_gb"] = item.DiskSizeGB + + caching := "" + if item.Caching != nil { + caching = string(*item.Caching) + } + dataDisk["caching"] = caching + + storageAccountType := "" + if item.StorageAccountType != nil { + storageAccountType = string(*item.StorageAccountType) + } + dataDisk["storage_account_type"] = storageAccountType + + dataDisks = append(dataDisks, dataDisk) } + d.Set("data_disks", dataDisks) } - d.Set("disk_encryption", diskEncryptionConfiguration) - } - if config.Extensions != nil { - extensions := make([]interface{}, 0) - n := len(*config.Extensions) - for _, item := range *config.Extensions { - extension := make(map[string]interface{}) - extension["name"] = *item.Name - extension["publisher"] = *item.Publisher - extension["type"] = *item.Type - if item.TypeHandlerVersion != nil { - extension["type_handler_version"] = *item.TypeHandlerVersion - } - if item.AutoUpgradeMinorVersion != nil { - extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion - } - if item.Settings != nil { - extension["settings_json"] = item.Settings + if config.DiskEncryptionConfiguration != nil { + diskEncryptionConfiguration := make([]interface{}, 0) + if config.DiskEncryptionConfiguration.Targets != nil { + for _, item := range *config.DiskEncryptionConfiguration.Targets { + target := make(map[string]interface{}) + target["disk_encryption_target"] = string(item) + diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + } } + d.Set("disk_encryption", diskEncryptionConfiguration) + } + if config.Extensions != nil { + extensions := make([]interface{}, 0) + n := len(*config.Extensions) + for _, item := range *config.Extensions { + extension := make(map[string]interface{}) + extension["name"] = item.Name + extension["publisher"] = item.Publisher + extension["type"] = item.Type + if item.TypeHandlerVersion != nil { + extension["type_handler_version"] = *item.TypeHandlerVersion + } + if item.AutoUpgradeMinorVersion != nil { + extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion + } + if item.Settings != nil { + extension["settings_json"] = item.Settings + } - for i := 0; i < n; i++ { - if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == *item.Name { - extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) - break + for i := 0; i < n; i++ { + if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == item.Name { + extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) + break + } } - } - if item.ProvisionAfterExtensions != nil { - extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + if item.ProvisionAfterExtensions != nil { + extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + } + extensions = append(extensions, extension) } - extensions = append(extensions, extension) + d.Set("extensions", extensions) } - d.Set("extensions", extensions) - } - if config.ImageReference != nil { - d.Set("storage_image_reference", flattenBatchPoolImageReference(config.ImageReference)) - } - if config.LicenseType != nil { - d.Set("license_type", *config.LicenseType) - } - if config.NodeAgentSkuID != nil { - d.Set("node_agent_sku_id", *config.NodeAgentSkuID) - } - if config.NodePlacementConfiguration != nil { - nodePlacementConfiguration := make([]interface{}, 0) - nodePlacementConfig := make(map[string]interface{}) - nodePlacementConfig["policy"] = string(config.NodePlacementConfiguration.Policy) - nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) - d.Set("node_placement", nodePlacementConfiguration) - } - if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil { - d.Set("os_disk_placement", string(config.OsDisk.EphemeralOSDiskSettings.Placement)) - } - if config.WindowsConfiguration != nil { - windowsConfig := []interface{}{ - map[string]interface{}{ - "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, - }, + + d.Set("storage_image_reference", flattenBatchPoolImageReference(&config.ImageReference)) + + if config.LicenseType != nil { + d.Set("license_type", *config.LicenseType) + } + + d.Set("node_agent_sku_id", config.NodeAgentSkuId) + + if config.NodePlacementConfiguration != nil { + nodePlacementConfiguration := make([]interface{}, 0) + nodePlacementConfig := make(map[string]interface{}) + nodePlacementConfig["policy"] = string(*config.NodePlacementConfiguration.Policy) + nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) + d.Set("node_placement", nodePlacementConfiguration) + } + osDiskPlacement := "" + if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil && config.OsDisk.EphemeralOSDiskSettings.Placement != nil { + osDiskPlacement = string(*config.OsDisk.EphemeralOSDiskSettings.Placement) + } + d.Set("os_disk_placement", osDiskPlacement) + if config.WindowsConfiguration != nil { + windowsConfig := []interface{}{ + map[string]interface{}{ + "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, + }, + } + d.Set("windows", windowsConfig) } - d.Set("windows", windowsConfig) } } - } - if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { - return fmt.Errorf("flattening `certificate`: %+v", err) - } + if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { + return fmt.Errorf("flattening `certificate`: %+v", err) + } - d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) - d.Set("metadata", FlattenBatchMetaData(props.Metadata)) + d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) + d.Set("metadata", FlattenBatchMetaData(props.Metadata)) - if props.MountConfiguration != nil { - mountConfigs := make([]interface{}, 0) - for _, mountConfig := range *props.MountConfiguration { - mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + if props.MountConfiguration != nil { + mountConfigs := make([]interface{}, 0) + for _, mountConfig := range *props.MountConfiguration { + mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + } + d.Set("mount", mountConfigs) } - d.Set("mount", mountConfigs) - } - if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { - return fmt.Errorf("setting `network_configuration`: %v", err) + if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { + return fmt.Errorf("setting `network_configuration`: %v", err) + } } } @@ -1234,26 +1255,20 @@ func resourceBatchPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PoolID(d.Id()) + id, err := pool.ParsePoolID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - } return nil } -func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*batch.ScaleSettings, error) { - scaleSettings := &batch.ScaleSettings{} +func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*pool.ScaleSettings, error) { + scaleSettings := &pool.ScaleSettings{} autoScaleValue, autoScaleOk := d.GetOk("auto_scale") fixedScaleValue, fixedScaleOk := d.GetOk("fixed_scale") @@ -1277,9 +1292,9 @@ func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*batch.ScaleSettin autoScaleEvaluationInterval := autoScaleSettings["evaluation_interval"].(string) autoScaleFormula := autoScaleSettings["formula"].(string) - scaleSettings.AutoScale = &batch.AutoScaleSettings{ + scaleSettings.AutoScale = &pool.AutoScaleSettings{ EvaluationInterval: &autoScaleEvaluationInterval, - Formula: &autoScaleFormula, + Formula: autoScaleFormula, } } else if fixedScaleOk { fixedScale := fixedScaleValue.([]interface{}) @@ -1288,43 +1303,47 @@ func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*batch.ScaleSettin } fixedScaleSettings := fixedScale[0].(map[string]interface{}) - nodeDeallocationOption := batch.ComputeNodeDeallocationOption(fixedScaleSettings["node_deallocation_method"].(string)) + nodeDeallocationOption := pool.ComputeNodeDeallocationOption(fixedScaleSettings["node_deallocation_method"].(string)) targetDedicatedNodes := int32(fixedScaleSettings["target_dedicated_nodes"].(int)) targetLowPriorityNodes := int32(fixedScaleSettings["target_low_priority_nodes"].(int)) resizeTimeout := fixedScaleSettings["resize_timeout"].(string) - scaleSettings.FixedScale = &batch.FixedScaleSettings{ - NodeDeallocationOption: nodeDeallocationOption, + scaleSettings.FixedScale = &pool.FixedScaleSettings{ + NodeDeallocationOption: &nodeDeallocationOption, ResizeTimeout: &resizeTimeout, - TargetDedicatedNodes: &targetDedicatedNodes, - TargetLowPriorityNodes: &targetLowPriorityNodes, + TargetDedicatedNodes: utils.Int64(int64(targetDedicatedNodes)), + TargetLowPriorityNodes: utils.Int64(int64(targetLowPriorityNodes)), } } return scaleSettings, nil } -func waitForBatchPoolPendingResizeOperation(ctx context.Context, client *batch.PoolClient, resourceGroup string, accountName string, poolName string) error { +func waitForBatchPoolPendingResizeOperation(ctx context.Context, client *pool.PoolClient, id pool.PoolId) error { // waiting for the pool to be in steady state log.Printf("[INFO] waiting for the pending resize operation on this pool to be stopped...") isSteady := false for !isSteady { - resp, err := client.Get(ctx, resourceGroup, accountName, poolName) + resp, err := client.Get(ctx, id) if err != nil { - return fmt.Errorf("retrieving the Batch pool %q (Resource Group %q): %+v", poolName, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - isSteady = resp.PoolProperties.AllocationState == batch.AllocationStateSteady + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.AllocationState != nil { + isSteady = *resp.Model.Properties.AllocationState == pool.AllocationStateSteady + if isSteady { + break + } + } time.Sleep(time.Second * 30) log.Printf("[INFO] waiting for the pending resize operation on this pool to be stopped... New try in 30 seconds...") } - return nil } // validateUserIdentity validates that the user identity for a start task has been well specified // it should have a auto_user block or a user_name defined, but not both at the same time. -func validateUserIdentity(userIdentity *batch.UserIdentity) error { +func validateUserIdentity(userIdentity *pool.UserIdentity) error { if userIdentity == nil { return errors.New("user_identity block needs to be specified") } @@ -1340,7 +1359,7 @@ func validateUserIdentity(userIdentity *batch.UserIdentity) error { return nil } -func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { +func validateBatchPoolCrossFieldRules(pool *pool.PoolProperties) error { // Perform validation across multiple fields as per https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#resourcefile if pool.StartTask != nil { @@ -1352,10 +1371,10 @@ func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { if referenceFile.AutoStorageContainerName != nil { sourceCount++ } - if referenceFile.StorageContainerURL != nil { + if referenceFile.StorageContainerUrl != nil { sourceCount++ } - if referenceFile.HTTPURL != nil { + if referenceFile.HTTPUrl != nil { sourceCount++ } if sourceCount != 1 { @@ -1363,12 +1382,12 @@ func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { } if referenceFile.BlobPrefix != nil { - if referenceFile.AutoStorageContainerName == nil && referenceFile.StorageContainerURL == nil { + if referenceFile.AutoStorageContainerName == nil && referenceFile.StorageContainerUrl == nil { return fmt.Errorf("auto_storage_container_name or storage_container_url must be specified when using blob_prefix") } } - if referenceFile.HTTPURL != nil { + if referenceFile.HTTPUrl != nil { if referenceFile.FilePath == nil { return fmt.Errorf("file_path must be specified when using http_url") } @@ -1380,46 +1399,6 @@ func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { return nil } -func expandBatchPoolIdentity(input []interface{}) (*batch.PoolIdentity, error) { - expanded, err := identity.ExpandUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := batch.PoolIdentity{ - Type: batch.PoolIdentityType(string(expanded.Type)), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*batch.UserAssignedIdentities) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &batch.UserAssignedIdentities{ - // intentionally empty - } - } - } - - return &out, nil -} - -func flattenBatchPoolIdentity(input *batch.PoolIdentity) (*[]interface{}, error) { - var transform *identity.UserAssignedMap - - if input != nil { - transform = &identity.UserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } - } - - return identity.FlattenUserAssignedMap(transform) -} - func startTaskSchema() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "command_line": { @@ -1454,8 +1433,8 @@ func startTaskSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ContainerWorkingDirectoryTaskWorkingDirectory), - string(batch.ContainerWorkingDirectoryContainerImageDefault), + string(pool.ContainerWorkingDirectoryTaskWorkingDirectory), + string(pool.ContainerWorkingDirectoryContainerImageDefault), }, false), }, }, @@ -1501,19 +1480,19 @@ func startTaskSchema() map[string]*pluginsdk.Schema { "elevation_level": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.ElevationLevelNonAdmin), + Default: string(pool.ElevationLevelNonAdmin), ValidateFunc: validation.StringInSlice([]string{ - string(batch.ElevationLevelNonAdmin), - string(batch.ElevationLevelAdmin), + string(pool.ElevationLevelNonAdmin), + string(pool.ElevationLevelAdmin), }, false), }, "scope": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.AutoUserScopeTask), + Default: string(pool.AutoUserScopeTask), ValidateFunc: validation.StringInSlice([]string{ - string(batch.AutoUserScopeTask), - string(batch.AutoUserScopePool), + string(pool.AutoUserScopeTask), + string(pool.AutoUserScopePool), }, false), }, }, diff --git a/internal/services/batch/batch_pool_resource_test.go b/internal/services/batch/batch_pool_resource_test.go index 675c6e7264a8..37269a3e887c 100644 --- a/internal/services/batch/batch_pool_resource_test.go +++ b/internal/services/batch/batch_pool_resource_test.go @@ -7,10 +7,10 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -712,17 +712,17 @@ func TestAccBatchPool_windowsUserAccountsWithAdditionalConfig(t *testing.T) { } func (t BatchPoolResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.PoolID(state.ID) + id, err := pool.ParsePoolID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.PoolClient.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := clients.Batch.PoolClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.PoolProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchPoolResource) fixedScale_complete(data acceptance.TestData) string { diff --git a/internal/services/batch/client/client.go b/internal/services/batch/client/client.go index 224a0ebac2b9..6bfa1b936541 100644 --- a/internal/services/batch/client/client.go +++ b/internal/services/batch/client/client.go @@ -5,32 +5,34 @@ import ( "fmt" batchDataplane "github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" ) type Client struct { - AccountClient *batch.AccountClient - ApplicationClient *batch.ApplicationClient - CertificateClient *batch.CertificateClient - PoolClient *batch.PoolClient + AccountClient *batchaccount.BatchAccountClient + ApplicationClient *application.ApplicationClient + CertificateClient *certificate.CertificateClient + PoolClient *pool.PoolClient BatchManagementAuthorizer autorest.Authorizer } func NewClient(o *common.ClientOptions) *Client { - accountClient := batch.NewAccountClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + accountClient := batchaccount.NewBatchAccountClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountClient.Client, o.ResourceManagerAuthorizer) - applicationClient := batch.NewApplicationClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + applicationClient := application.NewApplicationClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&applicationClient.Client, o.ResourceManagerAuthorizer) - certificateClient := batch.NewCertificateClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + certificateClient := certificate.NewCertificateClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&certificateClient.Client, o.ResourceManagerAuthorizer) - poolClient := batch.NewPoolClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + poolClient := pool.NewPoolClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&poolClient.Client, o.ResourceManagerAuthorizer) return &Client{ @@ -42,22 +44,24 @@ func NewClient(o *common.ClientOptions) *Client { } } -func (r *Client) JobClient(ctx context.Context, accountId parse.AccountId) (*batchDataplane.JobClient, error) { +func (r *Client) JobClient(ctx context.Context, accountId batchaccount.BatchAccountId) (*batchDataplane.JobClient, error) { // Retrieve the batch account to find the batch account endpoint accountClient := r.AccountClient - account, err := accountClient.Get(ctx, accountId.ResourceGroup, accountId.BatchAccountName) + account, err := accountClient.Get(ctx, accountId) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", accountId, err) } - if account.AccountProperties == nil { - return nil, fmt.Errorf(`unexpected nil of "AccountProperties" of %s`, accountId) - } - if account.AccountProperties.AccountEndpoint == nil { - return nil, fmt.Errorf(`unexpected nil of "AccountProperties.AccountEndpoint" of %s`, accountId) + if model := account.Model; model != nil { + if model.Properties == nil { + return nil, fmt.Errorf(`unexpected nil of "AccountProperties" of %s`, accountId) + } + if model.Properties.AccountEndpoint == nil { + return nil, fmt.Errorf(`unexpected nil of "AccountProperties.AccountEndpoint" of %s`, accountId) + } } // Copy the client since we'll manipulate its BatchURL - endpoint := "https://" + *account.AccountProperties.AccountEndpoint + endpoint := "https://" + *account.Model.Properties.AccountEndpoint c := batchDataplane.NewJobClient(endpoint) c.BaseClient.Client.Authorizer = r.BatchManagementAuthorizer return &c, nil diff --git a/internal/services/batch/parse/account.go b/internal/services/batch/parse/account.go deleted file mode 100644 index b6ea8f222f6b..000000000000 --- a/internal/services/batch/parse/account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AccountId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string -} - -func NewAccountID(subscriptionId, resourceGroup, batchAccountName string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - } -} - -func (id AccountId) String() string { - segments := []string{ - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Account", segmentsStr) -} - -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) -} - -// AccountID parses a Account ID into an AccountId struct -func AccountID(input string) (*AccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/account_test.go b/internal/services/batch/parse/account_test.go deleted file mode 100644 index 2b4223305f4e..000000000000 --- a/internal/services/batch/parse/account_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = AccountId{} - -func TestAccountIDFormatter(t *testing.T) { - actual := NewAccountID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1", - Expected: &AccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := AccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - } -} diff --git a/internal/services/batch/parse/application.go b/internal/services/batch/parse/application.go deleted file mode 100644 index c314ec9d3788..000000000000 --- a/internal/services/batch/parse/application.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApplicationId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string - Name string -} - -func NewApplicationID(subscriptionId, resourceGroup, batchAccountName, name string) ApplicationId { - return ApplicationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - Name: name, - } -} - -func (id ApplicationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Application", segmentsStr) -} - -func (id ApplicationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/applications/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.Name) -} - -// ApplicationID parses a Application ID into an ApplicationId struct -func ApplicationID(input string) (*ApplicationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("applications"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/application_test.go b/internal/services/batch/parse/application_test.go deleted file mode 100644 index f86a807332b0..000000000000 --- a/internal/services/batch/parse/application_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ApplicationId{} - -func TestApplicationIDFormatter(t *testing.T) { - actual := NewApplicationID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "application1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestApplicationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ApplicationId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1", - Expected: &ApplicationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - Name: "application1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/APPLICATIONS/APPLICATION1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ApplicationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/batch/parse/certificate.go b/internal/services/batch/parse/certificate.go deleted file mode 100644 index 9b289956ea3d..000000000000 --- a/internal/services/batch/parse/certificate.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CertificateId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string - Name string -} - -func NewCertificateID(subscriptionId, resourceGroup, batchAccountName, name string) CertificateId { - return CertificateId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - Name: name, - } -} - -func (id CertificateId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Certificate", segmentsStr) -} - -func (id CertificateId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/certificates/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.Name) -} - -// CertificateID parses a Certificate ID into an CertificateId struct -func CertificateID(input string) (*CertificateId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CertificateId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("certificates"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/certificate_test.go b/internal/services/batch/parse/certificate_test.go deleted file mode 100644 index 4f04320ab973..000000000000 --- a/internal/services/batch/parse/certificate_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = CertificateId{} - -func TestCertificateIDFormatter(t *testing.T) { - actual := NewCertificateID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "certificate1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestCertificateID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CertificateId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1", - Expected: &CertificateId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - Name: "certificate1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/CERTIFICATES/CERTIFICATE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := CertificateID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/batch/parse/pool.go b/internal/services/batch/parse/pool.go deleted file mode 100644 index 91a7fb7bf7db..000000000000 --- a/internal/services/batch/parse/pool.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type PoolId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string - Name string -} - -func NewPoolID(subscriptionId, resourceGroup, batchAccountName, name string) PoolId { - return PoolId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - Name: name, - } -} - -func (id PoolId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Pool", segmentsStr) -} - -func (id PoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/pools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.Name) -} - -// PoolID parses a Pool ID into an PoolId struct -func PoolID(input string) (*PoolId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := PoolId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("pools"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/pool_test.go b/internal/services/batch/parse/pool_test.go deleted file mode 100644 index d12ed0e7601f..000000000000 --- a/internal/services/batch/parse/pool_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = PoolId{} - -func TestPoolIDFormatter(t *testing.T) { - actual := NewPoolID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "pool1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *PoolId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1", - Expected: &PoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - Name: "pool1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/POOLS/POOL1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := PoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/batch/resourceids.go b/internal/services/batch/resourceids.go index b669fefe80c3..84b05b211509 100644 --- a/internal/services/batch/resourceids.go +++ b/internal/services/batch/resourceids.go @@ -1,7 +1,3 @@ package batch -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Account -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Application -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Certificate -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Pool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Job -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1/jobs/job1 diff --git a/internal/services/batch/validate/account_id.go b/internal/services/batch/validate/account_id.go deleted file mode 100644 index 5f170e22167c..000000000000 --- a/internal/services/batch/validate/account_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func AccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/account_id_test.go b/internal/services/batch/validate/account_id_test.go deleted file mode 100644 index 315c4c0c2825..000000000000 --- a/internal/services/batch/validate/account_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestAccountID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := AccountID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/batch/validate/application_id.go b/internal/services/batch/validate/application_id.go deleted file mode 100644 index c050f8a8ade6..000000000000 --- a/internal/services/batch/validate/application_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func ApplicationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApplicationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/application_id_test.go b/internal/services/batch/validate/application_id_test.go deleted file mode 100644 index 0f1c9f716c3c..000000000000 --- a/internal/services/batch/validate/application_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestApplicationID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/APPLICATIONS/APPLICATION1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ApplicationID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/batch/validate/certificate_id.go b/internal/services/batch/validate/certificate_id.go deleted file mode 100644 index b0691b76ad58..000000000000 --- a/internal/services/batch/validate/certificate_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func CertificateID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CertificateID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/certificate_id_test.go b/internal/services/batch/validate/certificate_id_test.go deleted file mode 100644 index b96194787fcd..000000000000 --- a/internal/services/batch/validate/certificate_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestCertificateID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/CERTIFICATES/CERTIFICATE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := CertificateID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/batch/validate/pool_id.go b/internal/services/batch/validate/pool_id.go deleted file mode 100644 index b5a96fbe41e5..000000000000 --- a/internal/services/batch/validate/pool_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func PoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.PoolID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/pool_id_test.go b/internal/services/batch/validate/pool_id_test.go deleted file mode 100644 index bcdb1865436b..000000000000 --- a/internal/services/batch/validate/pool_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestPoolID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/POOLS/POOL1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := PoolID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/containerapps/helpers/container_apps.go b/internal/services/containerapps/helpers/container_apps.go index 292adf44d296..bd059740e204 100644 --- a/internal/services/containerapps/helpers/container_apps.go +++ b/internal/services/containerapps/helpers/container_apps.go @@ -235,7 +235,7 @@ func expandContainerAppIngressCustomDomain(input []CustomDomain) *[]containerapp for _, v := range input { customDomain := containerapps.CustomDomain{ Name: v.Name, - CertificateId: v.CertificateId, + CertificateId: pointer.To(v.CertificateId), } bindingType := containerapps.BindingType(v.CertBinding) customDomain.BindingType = &bindingType @@ -255,12 +255,14 @@ func flattenContainerAppIngressCustomDomain(input *[]containerapps.CustomDomain) for _, v := range *input { customDomain := CustomDomain{ - CertificateId: v.CertificateId, - Name: v.Name, + Name: v.Name, } if v.BindingType != nil { customDomain.CertBinding = string(*v.BindingType) } + if v.CertificateId != nil { + customDomain.CertificateId = *v.CertificateId + } result = append(result, customDomain) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/_meta.json deleted file mode 100644 index fd8e0a2af323..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "162460648e39b3cd20ef3d302008add138e90223", - "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", - "tag": "package-2022-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/account.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/account.go deleted file mode 100644 index 85e1bf96682f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/account.go +++ /dev/null @@ -1,1224 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountClient is the batch Client -type AccountClient struct { - BaseClient -} - -// NewAccountClient creates an instance of the AccountClient client. -func NewAccountClient(subscriptionID string) AccountClient { - return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountClientWithBaseURI creates an instance of the AccountClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { - return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API -// and should instead be updated with the Update Batch Account API. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - a name for the Batch account which must be unique within the region. Batch account names must -// be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used -// as part of the DNS name that is used to access the Batch service in the region in which the account is -// created. For example: http://accountname.region.batch.azure.com/. -// parameters - additional parameters for account creation. -func (client AccountClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result AccountCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountCreateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.AccountCreateProperties.KeyVaultReference", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.KeyVaultReference.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountCreateProperties.KeyVaultReference.URL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AccountClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) CreateSender(req *http.Request) (future AccountCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AccountClient) CreateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) DeleteSender(req *http.Request) (future AccountDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetector gets information about the given detector for a given Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// detectorID - the name of the detector. -func (client AccountClient) GetDetector(ctx context.Context, resourceGroupName string, accountName string, detectorID string) (result DetectorResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.GetDetector") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "GetDetector", err.Error()) - } - - req, err := client.GetDetectorPreparer(ctx, resourceGroupName, accountName, detectorID) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetectorSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", resp, "Failure sending request") - return - } - - result, err = client.GetDetectorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", resp, "Failure responding to request") - return - } - - return -} - -// GetDetectorPreparer prepares the GetDetector request. -func (client AccountClient) GetDetectorPreparer(ctx context.Context, resourceGroupName string, accountName string, detectorID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "detectorId": autorest.Encode("path", detectorID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetectorSender sends the GetDetector request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetDetectorSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetectorResponder handles the response to the GetDetector request. The method always -// closes the http.Response Body. -func (client AccountClient) GetDetectorResponder(resp *http.Response) (result DetectorResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetKeys this operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the -// Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to -// authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) GetKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.GetKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "GetKeys", err.Error()) - } - - req, err := client.GetKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure sending request") - return - } - - result, err = client.GetKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetKeysPreparer prepares the GetKeys request. -func (client AccountClient) GetKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetKeysSender sends the GetKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetKeysResponder handles the response to the GetKeys request. The method always -// closes the http.Response Body. -func (client AccountClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets information about the Batch accounts associated with the subscription. -func (client AccountClient) List(ctx context.Context) (result AccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AccountClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.accountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup gets information about the Batch accounts associated with the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -func (client AccountClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.accountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListDetectors gets information about the detectors available for a given Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) ListDetectors(ctx context.Context, resourceGroupName string, accountName string) (result DetectorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListDetectors") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "ListDetectors", err.Error()) - } - - result.fn = client.listDetectorsNextResults - req, err := client.ListDetectorsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", nil, "Failure preparing request") - return - } - - resp, err := client.ListDetectorsSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListDetectorsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListDetectorsPreparer prepares the ListDetectors request. -func (client AccountClient) ListDetectorsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListDetectorsSender sends the ListDetectors request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListDetectorsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListDetectorsResponder handles the response to the ListDetectors request. The method always -// closes the http.Response Body. -func (client AccountClient) ListDetectorsResponder(resp *http.Response) (result DetectorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listDetectorsNextResults retrieves the next set of results, if any. -func (client AccountClient) listDetectorsNextResults(ctx context.Context, lastResults DetectorListResult) (result DetectorListResult, err error) { - req, err := lastResults.detectorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListDetectorsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListDetectorsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListDetectorsComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListDetectorsComplete(ctx context.Context, resourceGroupName string, accountName string) (result DetectorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListDetectors") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListDetectors(ctx, resourceGroupName, accountName) - return -} - -// ListOutboundNetworkDependenciesEndpoints lists the endpoints that a Batch Compute Node under this Batch Account may -// call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you -// specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these -// endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside -// of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, accountName string) (result OutboundEnvironmentEndpointCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.oeec.Response.Response != nil { - sc = result.oeec.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", err.Error()) - } - - result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults - req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.oeec.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") - return - } - - result.oeec, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") - return - } - if result.oeec.hasNextLink() && result.oeec.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundEnvironmentEndpointCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. -func (client AccountClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundEnvironmentEndpointCollection) (result OutboundEnvironmentEndpointCollection, err error) { - req, err := lastResults.outboundEnvironmentEndpointCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, accountName string) (result OutboundEnvironmentEndpointCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, accountName) - return -} - -// RegenerateKey this operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. -// If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to -// authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will -// fail. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// parameters - the type of key to regenerate. -func (client AccountClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.RegenerateKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AccountClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client AccountClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SynchronizeAutoStorageKeys synchronizes access keys for the auto-storage account configured for the specified Batch -// account, only if storage key authentication is being used. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) SynchronizeAutoStorageKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.SynchronizeAutoStorageKeys") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "SynchronizeAutoStorageKeys", err.Error()) - } - - req, err := client.SynchronizeAutoStorageKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") - return - } - - resp, err := client.SynchronizeAutoStorageKeysSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") - return - } - - result, err = client.SynchronizeAutoStorageKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") - return - } - - return -} - -// SynchronizeAutoStorageKeysPreparer prepares the SynchronizeAutoStorageKeys request. -func (client AccountClient) SynchronizeAutoStorageKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SynchronizeAutoStorageKeysSender sends the SynchronizeAutoStorageKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SynchronizeAutoStorageKeysResponder handles the response to the SynchronizeAutoStorageKeys request. The method always -// closes the http.Response Body. -func (client AccountClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates the properties of an existing Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// parameters - additional parameters for account update. -func (client AccountClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/application.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/application.go deleted file mode 100644 index d7019f9a7f45..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/application.go +++ /dev/null @@ -1,530 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationClient is the batch Client -type ApplicationClient struct { - BaseClient -} - -// NewApplicationClient creates an instance of the ApplicationClient client. -func NewApplicationClient(subscriptionID string) ApplicationClient { - return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { - return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create adds an application to the specified Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// parameters - the parameters for the request. -func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationClient) CreateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the applications in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -func (client ApplicationClient) List(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") - defer func() { - sc := -1 - if result.lar.Response.Response != nil { - sc = result.lar.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lar.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") - return - } - - result.lar, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") - return - } - if result.lar.hasNextLink() && result.lar.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ApplicationClient) listNextResults(ctx context.Context, lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { - req, err := lastResults.listApplicationsResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName, maxresults) - return -} - -// Update updates settings for the specified application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// parameters - the parameters for the request. -func (client ApplicationClient) Update(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationClient) UpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/applicationpackage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/applicationpackage.go deleted file mode 100644 index eb01a9e23848..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/applicationpackage.go +++ /dev/null @@ -1,566 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationPackageClient is the batch Client -type ApplicationPackageClient struct { - BaseClient -} - -// NewApplicationPackageClient creates an instance of the ApplicationPackageClient client. -func NewApplicationPackageClient(subscriptionID string) ApplicationPackageClient { - return NewApplicationPackageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationPackageClientWithBaseURI creates an instance of the ApplicationPackageClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageClient { - return ApplicationPackageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Activate activates the specified application package. This should be done after the `ApplicationPackage` was created -// and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -// parameters - the parameters for the request. -func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (result ApplicationPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Activate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Activate", err.Error()) - } - - req, err := client.ActivatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") - return - } - - resp, err := client.ActivateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") - return - } - - result, err = client.ActivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure responding to request") - return - } - - return -} - -// ActivatePreparer prepares the Activate request. -func (client ApplicationPackageClient) ActivatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ActivateSender sends the Activate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ActivateResponder handles the response to the Activate request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create creates an application package record. The record contains a storageUrl where the package should be uploaded -// to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it -// can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -// parameters - the parameters for the request. -func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (result ApplicationPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationPackageClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an application package record and its associated binary file. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName, versionName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationPackageClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified application package. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result ApplicationPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName, versionName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationPackageClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the application packages in the specified application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// maxresults - the maximum number of items to return in the response. -func (client ApplicationPackageClient) List(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") - defer func() { - sc := -1 - if result.lapr.Response.Response != nil { - sc = result.lapr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, applicationName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lapr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure sending request") - return - } - - result.lapr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure responding to request") - return - } - if result.lapr.hasNextLink() && result.lapr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationPackageClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) ListResponder(resp *http.Response) (result ListApplicationPackagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ApplicationPackageClient) listNextResults(ctx context.Context, lastResults ListApplicationPackagesResult) (result ListApplicationPackagesResult, err error) { - req, err := lastResults.listApplicationPackagesResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationPackageClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName, applicationName, maxresults) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/certificate.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/certificate.go deleted file mode 100644 index 4e9e43a2a2ab..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/certificate.go +++ /dev/null @@ -1,660 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CertificateClient is the batch Client -type CertificateClient struct { - BaseClient -} - -// NewCertificateClient creates an instance of the CertificateClient client. -func NewCertificateClient(subscriptionID string) CertificateClient { - return NewCertificateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificateClientWithBaseURI creates an instance of the CertificateClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { - return CertificateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CancelDeletion if you try to delete a certificate that is being used by a pool or compute node, the status of the -// certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this -// operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not -// need to run this operation after the deletion failed. You must make sure that the certificate is not being used by -// any resources, and then you can try again to delete the certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -func (client CertificateClient) CancelDeletion(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.CancelDeletion") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "CancelDeletion", err.Error()) - } - - req, err := client.CancelDeletionPreparer(ctx, resourceGroupName, accountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", nil, "Failure preparing request") - return - } - - resp, err := client.CancelDeletionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure sending request") - return - } - - result, err = client.CancelDeletionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure responding to request") - return - } - - return -} - -// CancelDeletionPreparer prepares the CancelDeletion request. -func (client CertificateClient) CancelDeletionPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelDeletionSender sends the CancelDeletion request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) CancelDeletionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelDeletionResponder handles the response to the CancelDeletion request. The method always -// closes the http.Response Body. -func (client CertificateClient) CancelDeletionResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create creates a new certificate inside the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -// parameters - additional parameters for certificate creation. -// ifMatch - the entity state (ETag) version of the certificate to update. A value of "*" can be used to apply -// the operation only if the certificate already exists. If omitted, this operation will always be applied. -// ifNoneMatch - set to '*' to allow a new certificate to be created, but to prevent updating an existing -// certificate. Other values will be ignored. -func (client CertificateClient) Create(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Data", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client CertificateClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client CertificateClient) CreateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result CertificateDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) DeleteSender(req *http.Request) (future CertificateDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CertificateClient) GetResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the certificates in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -// selectParameter - comma separated list of properties that should be returned. e.g. -// "properties/provisioningState". Only top level properties under properties/ are valid for selection. -// filter - oData filter expression. Valid properties for filtering are "properties/provisioningState", -// "properties/provisioningStateTransitionTime", "name". -func (client CertificateClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lcr.Response.Response != nil { - sc = result.lcr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lcr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lcr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lcr.hasNextLink() && result.lcr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client CertificateClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByBatchAccountResponder(resp *http.Response) (result ListCertificatesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListCertificatesResult) (result ListCertificatesResult, err error) { - req, err := lastResults.listCertificatesResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - return -} - -// Update updates the properties of an existing certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -// parameters - certificate entity to update. -// ifMatch - the entity state (ETag) version of the certificate to update. This value can be omitted or set to -// "*" to apply the operation unconditionally. -func (client CertificateClient) Update(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CertificateClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/client.go deleted file mode 100644 index b44cdbf1fc22..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package batch implements the Azure ARM Batch service API version 2022-01-01. -// -// Batch Client -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Batch - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Batch. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/enums.go deleted file mode 100644 index 46526f60e854..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/enums.go +++ /dev/null @@ -1,617 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountKeyType enumerates the values for account key type. -type AccountKeyType string - -const ( - // AccountKeyTypePrimary The primary account key. - AccountKeyTypePrimary AccountKeyType = "Primary" - // AccountKeyTypeSecondary The secondary account key. - AccountKeyTypeSecondary AccountKeyType = "Secondary" -) - -// PossibleAccountKeyTypeValues returns an array of possible values for the AccountKeyType const type. -func PossibleAccountKeyTypeValues() []AccountKeyType { - return []AccountKeyType{AccountKeyTypePrimary, AccountKeyTypeSecondary} -} - -// AllocationState enumerates the values for allocation state. -type AllocationState string - -const ( - // AllocationStateResizing The pool is resizing; that is, compute nodes are being added to or removed from - // the pool. - AllocationStateResizing AllocationState = "Resizing" - // AllocationStateSteady The pool is not resizing. There are no changes to the number of nodes in the pool - // in progress. A pool enters this state when it is created and when no operations are being performed on - // the pool to change the number of nodes. - AllocationStateSteady AllocationState = "Steady" - // AllocationStateStopping The pool was resizing, but the user has requested that the resize be stopped, - // but the stop request has not yet been completed. - AllocationStateStopping AllocationState = "Stopping" -) - -// PossibleAllocationStateValues returns an array of possible values for the AllocationState const type. -func PossibleAllocationStateValues() []AllocationState { - return []AllocationState{AllocationStateResizing, AllocationStateSteady, AllocationStateStopping} -} - -// AuthenticationMode enumerates the values for authentication mode. -type AuthenticationMode string - -const ( - // AuthenticationModeAAD The authentication mode using Azure Active Directory. - AuthenticationModeAAD AuthenticationMode = "AAD" - // AuthenticationModeSharedKey The authentication mode using shared keys. - AuthenticationModeSharedKey AuthenticationMode = "SharedKey" - // AuthenticationModeTaskAuthenticationToken The authentication mode using task authentication tokens. - AuthenticationModeTaskAuthenticationToken AuthenticationMode = "TaskAuthenticationToken" -) - -// PossibleAuthenticationModeValues returns an array of possible values for the AuthenticationMode const type. -func PossibleAuthenticationModeValues() []AuthenticationMode { - return []AuthenticationMode{AuthenticationModeAAD, AuthenticationModeSharedKey, AuthenticationModeTaskAuthenticationToken} -} - -// AutoStorageAuthenticationMode enumerates the values for auto storage authentication mode. -type AutoStorageAuthenticationMode string - -const ( - // AutoStorageAuthenticationModeBatchAccountManagedIdentity The Batch service will authenticate requests to - // auto-storage using the managed identity assigned to the Batch account. - AutoStorageAuthenticationModeBatchAccountManagedIdentity AutoStorageAuthenticationMode = "BatchAccountManagedIdentity" - // AutoStorageAuthenticationModeStorageKeys The Batch service will authenticate requests to auto-storage - // using storage account keys. - AutoStorageAuthenticationModeStorageKeys AutoStorageAuthenticationMode = "StorageKeys" -) - -// PossibleAutoStorageAuthenticationModeValues returns an array of possible values for the AutoStorageAuthenticationMode const type. -func PossibleAutoStorageAuthenticationModeValues() []AutoStorageAuthenticationMode { - return []AutoStorageAuthenticationMode{AutoStorageAuthenticationModeBatchAccountManagedIdentity, AutoStorageAuthenticationModeStorageKeys} -} - -// AutoUserScope enumerates the values for auto user scope. -type AutoUserScope string - -const ( - // AutoUserScopePool Specifies that the task runs as the common auto user account which is created on every - // node in a pool. - AutoUserScopePool AutoUserScope = "Pool" - // AutoUserScopeTask Specifies that the service should create a new user for the task. - AutoUserScopeTask AutoUserScope = "Task" -) - -// PossibleAutoUserScopeValues returns an array of possible values for the AutoUserScope const type. -func PossibleAutoUserScopeValues() []AutoUserScope { - return []AutoUserScope{AutoUserScopePool, AutoUserScopeTask} -} - -// CachingType enumerates the values for caching type. -type CachingType string - -const ( - // CachingTypeNone The caching mode for the disk is not enabled. - CachingTypeNone CachingType = "None" - // CachingTypeReadOnly The caching mode for the disk is read only. - CachingTypeReadOnly CachingType = "ReadOnly" - // CachingTypeReadWrite The caching mode for the disk is read and write. - CachingTypeReadWrite CachingType = "ReadWrite" -) - -// PossibleCachingTypeValues returns an array of possible values for the CachingType const type. -func PossibleCachingTypeValues() []CachingType { - return []CachingType{CachingTypeNone, CachingTypeReadOnly, CachingTypeReadWrite} -} - -// CertificateFormat enumerates the values for certificate format. -type CertificateFormat string - -const ( - // CertificateFormatCer The certificate is a base64-encoded X.509 certificate. - CertificateFormatCer CertificateFormat = "Cer" - // CertificateFormatPfx The certificate is a PFX (PKCS#12) formatted certificate or certificate chain. - CertificateFormatPfx CertificateFormat = "Pfx" -) - -// PossibleCertificateFormatValues returns an array of possible values for the CertificateFormat const type. -func PossibleCertificateFormatValues() []CertificateFormat { - return []CertificateFormat{CertificateFormatCer, CertificateFormatPfx} -} - -// CertificateProvisioningState enumerates the values for certificate provisioning state. -type CertificateProvisioningState string - -const ( - // CertificateProvisioningStateDeleting The user has requested that the certificate be deleted, but the - // delete operation has not yet completed. You may not reference the certificate when creating or updating - // pools. - CertificateProvisioningStateDeleting CertificateProvisioningState = "Deleting" - // CertificateProvisioningStateFailed The user requested that the certificate be deleted, but there are - // pools that still have references to the certificate, or it is still installed on one or more compute - // nodes. (The latter can occur if the certificate has been removed from the pool, but the node has not yet - // restarted. Nodes refresh their certificates only when they restart.) You may use the cancel certificate - // delete operation to cancel the delete, or the delete certificate operation to retry the delete. - CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" - // CertificateProvisioningStateSucceeded The certificate is available for use in pools. - CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" -) - -// PossibleCertificateProvisioningStateValues returns an array of possible values for the CertificateProvisioningState const type. -func PossibleCertificateProvisioningStateValues() []CertificateProvisioningState { - return []CertificateProvisioningState{CertificateProvisioningStateDeleting, CertificateProvisioningStateFailed, CertificateProvisioningStateSucceeded} -} - -// CertificateStoreLocation enumerates the values for certificate store location. -type CertificateStoreLocation string - -const ( - // CertificateStoreLocationCurrentUser Certificates should be installed to the CurrentUser certificate - // store. - CertificateStoreLocationCurrentUser CertificateStoreLocation = "CurrentUser" - // CertificateStoreLocationLocalMachine Certificates should be installed to the LocalMachine certificate - // store. - CertificateStoreLocationLocalMachine CertificateStoreLocation = "LocalMachine" -) - -// PossibleCertificateStoreLocationValues returns an array of possible values for the CertificateStoreLocation const type. -func PossibleCertificateStoreLocationValues() []CertificateStoreLocation { - return []CertificateStoreLocation{CertificateStoreLocationCurrentUser, CertificateStoreLocationLocalMachine} -} - -// CertificateVisibility enumerates the values for certificate visibility. -type CertificateVisibility string - -const ( - // CertificateVisibilityRemoteUser The certificate should be visible to the user accounts under which users - // remotely access the node. - CertificateVisibilityRemoteUser CertificateVisibility = "RemoteUser" - // CertificateVisibilityStartTask The certificate should be visible to the user account under which the - // start task is run. Note that if AutoUser Scope is Pool for both the StartTask and a Task, this - // certificate will be visible to the Task as well. - CertificateVisibilityStartTask CertificateVisibility = "StartTask" - // CertificateVisibilityTask The certificate should be visible to the user accounts under which job tasks - // are run. - CertificateVisibilityTask CertificateVisibility = "Task" -) - -// PossibleCertificateVisibilityValues returns an array of possible values for the CertificateVisibility const type. -func PossibleCertificateVisibilityValues() []CertificateVisibility { - return []CertificateVisibility{CertificateVisibilityRemoteUser, CertificateVisibilityStartTask, CertificateVisibilityTask} -} - -// ComputeNodeDeallocationOption enumerates the values for compute node deallocation option. -type ComputeNodeDeallocationOption string - -const ( - // ComputeNodeDeallocationOptionRequeue Terminate running task processes and requeue the tasks. The tasks - // will run again when a node is available. Remove nodes as soon as tasks have been terminated. - ComputeNodeDeallocationOptionRequeue ComputeNodeDeallocationOption = "Requeue" - // ComputeNodeDeallocationOptionRetainedData Allow currently running tasks to complete, then wait for all - // task data retention periods to expire. Schedule no new tasks while waiting. Remove nodes when all task - // retention periods have expired. - ComputeNodeDeallocationOptionRetainedData ComputeNodeDeallocationOption = "RetainedData" - // ComputeNodeDeallocationOptionTaskCompletion Allow currently running tasks to complete. Schedule no new - // tasks while waiting. Remove nodes when all tasks have completed. - ComputeNodeDeallocationOptionTaskCompletion ComputeNodeDeallocationOption = "TaskCompletion" - // ComputeNodeDeallocationOptionTerminate Terminate running tasks. The tasks will be completed with - // failureInfo indicating that they were terminated, and will not run again. Remove nodes as soon as tasks - // have been terminated. - ComputeNodeDeallocationOptionTerminate ComputeNodeDeallocationOption = "Terminate" -) - -// PossibleComputeNodeDeallocationOptionValues returns an array of possible values for the ComputeNodeDeallocationOption const type. -func PossibleComputeNodeDeallocationOptionValues() []ComputeNodeDeallocationOption { - return []ComputeNodeDeallocationOption{ComputeNodeDeallocationOptionRequeue, ComputeNodeDeallocationOptionRetainedData, ComputeNodeDeallocationOptionTaskCompletion, ComputeNodeDeallocationOptionTerminate} -} - -// ComputeNodeFillType enumerates the values for compute node fill type. -type ComputeNodeFillType string - -const ( - // ComputeNodeFillTypePack As many tasks as possible (taskSlotsPerNode) should be assigned to each node in - // the pool before any tasks are assigned to the next node in the pool. - ComputeNodeFillTypePack ComputeNodeFillType = "Pack" - // ComputeNodeFillTypeSpread Tasks should be assigned evenly across all nodes in the pool. - ComputeNodeFillTypeSpread ComputeNodeFillType = "Spread" -) - -// PossibleComputeNodeFillTypeValues returns an array of possible values for the ComputeNodeFillType const type. -func PossibleComputeNodeFillTypeValues() []ComputeNodeFillType { - return []ComputeNodeFillType{ComputeNodeFillTypePack, ComputeNodeFillTypeSpread} -} - -// ContainerWorkingDirectory enumerates the values for container working directory. -type ContainerWorkingDirectory string - -const ( - // ContainerWorkingDirectoryContainerImageDefault Using container image defined working directory. Beware - // that this directory will not contain the resource files downloaded by Batch. - ContainerWorkingDirectoryContainerImageDefault ContainerWorkingDirectory = "ContainerImageDefault" - // ContainerWorkingDirectoryTaskWorkingDirectory Use the standard Batch service task working directory, - // which will contain the Task resource files populated by Batch. - ContainerWorkingDirectoryTaskWorkingDirectory ContainerWorkingDirectory = "TaskWorkingDirectory" -) - -// PossibleContainerWorkingDirectoryValues returns an array of possible values for the ContainerWorkingDirectory const type. -func PossibleContainerWorkingDirectoryValues() []ContainerWorkingDirectory { - return []ContainerWorkingDirectory{ContainerWorkingDirectoryContainerImageDefault, ContainerWorkingDirectoryTaskWorkingDirectory} -} - -// DiffDiskPlacement enumerates the values for diff disk placement. -type DiffDiskPlacement string - -const ( - // DiffDiskPlacementCacheDisk The Ephemeral OS Disk is stored on the VM cache. - DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" -) - -// PossibleDiffDiskPlacementValues returns an array of possible values for the DiffDiskPlacement const type. -func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { - return []DiffDiskPlacement{DiffDiskPlacementCacheDisk} -} - -// DiskEncryptionTarget enumerates the values for disk encryption target. -type DiskEncryptionTarget string - -const ( - // DiskEncryptionTargetOsDisk The OS Disk on the compute node is encrypted. - DiskEncryptionTargetOsDisk DiskEncryptionTarget = "OsDisk" - // DiskEncryptionTargetTemporaryDisk The temporary disk on the compute node is encrypted. On Linux this - // encryption applies to other partitions (such as those on mounted data disks) when encryption occurs at - // boot time. - DiskEncryptionTargetTemporaryDisk DiskEncryptionTarget = "TemporaryDisk" -) - -// PossibleDiskEncryptionTargetValues returns an array of possible values for the DiskEncryptionTarget const type. -func PossibleDiskEncryptionTargetValues() []DiskEncryptionTarget { - return []DiskEncryptionTarget{DiskEncryptionTargetOsDisk, DiskEncryptionTargetTemporaryDisk} -} - -// DynamicVNetAssignmentScope enumerates the values for dynamic v net assignment scope. -type DynamicVNetAssignmentScope string - -const ( - // DynamicVNetAssignmentScopeJob Dynamic VNet assignment is done per-job. Don't use this option unless your - // batch account has been approved to use this feature. - DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = "job" - // DynamicVNetAssignmentScopeNone No dynamic VNet assignment is enabled. - DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = "none" -) - -// PossibleDynamicVNetAssignmentScopeValues returns an array of possible values for the DynamicVNetAssignmentScope const type. -func PossibleDynamicVNetAssignmentScopeValues() []DynamicVNetAssignmentScope { - return []DynamicVNetAssignmentScope{DynamicVNetAssignmentScopeJob, DynamicVNetAssignmentScopeNone} -} - -// ElevationLevel enumerates the values for elevation level. -type ElevationLevel string - -const ( - // ElevationLevelAdmin The user is a user with elevated access and operates with full Administrator - // permissions. - ElevationLevelAdmin ElevationLevel = "Admin" - // ElevationLevelNonAdmin The user is a standard user without elevated access. - ElevationLevelNonAdmin ElevationLevel = "NonAdmin" -) - -// PossibleElevationLevelValues returns an array of possible values for the ElevationLevel const type. -func PossibleElevationLevelValues() []ElevationLevel { - return []ElevationLevel{ElevationLevelAdmin, ElevationLevelNonAdmin} -} - -// InboundEndpointProtocol enumerates the values for inbound endpoint protocol. -type InboundEndpointProtocol string - -const ( - // InboundEndpointProtocolTCP Use TCP for the endpoint. - InboundEndpointProtocolTCP InboundEndpointProtocol = "TCP" - // InboundEndpointProtocolUDP Use UDP for the endpoint. - InboundEndpointProtocolUDP InboundEndpointProtocol = "UDP" -) - -// PossibleInboundEndpointProtocolValues returns an array of possible values for the InboundEndpointProtocol const type. -func PossibleInboundEndpointProtocolValues() []InboundEndpointProtocol { - return []InboundEndpointProtocol{InboundEndpointProtocolTCP, InboundEndpointProtocolUDP} -} - -// InterNodeCommunicationState enumerates the values for inter node communication state. -type InterNodeCommunicationState string - -const ( - // InterNodeCommunicationStateDisabled Disable network communication between virtual machines. - InterNodeCommunicationStateDisabled InterNodeCommunicationState = "Disabled" - // InterNodeCommunicationStateEnabled Enable network communication between virtual machines. - InterNodeCommunicationStateEnabled InterNodeCommunicationState = "Enabled" -) - -// PossibleInterNodeCommunicationStateValues returns an array of possible values for the InterNodeCommunicationState const type. -func PossibleInterNodeCommunicationStateValues() []InterNodeCommunicationState { - return []InterNodeCommunicationState{InterNodeCommunicationStateDisabled, InterNodeCommunicationStateEnabled} -} - -// IPAddressProvisioningType enumerates the values for ip address provisioning type. -type IPAddressProvisioningType string - -const ( - // IPAddressProvisioningTypeBatchManaged A public IP will be created and managed by Batch. There may be - // multiple public IPs depending on the size of the Pool. - IPAddressProvisioningTypeBatchManaged IPAddressProvisioningType = "BatchManaged" - // IPAddressProvisioningTypeNoPublicIPAddresses No public IP Address will be created for the Compute Nodes - // in the Pool. - IPAddressProvisioningTypeNoPublicIPAddresses IPAddressProvisioningType = "NoPublicIPAddresses" - // IPAddressProvisioningTypeUserManaged Public IPs are provided by the user and will be used to provision - // the Compute Nodes. - IPAddressProvisioningTypeUserManaged IPAddressProvisioningType = "UserManaged" -) - -// PossibleIPAddressProvisioningTypeValues returns an array of possible values for the IPAddressProvisioningType const type. -func PossibleIPAddressProvisioningTypeValues() []IPAddressProvisioningType { - return []IPAddressProvisioningType{IPAddressProvisioningTypeBatchManaged, IPAddressProvisioningTypeNoPublicIPAddresses, IPAddressProvisioningTypeUserManaged} -} - -// KeySource enumerates the values for key source. -type KeySource string - -const ( - // KeySourceMicrosoftBatch Batch creates and manages the encryption keys used to protect the account data. - KeySourceMicrosoftBatch KeySource = "Microsoft.Batch" - // KeySourceMicrosoftKeyVault The encryption keys used to protect the account data are stored in an - // external key vault. If this is set then the Batch Account identity must be set to `SystemAssigned` and a - // valid Key Identifier must also be supplied under the keyVaultProperties. - KeySourceMicrosoftKeyVault KeySource = "Microsoft.KeyVault" -) - -// PossibleKeySourceValues returns an array of possible values for the KeySource const type. -func PossibleKeySourceValues() []KeySource { - return []KeySource{KeySourceMicrosoftBatch, KeySourceMicrosoftKeyVault} -} - -// LoginMode enumerates the values for login mode. -type LoginMode string - -const ( - // LoginModeBatch The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long - // running parallel processes. - LoginModeBatch LoginMode = "Batch" - // LoginModeInteractive The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having - // permissions associated with the interactive login mode. If this is the case for an application used in - // your task, then this option is recommended. - LoginModeInteractive LoginMode = "Interactive" -) - -// PossibleLoginModeValues returns an array of possible values for the LoginMode const type. -func PossibleLoginModeValues() []LoginMode { - return []LoginMode{LoginModeBatch, LoginModeInteractive} -} - -// NameAvailabilityReason enumerates the values for name availability reason. -type NameAvailabilityReason string - -const ( - // NameAvailabilityReasonAlreadyExists The requested name is already in use. - NameAvailabilityReasonAlreadyExists NameAvailabilityReason = "AlreadyExists" - // NameAvailabilityReasonInvalid The requested name is invalid. - NameAvailabilityReasonInvalid NameAvailabilityReason = "Invalid" -) - -// PossibleNameAvailabilityReasonValues returns an array of possible values for the NameAvailabilityReason const type. -func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { - return []NameAvailabilityReason{NameAvailabilityReasonAlreadyExists, NameAvailabilityReasonInvalid} -} - -// NetworkSecurityGroupRuleAccess enumerates the values for network security group rule access. -type NetworkSecurityGroupRuleAccess string - -const ( - // NetworkSecurityGroupRuleAccessAllow Allow access. - NetworkSecurityGroupRuleAccessAllow NetworkSecurityGroupRuleAccess = "Allow" - // NetworkSecurityGroupRuleAccessDeny Deny access. - NetworkSecurityGroupRuleAccessDeny NetworkSecurityGroupRuleAccess = "Deny" -) - -// PossibleNetworkSecurityGroupRuleAccessValues returns an array of possible values for the NetworkSecurityGroupRuleAccess const type. -func PossibleNetworkSecurityGroupRuleAccessValues() []NetworkSecurityGroupRuleAccess { - return []NetworkSecurityGroupRuleAccess{NetworkSecurityGroupRuleAccessAllow, NetworkSecurityGroupRuleAccessDeny} -} - -// NodePlacementPolicyType enumerates the values for node placement policy type. -type NodePlacementPolicyType string - -const ( - // NodePlacementPolicyTypeRegional All nodes in the pool will be allocated in the same region. - NodePlacementPolicyTypeRegional NodePlacementPolicyType = "Regional" - // NodePlacementPolicyTypeZonal Nodes in the pool will be spread across different zones with best effort - // balancing. - NodePlacementPolicyTypeZonal NodePlacementPolicyType = "Zonal" -) - -// PossibleNodePlacementPolicyTypeValues returns an array of possible values for the NodePlacementPolicyType const type. -func PossibleNodePlacementPolicyTypeValues() []NodePlacementPolicyType { - return []NodePlacementPolicyType{NodePlacementPolicyTypeRegional, NodePlacementPolicyTypeZonal} -} - -// PackageState enumerates the values for package state. -type PackageState string - -const ( - // PackageStateActive The application package is ready for use. - PackageStateActive PackageState = "Active" - // PackageStatePending The application package has been created but has not yet been activated. - PackageStatePending PackageState = "Pending" -) - -// PossiblePackageStateValues returns an array of possible values for the PackageState const type. -func PossiblePackageStateValues() []PackageState { - return []PackageState{PackageStateActive, PackageStatePending} -} - -// PoolAllocationMode enumerates the values for pool allocation mode. -type PoolAllocationMode string - -const ( - // PoolAllocationModeBatchService Pools will be allocated in subscriptions owned by the Batch service. - PoolAllocationModeBatchService PoolAllocationMode = "BatchService" - // PoolAllocationModeUserSubscription Pools will be allocated in a subscription owned by the user. - PoolAllocationModeUserSubscription PoolAllocationMode = "UserSubscription" -) - -// PossiblePoolAllocationModeValues returns an array of possible values for the PoolAllocationMode const type. -func PossiblePoolAllocationModeValues() []PoolAllocationMode { - return []PoolAllocationMode{PoolAllocationModeBatchService, PoolAllocationModeUserSubscription} -} - -// PoolIdentityType enumerates the values for pool identity type. -type PoolIdentityType string - -const ( - // PoolIdentityTypeNone Batch pool has no identity associated with it. Setting `None` in update pool will - // remove existing identities. - PoolIdentityTypeNone PoolIdentityType = "None" - // PoolIdentityTypeUserAssigned Batch pool has user assigned identities with it. - PoolIdentityTypeUserAssigned PoolIdentityType = "UserAssigned" -) - -// PossiblePoolIdentityTypeValues returns an array of possible values for the PoolIdentityType const type. -func PossiblePoolIdentityTypeValues() []PoolIdentityType { - return []PoolIdentityType{PoolIdentityTypeNone, PoolIdentityTypeUserAssigned} -} - -// PoolProvisioningState enumerates the values for pool provisioning state. -type PoolProvisioningState string - -const ( - // PoolProvisioningStateDeleting The user has requested that the pool be deleted, but the delete operation - // has not yet completed. - PoolProvisioningStateDeleting PoolProvisioningState = "Deleting" - // PoolProvisioningStateSucceeded The pool is available to run tasks subject to the availability of compute - // nodes. - PoolProvisioningStateSucceeded PoolProvisioningState = "Succeeded" -) - -// PossiblePoolProvisioningStateValues returns an array of possible values for the PoolProvisioningState const type. -func PossiblePoolProvisioningStateValues() []PoolProvisioningState { - return []PoolProvisioningState{PoolProvisioningStateDeleting, PoolProvisioningStateSucceeded} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateFailed The user requested that the connection be updated and - // it failed. You may retry the update operation. - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded The connection status is final and is ready for use - // if Status is Approved. - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" - // PrivateEndpointConnectionProvisioningStateUpdating The user has requested that the connection status be - // updated, but the update operation has not yet completed. You may not reference the connection when - // connecting the Batch account. - PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded, PrivateEndpointConnectionProvisioningStateUpdating} -} - -// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. -type PrivateLinkServiceConnectionStatus string - -const ( - // PrivateLinkServiceConnectionStatusApproved The private endpoint connection is approved and can be used - // to access Batch account - PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" - // PrivateLinkServiceConnectionStatusDisconnected The private endpoint connection is disconnected and - // cannot be used to access Batch account - PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" - // PrivateLinkServiceConnectionStatusPending The private endpoint connection is pending and cannot be used - // to access Batch account - PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" - // PrivateLinkServiceConnectionStatusRejected The private endpoint connection is rejected and cannot be - // used to access Batch account - PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. -func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { - return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCancelled The last operation for the account is cancelled. - ProvisioningStateCancelled ProvisioningState = "Cancelled" - // ProvisioningStateCreating The account is being created. - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting The account is being deleted. - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed The last operation for the account is failed. - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateInvalid The account is in an invalid state. - ProvisioningStateInvalid ProvisioningState = "Invalid" - // ProvisioningStateSucceeded The account has been created and is ready for use. - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCancelled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateInvalid, ProvisioningStateSucceeded} -} - -// PublicNetworkAccessType enumerates the values for public network access type. -type PublicNetworkAccessType string - -const ( - // PublicNetworkAccessTypeDisabled Disables public connectivity and enables private connectivity to Azure - // Batch Service through private endpoint resource. - PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" - // PublicNetworkAccessTypeEnabled Enables connectivity to Azure Batch through public DNS. - PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" -) - -// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. -func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { - return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone Batch account has no identity associated with it. Setting `None` in update - // account will remove existing identities. - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned Batch account has a system assigned identity with it. - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeUserAssigned Batch account has user assigned identities with it. - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} -} - -// StorageAccountType enumerates the values for storage account type. -type StorageAccountType string - -const ( - // StorageAccountTypePremiumLRS The data disk should use premium locally redundant storage. - StorageAccountTypePremiumLRS StorageAccountType = "Premium_LRS" - // StorageAccountTypeStandardLRS The data disk should use standard locally redundant storage. - StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" -) - -// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. -func PossibleStorageAccountTypeValues() []StorageAccountType { - return []StorageAccountType{StorageAccountTypePremiumLRS, StorageAccountTypeStandardLRS} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/location.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/location.go deleted file mode 100644 index 725202832bb4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/location.go +++ /dev/null @@ -1,440 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationClient is the batch Client -type LocationClient struct { - BaseClient -} - -// NewLocationClient creates an instance of the LocationClient client. -func NewLocationClient(subscriptionID string) LocationClient { - return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationClientWithBaseURI creates an instance of the LocationClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { - return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the Batch account name is available in the specified region. -// Parameters: -// locationName - the desired region for the name check. -// parameters - properties needed to check the availability of a name. -func (client LocationClient) CheckNameAvailability(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.LocationClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, locationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client LocationClient) CheckNameAvailabilityPreparer(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client LocationClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQuotas gets the Batch service quotas for the specified subscription at the given location. -// Parameters: -// locationName - the region for which to retrieve Batch service quotas. -func (client LocationClient) GetQuotas(ctx context.Context, locationName string) (result LocationQuota, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.GetQuotas") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetQuotasPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", nil, "Failure preparing request") - return - } - - resp, err := client.GetQuotasSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure sending request") - return - } - - result, err = client.GetQuotasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure responding to request") - return - } - - return -} - -// GetQuotasPreparer prepares the GetQuotas request. -func (client LocationClient) GetQuotasPreparer(ctx context.Context, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetQuotasSender sends the GetQuotas request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) GetQuotasSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetQuotasResponder handles the response to the GetQuotas request. The method always -// closes the http.Response Body. -func (client LocationClient) GetQuotasResponder(resp *http.Response) (result LocationQuota, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSupportedCloudServiceSkus gets the list of Batch supported Cloud Service VM sizes available at the given -// location. -// Parameters: -// locationName - the region for which to retrieve Batch service supported SKUs. -// maxresults - the maximum number of items to return in the response. -// filter - oData filter expression. Valid properties for filtering are "familyName". -func (client LocationClient) ListSupportedCloudServiceSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedCloudServiceSkus") - defer func() { - sc := -1 - if result.ssr.Response.Response != nil { - sc = result.ssr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSupportedCloudServiceSkusNextResults - req, err := client.ListSupportedCloudServiceSkusPreparer(ctx, locationName, maxresults, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSupportedCloudServiceSkusSender(req) - if err != nil { - result.ssr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", resp, "Failure sending request") - return - } - - result.ssr, err = client.ListSupportedCloudServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", resp, "Failure responding to request") - return - } - if result.ssr.hasNextLink() && result.ssr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSupportedCloudServiceSkusPreparer prepares the ListSupportedCloudServiceSkus request. -func (client LocationClient) ListSupportedCloudServiceSkusPreparer(ctx context.Context, locationName string, maxresults *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSupportedCloudServiceSkusSender sends the ListSupportedCloudServiceSkus request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListSupportedCloudServiceSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSupportedCloudServiceSkusResponder handles the response to the ListSupportedCloudServiceSkus request. The method always -// closes the http.Response Body. -func (client LocationClient) ListSupportedCloudServiceSkusResponder(resp *http.Response) (result SupportedSkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSupportedCloudServiceSkusNextResults retrieves the next set of results, if any. -func (client LocationClient) listSupportedCloudServiceSkusNextResults(ctx context.Context, lastResults SupportedSkusResult) (result SupportedSkusResult, err error) { - req, err := lastResults.supportedSkusResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSupportedCloudServiceSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSupportedCloudServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSupportedCloudServiceSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListSupportedCloudServiceSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedCloudServiceSkus") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSupportedCloudServiceSkus(ctx, locationName, maxresults, filter) - return -} - -// ListSupportedVirtualMachineSkus gets the list of Batch supported Virtual Machine VM sizes available at the given -// location. -// Parameters: -// locationName - the region for which to retrieve Batch service supported SKUs. -// maxresults - the maximum number of items to return in the response. -// filter - oData filter expression. Valid properties for filtering are "familyName". -func (client LocationClient) ListSupportedVirtualMachineSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedVirtualMachineSkus") - defer func() { - sc := -1 - if result.ssr.Response.Response != nil { - sc = result.ssr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSupportedVirtualMachineSkusNextResults - req, err := client.ListSupportedVirtualMachineSkusPreparer(ctx, locationName, maxresults, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSupportedVirtualMachineSkusSender(req) - if err != nil { - result.ssr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", resp, "Failure sending request") - return - } - - result.ssr, err = client.ListSupportedVirtualMachineSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", resp, "Failure responding to request") - return - } - if result.ssr.hasNextLink() && result.ssr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSupportedVirtualMachineSkusPreparer prepares the ListSupportedVirtualMachineSkus request. -func (client LocationClient) ListSupportedVirtualMachineSkusPreparer(ctx context.Context, locationName string, maxresults *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSupportedVirtualMachineSkusSender sends the ListSupportedVirtualMachineSkus request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListSupportedVirtualMachineSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSupportedVirtualMachineSkusResponder handles the response to the ListSupportedVirtualMachineSkus request. The method always -// closes the http.Response Body. -func (client LocationClient) ListSupportedVirtualMachineSkusResponder(resp *http.Response) (result SupportedSkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSupportedVirtualMachineSkusNextResults retrieves the next set of results, if any. -func (client LocationClient) listSupportedVirtualMachineSkusNextResults(ctx context.Context, lastResults SupportedSkusResult) (result SupportedSkusResult, err error) { - req, err := lastResults.supportedSkusResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSupportedVirtualMachineSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSupportedVirtualMachineSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSupportedVirtualMachineSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListSupportedVirtualMachineSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedVirtualMachineSkus") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSupportedVirtualMachineSkus(ctx, locationName, maxresults, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/models.go deleted file mode 100644 index 58e84aa89932..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/models.go +++ /dev/null @@ -1,4075 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" - -// Account contains information about an Azure Batch account. -type Account struct { - autorest.Response `json:"-"` - // AccountProperties - The properties associated with the account. - *AccountProperties `json:"properties,omitempty"` - // Identity - The identity of the Batch account. - Identity *AccountIdentity `json:"identity,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - READ-ONLY; The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties - } - if a.Identity != nil { - objectMap["identity"] = a.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "identity": - if v != nil { - var identity AccountIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - a.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - } - } - - return nil -} - -// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountCreateFuture.Result. -func (future *AccountCreateFuture) result(client AccountClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.AccountCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountCreateParameters parameters supplied to the Create operation. -type AccountCreateParameters struct { - // Location - The region in which to create the account. - Location *string `json:"location,omitempty"` - // Tags - The user-specified tags associated with the account. - Tags map[string]*string `json:"tags"` - // AccountCreateProperties - The properties of the Batch account. - *AccountCreateProperties `json:"properties,omitempty"` - // Identity - The identity of the Batch account. - Identity *AccountIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountCreateParameters. -func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.Location != nil { - objectMap["location"] = acp.Location - } - if acp.Tags != nil { - objectMap["tags"] = acp.Tags - } - if acp.AccountCreateProperties != nil { - objectMap["properties"] = acp.AccountCreateProperties - } - if acp.Identity != nil { - objectMap["identity"] = acp.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. -func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - acp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - acp.Tags = tags - } - case "properties": - if v != nil { - var accountCreateProperties AccountCreateProperties - err = json.Unmarshal(*v, &accountCreateProperties) - if err != nil { - return err - } - acp.AccountCreateProperties = &accountCreateProperties - } - case "identity": - if v != nil { - var identity AccountIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - acp.Identity = &identity - } - } - } - - return nil -} - -// AccountCreateProperties the properties of a Batch account. -type AccountCreateProperties struct { - // AutoStorage - The properties related to the auto-storage account. - AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` - // PoolAllocationMode - The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'PoolAllocationModeBatchService', 'PoolAllocationModeUserSubscription' - PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` - // KeyVaultReference - A reference to the Azure key vault associated with the Batch account. - KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` - // PublicNetworkAccess - If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` - // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - Encryption *EncryptionProperties `json:"encryption,omitempty"` - // AllowedAuthenticationModes - List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` -} - -// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountDeleteFuture.Result. -func (future *AccountDeleteFuture) result(client AccountClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.AccountDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountIdentity the identity of the Batch account, if configured. This is used when the user specifies -// 'Microsoft.KeyVault' as their Batch account encryption configuration or when `ManagedIdentity` is -// selected as the auto-storage authentication mode. -type AccountIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the Batch account. This property will only be provided for a system assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id associated with the Batch account. This property will only be provided for a system assigned identity. - TenantID *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the Batch account. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the Batch account. - UserAssignedIdentities map[string]*UserAssignedIdentities `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for AccountIdentity. -func (ai AccountIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ai.Type != "" { - objectMap["type"] = ai.Type - } - if ai.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = ai.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// AccountKeys a set of Azure Batch account keys. -type AccountKeys struct { - autorest.Response `json:"-"` - // AccountName - READ-ONLY; The Batch account name. - AccountName *string `json:"accountName,omitempty"` - // Primary - READ-ONLY; The primary key associated with the account. - Primary *string `json:"primary,omitempty"` - // Secondary - READ-ONLY; The secondary key associated with the account. - Secondary *string `json:"secondary,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountKeys. -func (ak AccountKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountListResult values returned by the List operation. -type AccountListResult struct { - autorest.Response `json:"-"` - // Value - The collection of Batch accounts returned by the listing operation. - Value *[]Account `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// AccountListResultIterator provides access to a complete listing of Account values. -type AccountListResultIterator struct { - i int - page AccountListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountListResultIterator) Response() AccountListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountListResultIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountListResultIterator type. -func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { - return AccountListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr AccountListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr AccountListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// accountListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { - if !alr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(alr.NextLink))) -} - -// AccountListResultPage contains a page of Account values. -type AccountListResultPage struct { - fn func(context.Context, AccountListResult) (AccountListResult, error) - alr AccountListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.alr) - if err != nil { - return err - } - page.alr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountListResultPage) Response() AccountListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountListResultPage) Values() []Account { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the AccountListResultPage type. -func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { - return AccountListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// AccountProperties account specific properties. -type AccountProperties struct { - // AccountEndpoint - READ-ONLY; The account endpoint used to interact with the Batch service. - AccountEndpoint *string `json:"accountEndpoint,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateInvalid', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCancelled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PoolAllocationMode - READ-ONLY; Possible values include: 'PoolAllocationModeBatchService', 'PoolAllocationModeUserSubscription' - PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` - // KeyVaultReference - READ-ONLY - KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` - // PublicNetworkAccess - READ-ONLY; If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the Batch account - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // AutoStorage - READ-ONLY - AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` - // Encryption - READ-ONLY; Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - Encryption *EncryptionProperties `json:"encryption,omitempty"` - // DedicatedCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. - DedicatedCoreQuota *int32 `json:"dedicatedCoreQuota,omitempty"` - // LowPriorityCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. - LowPriorityCoreQuota *int32 `json:"lowPriorityCoreQuota,omitempty"` - // DedicatedCoreQuotaPerVMFamily - READ-ONLY; A list of the dedicated core quota per Virtual Machine family for the Batch account. For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. - DedicatedCoreQuotaPerVMFamily *[]VirtualMachineFamilyCoreQuota `json:"dedicatedCoreQuotaPerVMFamily,omitempty"` - // DedicatedCoreQuotaPerVMFamilyEnforced - READ-ONLY; Batch is transitioning its core quota system for dedicated cores to be enforced per Virtual Machine family. During this transitional phase, the dedicated core quota per Virtual Machine family may not yet be enforced. If this flag is false, dedicated core quota is enforced via the old dedicatedCoreQuota property on the account and does not consider Virtual Machine family. If this flag is true, dedicated core quota is enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the old dedicatedCoreQuota does not apply. - DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty"` - // PoolQuota - READ-ONLY - PoolQuota *int32 `json:"poolQuota,omitempty"` - // ActiveJobAndJobScheduleQuota - READ-ONLY - ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` - // AllowedAuthenticationModes - READ-ONLY; List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation. -type AccountRegenerateKeyParameters struct { - // KeyName - The type of account key to regenerate. Possible values include: 'AccountKeyTypePrimary', 'AccountKeyTypeSecondary' - KeyName AccountKeyType `json:"keyName,omitempty"` -} - -// AccountUpdateParameters parameters for updating an Azure Batch account. -type AccountUpdateParameters struct { - // Tags - The user-specified tags associated with the account. - Tags map[string]*string `json:"tags"` - // AccountUpdateProperties - The properties of the account. - *AccountUpdateProperties `json:"properties,omitempty"` - // Identity - The identity of the Batch account. - Identity *AccountIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - if aup.AccountUpdateProperties != nil { - objectMap["properties"] = aup.AccountUpdateProperties - } - if aup.Identity != nil { - objectMap["identity"] = aup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. -func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aup.Tags = tags - } - case "properties": - if v != nil { - var accountUpdateProperties AccountUpdateProperties - err = json.Unmarshal(*v, &accountUpdateProperties) - if err != nil { - return err - } - aup.AccountUpdateProperties = &accountUpdateProperties - } - case "identity": - if v != nil { - var identity AccountIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - aup.Identity = &identity - } - } - } - - return nil -} - -// AccountUpdateProperties the properties of a Batch account. -type AccountUpdateProperties struct { - // AutoStorage - The properties related to the auto-storage account. - AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` - // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - Encryption *EncryptionProperties `json:"encryption,omitempty"` - // AllowedAuthenticationModes - List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` -} - -// ActivateApplicationPackageParameters parameters for an activating an application package. -type ActivateApplicationPackageParameters struct { - // Format - The format of the application package binary file. - Format *string `json:"format,omitempty"` -} - -// Application contains information about an application in a Batch account. -type Application struct { - autorest.Response `json:"-"` - // ApplicationProperties - The properties associated with the Application. - *ApplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Application. -func (a Application) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.ApplicationProperties != nil { - objectMap["properties"] = a.ApplicationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Application struct. -func (a *Application) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationProperties ApplicationProperties - err = json.Unmarshal(*v, &applicationProperties) - if err != nil { - return err - } - a.ApplicationProperties = &applicationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - } - } - - return nil -} - -// ApplicationPackage an application package which represents a particular version of an application. -type ApplicationPackage struct { - autorest.Response `json:"-"` - // ApplicationPackageProperties - The properties associated with the Application Package. - *ApplicationPackageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationPackage. -func (ap ApplicationPackage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ApplicationPackageProperties != nil { - objectMap["properties"] = ap.ApplicationPackageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationPackage struct. -func (ap *ApplicationPackage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationPackageProperties ApplicationPackageProperties - err = json.Unmarshal(*v, &applicationPackageProperties) - if err != nil { - return err - } - ap.ApplicationPackageProperties = &applicationPackageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ap.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ap.Etag = &etag - } - } - } - - return nil -} - -// ApplicationPackageProperties properties of an application package -type ApplicationPackageProperties struct { - // State - READ-ONLY; The current state of the application package. Possible values include: 'PackageStatePending', 'PackageStateActive' - State PackageState `json:"state,omitempty"` - // Format - READ-ONLY; The format of the application package, if the package is active. - Format *string `json:"format,omitempty"` - // StorageURL - READ-ONLY; The URL for the application package in Azure Storage. - StorageURL *string `json:"storageUrl,omitempty"` - // StorageURLExpiry - READ-ONLY; The UTC time at which the Azure Storage URL will expire. - StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` - // LastActivationTime - READ-ONLY; The time at which the package was last activated, if the package is active. - LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationPackageProperties. -func (app ApplicationPackageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationPackageReference ... -type ApplicationPackageReference struct { - ID *string `json:"id,omitempty"` - // Version - If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, the HTTP status code is 409. - Version *string `json:"version,omitempty"` -} - -// ApplicationProperties the properties associated with the Application. -type ApplicationProperties struct { - // DisplayName - The display name for the application. - DisplayName *string `json:"displayName,omitempty"` - // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. - AllowUpdates *bool `json:"allowUpdates,omitempty"` - // DefaultVersion - The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. - DefaultVersion *string `json:"defaultVersion,omitempty"` -} - -// AutoScaleRun ... -type AutoScaleRun struct { - EvaluationTime *date.Time `json:"evaluationTime,omitempty"` - // Results - Each variable value is returned in the form $variable=value, and variables are separated by semicolons. - Results *string `json:"results,omitempty"` - Error *AutoScaleRunError `json:"error,omitempty"` -} - -// AutoScaleRunError ... -type AutoScaleRunError struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - Details *[]AutoScaleRunError `json:"details,omitempty"` -} - -// AutoScaleSettings ... -type AutoScaleSettings struct { - Formula *string `json:"formula,omitempty"` - // EvaluationInterval - If omitted, the default value is 15 minutes (PT15M). - EvaluationInterval *string `json:"evaluationInterval,omitempty"` -} - -// AutoStorageBaseProperties the properties related to the auto-storage account. -type AutoStorageBaseProperties struct { - // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // AuthenticationMode - The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: 'AutoStorageAuthenticationModeStorageKeys', 'AutoStorageAuthenticationModeBatchAccountManagedIdentity' - AuthenticationMode AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` - // NodeIdentityReference - The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. - NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` -} - -// AutoStorageProperties contains information about the auto-storage account associated with a Batch -// account. -type AutoStorageProperties struct { - // LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account. - LastKeySync *date.Time `json:"lastKeySync,omitempty"` - // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // AuthenticationMode - The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: 'AutoStorageAuthenticationModeStorageKeys', 'AutoStorageAuthenticationModeBatchAccountManagedIdentity' - AuthenticationMode AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` - // NodeIdentityReference - The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. - NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` -} - -// AutoUserSpecification ... -type AutoUserSpecification struct { - // Scope - The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by start tasks. Possible values include: 'AutoUserScopeTask', 'AutoUserScopePool' - Scope AutoUserScope `json:"scope,omitempty"` - // ElevationLevel - The default value is nonAdmin. Possible values include: 'ElevationLevelNonAdmin', 'ElevationLevelAdmin' - ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` -} - -// AzureBlobFileSystemConfiguration ... -type AzureBlobFileSystemConfiguration struct { - AccountName *string `json:"accountName,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - // AccountKey - This property is mutually exclusive with both sasKey and identity; exactly one must be specified. - AccountKey *string `json:"accountKey,omitempty"` - // SasKey - This property is mutually exclusive with both accountKey and identity; exactly one must be specified. - SasKey *string `json:"sasKey,omitempty"` - // BlobfuseOptions - These are 'net use' options in Windows and 'mount' options in Linux. - BlobfuseOptions *string `json:"blobfuseOptions,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // IdentityReference - This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified. - IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` -} - -// AzureFileShareConfiguration ... -type AzureFileShareConfiguration struct { - AccountName *string `json:"accountName,omitempty"` - // AzureFileURL - This is of the form 'https://{account}.file.core.windows.net/'. - AzureFileURL *string `json:"azureFileUrl,omitempty"` - AccountKey *string `json:"accountKey,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. - MountOptions *string `json:"mountOptions,omitempty"` -} - -// Certificate contains information about a certificate. -type Certificate struct { - autorest.Response `json:"-"` - // CertificateProperties - The properties associated with the certificate. - *CertificateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Certificate. -func (c Certificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.CertificateProperties != nil { - objectMap["properties"] = c.CertificateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Certificate struct. -func (c *Certificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var certificateProperties CertificateProperties - err = json.Unmarshal(*v, &certificateProperties) - if err != nil { - return err - } - c.CertificateProperties = &certificateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - c.Etag = &etag - } - } - } - - return nil -} - -// CertificateBaseProperties base certificate properties. -type CertificateBaseProperties struct { - // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. - ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` - // Thumbprint - This must match the thumbprint from the name. - Thumbprint *string `json:"thumbprint,omitempty"` - // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' - Format CertificateFormat `json:"format,omitempty"` -} - -// CertificateCreateOrUpdateParameters contains information about a certificate. -type CertificateCreateOrUpdateParameters struct { - // CertificateCreateOrUpdateProperties - The properties associated with the certificate. - *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. -func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.CertificateCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.CertificateCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateCreateOrUpdateParameters struct. -func (ccoup *CertificateCreateOrUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties - err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ccoup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ccoup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ccoup.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ccoup.Etag = &etag - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties certificate properties for create operations -type CertificateCreateOrUpdateProperties struct { - // Data - The maximum size is 10KB. - Data *string `json:"data,omitempty"` - // Password - This must not be specified if the certificate format is Cer. - Password *string `json:"password,omitempty"` - // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. - ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` - // Thumbprint - This must match the thumbprint from the name. - Thumbprint *string `json:"thumbprint,omitempty"` - // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' - Format CertificateFormat `json:"format,omitempty"` -} - -// CertificateDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CertificateDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CertificateClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CertificateDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CertificateDeleteFuture.Result. -func (future *CertificateDeleteFuture) result(client CertificateClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.CertificateDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// CertificateProperties certificate properties. -type CertificateProperties struct { - // ProvisioningState - READ-ONLY; Possible values include: 'CertificateProvisioningStateSucceeded', 'CertificateProvisioningStateDeleting', 'CertificateProvisioningStateFailed' - ProvisioningState CertificateProvisioningState `json:"provisioningState,omitempty"` - // ProvisioningStateTransitionTime - READ-ONLY - ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` - // PreviousProvisioningState - READ-ONLY; The previous provisioned state of the resource. Possible values include: 'CertificateProvisioningStateSucceeded', 'CertificateProvisioningStateDeleting', 'CertificateProvisioningStateFailed' - PreviousProvisioningState CertificateProvisioningState `json:"previousProvisioningState,omitempty"` - // PreviousProvisioningStateTransitionTime - READ-ONLY - PreviousProvisioningStateTransitionTime *date.Time `json:"previousProvisioningStateTransitionTime,omitempty"` - // PublicData - READ-ONLY; The public key of the certificate. - PublicData *string `json:"publicData,omitempty"` - // DeleteCertificateError - READ-ONLY; This is only returned when the certificate provisioningState is 'Failed'. - DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` - // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. - ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` - // Thumbprint - This must match the thumbprint from the name. - Thumbprint *string `json:"thumbprint,omitempty"` - // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' - Format CertificateFormat `json:"format,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateProperties. -func (cp CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.ThumbprintAlgorithm != nil { - objectMap["thumbprintAlgorithm"] = cp.ThumbprintAlgorithm - } - if cp.Thumbprint != nil { - objectMap["thumbprint"] = cp.Thumbprint - } - if cp.Format != "" { - objectMap["format"] = cp.Format - } - return json.Marshal(objectMap) -} - -// CertificateReference ... -type CertificateReference struct { - ID *string `json:"id,omitempty"` - // StoreLocation - The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'CertificateStoreLocationCurrentUser', 'CertificateStoreLocationLocalMachine' - StoreLocation CertificateStoreLocation `json:"storeLocation,omitempty"` - // StoreName - This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. - StoreName *string `json:"storeName,omitempty"` - Visibility *[]CertificateVisibility `json:"visibility,omitempty"` -} - -// CheckNameAvailabilityParameters parameters for a check name availability request. -type CheckNameAvailabilityParameters struct { - // Name - The name to check for availability - Name *string `json:"name,omitempty"` - // Type - The resource type. - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResult the CheckNameAvailability operation response. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - READ-ONLY; Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'NameAvailabilityReasonInvalid', 'NameAvailabilityReasonAlreadyExists' - Reason NameAvailabilityReason `json:"reason,omitempty"` - // Message - READ-ONLY; Gets an error message explaining the Reason value in more detail. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. -func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CIFSMountConfiguration ... -type CIFSMountConfiguration struct { - Username *string `json:"username,omitempty"` - Source *string `json:"source,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. - MountOptions *string `json:"mountOptions,omitempty"` - Password *string `json:"password,omitempty"` -} - -// CloudError an error response from the Batch service. -type CloudError struct { - // Error - The body of the error response. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Batch service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// CloudServiceConfiguration ... -type CloudServiceConfiguration struct { - // OsFamily - Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). - OsFamily *string `json:"osFamily,omitempty"` - // OsVersion - The default value is * which specifies the latest operating system version for the specified OS family. - OsVersion *string `json:"osVersion,omitempty"` -} - -// ComputeNodeIdentityReference the reference to a user assigned identity associated with the Batch pool -// which a compute node will use. -type ComputeNodeIdentityReference struct { - // ResourceID - The ARM resource id of the user assigned identity. - ResourceID *string `json:"resourceId,omitempty"` -} - -// ContainerConfiguration ... -type ContainerConfiguration struct { - Type *string `json:"type,omitempty"` - // ContainerImageNames - This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. - ContainerImageNames *[]string `json:"containerImageNames,omitempty"` - // ContainerRegistries - If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. - ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` -} - -// ContainerRegistry ... -type ContainerRegistry struct { - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - // RegistryServer - If omitted, the default is "docker.io". - RegistryServer *string `json:"registryServer,omitempty"` - IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` -} - -// DataDisk settings which will be used by the data disks associated to Compute Nodes in the Pool. When -// using attached data disks, you need to mount and format the disks from within a VM to use them. -type DataDisk struct { - // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. - Lun *int32 `json:"lun,omitempty"` - // Caching - Values are: - // none - The caching mode for the disk is not enabled. - // readOnly - The caching mode for the disk is read only. - // readWrite - The caching mode for the disk is read and write. - // The default value for caching is none. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'CachingTypeNone', 'CachingTypeReadOnly', 'CachingTypeReadWrite' - Caching CachingType `json:"caching,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - // StorageAccountType - If omitted, the default is "Standard_LRS". Values are: - // Standard_LRS - The data disk should use standard locally redundant storage. - // Premium_LRS - The data disk should use premium locally redundant storage. Possible values include: 'StorageAccountTypeStandardLRS', 'StorageAccountTypePremiumLRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` -} - -// DeleteCertificateError an error response from the Batch service. -type DeleteCertificateError struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]DeleteCertificateError `json:"details,omitempty"` -} - -// DeploymentConfiguration ... -type DeploymentConfiguration struct { - // CloudServiceConfiguration - This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. - CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` - // VirtualMachineConfiguration - This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. - VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` -} - -// DetectorListResult values returned by the List operation. -type DetectorListResult struct { - autorest.Response `json:"-"` - // Value - The collection of Batch account detectors returned by the listing operation. - Value *[]DetectorResponse `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DetectorListResultIterator provides access to a complete listing of DetectorResponse values. -type DetectorListResultIterator struct { - i int - page DetectorListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DetectorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DetectorListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DetectorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DetectorListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DetectorListResultIterator) Response() DetectorListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DetectorListResultIterator) Value() DetectorResponse { - if !iter.page.NotDone() { - return DetectorResponse{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DetectorListResultIterator type. -func NewDetectorListResultIterator(page DetectorListResultPage) DetectorListResultIterator { - return DetectorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DetectorListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DetectorListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// detectorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DetectorListResult) detectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dlr.NextLink))) -} - -// DetectorListResultPage contains a page of DetectorResponse values. -type DetectorListResultPage struct { - fn func(context.Context, DetectorListResult) (DetectorListResult, error) - dlr DetectorListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DetectorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DetectorListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dlr) - if err != nil { - return err - } - page.dlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DetectorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DetectorListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DetectorListResultPage) Response() DetectorListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DetectorListResultPage) Values() []DetectorResponse { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DetectorListResultPage type. -func NewDetectorListResultPage(cur DetectorListResult, getNextPage func(context.Context, DetectorListResult) (DetectorListResult, error)) DetectorListResultPage { - return DetectorListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DetectorResponse contains the information for a detector. -type DetectorResponse struct { - autorest.Response `json:"-"` - // DetectorResponseProperties - The properties associated with the detector. - *DetectorResponseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for DetectorResponse. -func (dr DetectorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dr.DetectorResponseProperties != nil { - objectMap["properties"] = dr.DetectorResponseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DetectorResponse struct. -func (dr *DetectorResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var detectorResponseProperties DetectorResponseProperties - err = json.Unmarshal(*v, &detectorResponseProperties) - if err != nil { - return err - } - dr.DetectorResponseProperties = &detectorResponseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dr.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dr.Etag = &etag - } - } - } - - return nil -} - -// DetectorResponseProperties detector response properties. -type DetectorResponseProperties struct { - // Value - A base64 encoded string that represents the content of a detector. - Value *string `json:"value,omitempty"` -} - -// DiffDiskSettings ... -type DiffDiskSettings struct { - // Placement - This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Possible values include: 'DiffDiskPlacementCacheDisk' - Placement DiffDiskPlacement `json:"placement,omitempty"` -} - -// DiskEncryptionConfiguration the disk encryption configuration applied on compute nodes in the pool. Disk -// encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared -// Image Gallery Image. -type DiskEncryptionConfiguration struct { - // Targets - On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. - Targets *[]DiskEncryptionTarget `json:"targets,omitempty"` -} - -// EncryptionProperties configures how customer data is encrypted inside the Batch account. By default, -// accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can -// be used instead. -type EncryptionProperties struct { - // KeySource - Type of the key source. Possible values include: 'KeySourceMicrosoftBatch', 'KeySourceMicrosoftKeyVault' - KeySource KeySource `json:"keySource,omitempty"` - // KeyVaultProperties - Additional details when using Microsoft.KeyVault - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} - -// EndpointDependency a domain name and connection details used to access a dependency. -type EndpointDependency struct { - // DomainName - READ-ONLY; The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. - DomainName *string `json:"domainName,omitempty"` - // Description - READ-ONLY; Human-readable supplemental information about the dependency and when it is applicable. - Description *string `json:"description,omitempty"` - // EndpointDetails - READ-ONLY; The list of connection details for this endpoint. - EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` -} - -// MarshalJSON is the custom marshaler for EndpointDependency. -func (ed EndpointDependency) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EndpointDetail details about the connection between the Batch service and the endpoint. -type EndpointDetail struct { - // Port - READ-ONLY; The port an endpoint is connected to. - Port *int32 `json:"port,omitempty"` -} - -// MarshalJSON is the custom marshaler for EndpointDetail. -func (ed EndpointDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EnvironmentSetting ... -type EnvironmentSetting struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// FixedScaleSettings ... -type FixedScaleSettings struct { - // ResizeTimeout - The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - ResizeTimeout *string `json:"resizeTimeout,omitempty"` - // TargetDedicatedNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. - TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` - // TargetLowPriorityNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. - TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` - // NodeDeallocationOption - If omitted, the default value is Requeue. Possible values include: 'ComputeNodeDeallocationOptionRequeue', 'ComputeNodeDeallocationOptionTerminate', 'ComputeNodeDeallocationOptionTaskCompletion', 'ComputeNodeDeallocationOptionRetainedData' - NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` -} - -// ImageReference ... -type ImageReference struct { - // Publisher - For example, Canonical or MicrosoftWindowsServer. - Publisher *string `json:"publisher,omitempty"` - // Offer - For example, UbuntuServer or WindowsServer. - Offer *string `json:"offer,omitempty"` - // Sku - For example, 18.04-LTS or 2022-datacenter. - Sku *string `json:"sku,omitempty"` - // Version - A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. - Version *string `json:"version,omitempty"` - // ID - This property is mutually exclusive with other properties. The Shared Image Gallery image must have replicas in the same region as the Azure Batch account. For information about the firewall settings for the Batch node agent to communicate with the Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. - ID *string `json:"id,omitempty"` -} - -// InboundNatPool ... -type InboundNatPool struct { - // Name - The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. - Name *string `json:"name,omitempty"` - // Protocol - Possible values include: 'InboundEndpointProtocolTCP', 'InboundEndpointProtocolUDP' - Protocol InboundEndpointProtocol `json:"protocol,omitempty"` - // BackendPort - This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. - BackendPort *int32 `json:"backendPort,omitempty"` - // FrontendPortRangeStart - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. - FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` - // FrontendPortRangeEnd - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. - FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` - // NetworkSecurityGroupRules - The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. - NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` -} - -// KeyVaultProperties keyVault configuration when using an encryption KeySource of Microsoft.KeyVault. -type KeyVaultProperties struct { - // KeyIdentifier - Full path to the versioned secret. Example https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following prerequisites must be met: - // The Batch Account has a System Assigned identity - // The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions - // The KeyVault has soft-delete and purge protection enabled - KeyIdentifier *string `json:"keyIdentifier,omitempty"` -} - -// KeyVaultReference identifies the Azure key vault associated with a Batch account. -type KeyVaultReference struct { - // ID - The resource ID of the Azure key vault associated with the Batch account. - ID *string `json:"id,omitempty"` - // URL - The URL of the Azure key vault associated with the Batch account. - URL *string `json:"url,omitempty"` -} - -// LinuxUserConfiguration ... -type LinuxUserConfiguration struct { - // UID - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. - UID *int32 `json:"uid,omitempty"` - // Gid - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. - Gid *int32 `json:"gid,omitempty"` - // SSHPrivateKey - The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). - SSHPrivateKey *string `json:"sshPrivateKey,omitempty"` -} - -// ListApplicationPackagesResult the result of performing list application packages. -type ListApplicationPackagesResult struct { - autorest.Response `json:"-"` - // Value - The list of application packages. - Value *[]ApplicationPackage `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListApplicationPackagesResultIterator provides access to a complete listing of ApplicationPackage -// values. -type ListApplicationPackagesResultIterator struct { - i int - page ListApplicationPackagesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListApplicationPackagesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListApplicationPackagesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListApplicationPackagesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListApplicationPackagesResultIterator) Response() ListApplicationPackagesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListApplicationPackagesResultIterator) Value() ApplicationPackage { - if !iter.page.NotDone() { - return ApplicationPackage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListApplicationPackagesResultIterator type. -func NewListApplicationPackagesResultIterator(page ListApplicationPackagesResultPage) ListApplicationPackagesResultIterator { - return ListApplicationPackagesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lapr ListApplicationPackagesResult) IsEmpty() bool { - return lapr.Value == nil || len(*lapr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lapr ListApplicationPackagesResult) hasNextLink() bool { - return lapr.NextLink != nil && len(*lapr.NextLink) != 0 -} - -// listApplicationPackagesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lapr ListApplicationPackagesResult) listApplicationPackagesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lapr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lapr.NextLink))) -} - -// ListApplicationPackagesResultPage contains a page of ApplicationPackage values. -type ListApplicationPackagesResultPage struct { - fn func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error) - lapr ListApplicationPackagesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListApplicationPackagesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lapr) - if err != nil { - return err - } - page.lapr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListApplicationPackagesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListApplicationPackagesResultPage) NotDone() bool { - return !page.lapr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListApplicationPackagesResultPage) Response() ListApplicationPackagesResult { - return page.lapr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListApplicationPackagesResultPage) Values() []ApplicationPackage { - if page.lapr.IsEmpty() { - return nil - } - return *page.lapr.Value -} - -// Creates a new instance of the ListApplicationPackagesResultPage type. -func NewListApplicationPackagesResultPage(cur ListApplicationPackagesResult, getNextPage func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error)) ListApplicationPackagesResultPage { - return ListApplicationPackagesResultPage{ - fn: getNextPage, - lapr: cur, - } -} - -// ListApplicationsResult the result of performing list applications. -type ListApplicationsResult struct { - autorest.Response `json:"-"` - // Value - The list of applications. - Value *[]Application `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListApplicationsResultIterator provides access to a complete listing of Application values. -type ListApplicationsResultIterator struct { - i int - page ListApplicationsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListApplicationsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListApplicationsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListApplicationsResultIterator) Response() ListApplicationsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListApplicationsResultIterator) Value() Application { - if !iter.page.NotDone() { - return Application{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListApplicationsResultIterator type. -func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator { - return ListApplicationsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lar ListApplicationsResult) IsEmpty() bool { - return lar.Value == nil || len(*lar.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lar ListApplicationsResult) hasNextLink() bool { - return lar.NextLink != nil && len(*lar.NextLink) != 0 -} - -// listApplicationsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lar.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lar.NextLink))) -} - -// ListApplicationsResultPage contains a page of Application values. -type ListApplicationsResultPage struct { - fn func(context.Context, ListApplicationsResult) (ListApplicationsResult, error) - lar ListApplicationsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lar) - if err != nil { - return err - } - page.lar = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListApplicationsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListApplicationsResultPage) NotDone() bool { - return !page.lar.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListApplicationsResultPage) Response() ListApplicationsResult { - return page.lar -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListApplicationsResultPage) Values() []Application { - if page.lar.IsEmpty() { - return nil - } - return *page.lar.Value -} - -// Creates a new instance of the ListApplicationsResultPage type. -func NewListApplicationsResultPage(cur ListApplicationsResult, getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage { - return ListApplicationsResultPage{ - fn: getNextPage, - lar: cur, - } -} - -// ListCertificatesResult values returned by the List operation. -type ListCertificatesResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned certificates. - Value *[]Certificate `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListCertificatesResultIterator provides access to a complete listing of Certificate values. -type ListCertificatesResultIterator struct { - i int - page ListCertificatesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListCertificatesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListCertificatesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListCertificatesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListCertificatesResultIterator) Response() ListCertificatesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListCertificatesResultIterator) Value() Certificate { - if !iter.page.NotDone() { - return Certificate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListCertificatesResultIterator type. -func NewListCertificatesResultIterator(page ListCertificatesResultPage) ListCertificatesResultIterator { - return ListCertificatesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lcr ListCertificatesResult) IsEmpty() bool { - return lcr.Value == nil || len(*lcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lcr ListCertificatesResult) hasNextLink() bool { - return lcr.NextLink != nil && len(*lcr.NextLink) != 0 -} - -// listCertificatesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lcr ListCertificatesResult) listCertificatesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lcr.NextLink))) -} - -// ListCertificatesResultPage contains a page of Certificate values. -type ListCertificatesResultPage struct { - fn func(context.Context, ListCertificatesResult) (ListCertificatesResult, error) - lcr ListCertificatesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListCertificatesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lcr) - if err != nil { - return err - } - page.lcr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListCertificatesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListCertificatesResultPage) NotDone() bool { - return !page.lcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListCertificatesResultPage) Response() ListCertificatesResult { - return page.lcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListCertificatesResultPage) Values() []Certificate { - if page.lcr.IsEmpty() { - return nil - } - return *page.lcr.Value -} - -// Creates a new instance of the ListCertificatesResultPage type. -func NewListCertificatesResultPage(cur ListCertificatesResult, getNextPage func(context.Context, ListCertificatesResult) (ListCertificatesResult, error)) ListCertificatesResultPage { - return ListCertificatesResultPage{ - fn: getNextPage, - lcr: cur, - } -} - -// ListPoolsResult values returned by the List operation. -type ListPoolsResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned pools. - Value *[]Pool `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListPoolsResultIterator provides access to a complete listing of Pool values. -type ListPoolsResultIterator struct { - i int - page ListPoolsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListPoolsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListPoolsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListPoolsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListPoolsResultIterator) Response() ListPoolsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListPoolsResultIterator) Value() Pool { - if !iter.page.NotDone() { - return Pool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListPoolsResultIterator type. -func NewListPoolsResultIterator(page ListPoolsResultPage) ListPoolsResultIterator { - return ListPoolsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lpr ListPoolsResult) IsEmpty() bool { - return lpr.Value == nil || len(*lpr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lpr ListPoolsResult) hasNextLink() bool { - return lpr.NextLink != nil && len(*lpr.NextLink) != 0 -} - -// listPoolsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lpr ListPoolsResult) listPoolsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lpr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lpr.NextLink))) -} - -// ListPoolsResultPage contains a page of Pool values. -type ListPoolsResultPage struct { - fn func(context.Context, ListPoolsResult) (ListPoolsResult, error) - lpr ListPoolsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListPoolsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lpr) - if err != nil { - return err - } - page.lpr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListPoolsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListPoolsResultPage) NotDone() bool { - return !page.lpr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListPoolsResultPage) Response() ListPoolsResult { - return page.lpr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListPoolsResultPage) Values() []Pool { - if page.lpr.IsEmpty() { - return nil - } - return *page.lpr.Value -} - -// Creates a new instance of the ListPoolsResultPage type. -func NewListPoolsResultPage(cur ListPoolsResult, getNextPage func(context.Context, ListPoolsResult) (ListPoolsResult, error)) ListPoolsResultPage { - return ListPoolsResultPage{ - fn: getNextPage, - lpr: cur, - } -} - -// ListPrivateEndpointConnectionsResult values returned by the List operation. -type ListPrivateEndpointConnectionsResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned private endpoint connection. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListPrivateEndpointConnectionsResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type ListPrivateEndpointConnectionsResultIterator struct { - i int - page ListPrivateEndpointConnectionsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListPrivateEndpointConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListPrivateEndpointConnectionsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListPrivateEndpointConnectionsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListPrivateEndpointConnectionsResultIterator) Response() ListPrivateEndpointConnectionsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListPrivateEndpointConnectionsResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListPrivateEndpointConnectionsResultIterator type. -func NewListPrivateEndpointConnectionsResultIterator(page ListPrivateEndpointConnectionsResultPage) ListPrivateEndpointConnectionsResultIterator { - return ListPrivateEndpointConnectionsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lpecr ListPrivateEndpointConnectionsResult) IsEmpty() bool { - return lpecr.Value == nil || len(*lpecr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lpecr ListPrivateEndpointConnectionsResult) hasNextLink() bool { - return lpecr.NextLink != nil && len(*lpecr.NextLink) != 0 -} - -// listPrivateEndpointConnectionsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lpecr ListPrivateEndpointConnectionsResult) listPrivateEndpointConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lpecr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lpecr.NextLink))) -} - -// ListPrivateEndpointConnectionsResultPage contains a page of PrivateEndpointConnection values. -type ListPrivateEndpointConnectionsResultPage struct { - fn func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error) - lpecr ListPrivateEndpointConnectionsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListPrivateEndpointConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lpecr) - if err != nil { - return err - } - page.lpecr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListPrivateEndpointConnectionsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListPrivateEndpointConnectionsResultPage) NotDone() bool { - return !page.lpecr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListPrivateEndpointConnectionsResultPage) Response() ListPrivateEndpointConnectionsResult { - return page.lpecr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListPrivateEndpointConnectionsResultPage) Values() []PrivateEndpointConnection { - if page.lpecr.IsEmpty() { - return nil - } - return *page.lpecr.Value -} - -// Creates a new instance of the ListPrivateEndpointConnectionsResultPage type. -func NewListPrivateEndpointConnectionsResultPage(cur ListPrivateEndpointConnectionsResult, getNextPage func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error)) ListPrivateEndpointConnectionsResultPage { - return ListPrivateEndpointConnectionsResultPage{ - fn: getNextPage, - lpecr: cur, - } -} - -// ListPrivateLinkResourcesResult values returned by the List operation. -type ListPrivateLinkResourcesResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned private link resources. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListPrivateLinkResourcesResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type ListPrivateLinkResourcesResultIterator struct { - i int - page ListPrivateLinkResourcesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListPrivateLinkResourcesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListPrivateLinkResourcesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListPrivateLinkResourcesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListPrivateLinkResourcesResultIterator) Response() ListPrivateLinkResourcesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListPrivateLinkResourcesResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListPrivateLinkResourcesResultIterator type. -func NewListPrivateLinkResourcesResultIterator(page ListPrivateLinkResourcesResultPage) ListPrivateLinkResourcesResultIterator { - return ListPrivateLinkResourcesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lplrr ListPrivateLinkResourcesResult) IsEmpty() bool { - return lplrr.Value == nil || len(*lplrr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lplrr ListPrivateLinkResourcesResult) hasNextLink() bool { - return lplrr.NextLink != nil && len(*lplrr.NextLink) != 0 -} - -// listPrivateLinkResourcesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lplrr ListPrivateLinkResourcesResult) listPrivateLinkResourcesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lplrr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lplrr.NextLink))) -} - -// ListPrivateLinkResourcesResultPage contains a page of PrivateLinkResource values. -type ListPrivateLinkResourcesResultPage struct { - fn func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error) - lplrr ListPrivateLinkResourcesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListPrivateLinkResourcesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lplrr) - if err != nil { - return err - } - page.lplrr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListPrivateLinkResourcesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListPrivateLinkResourcesResultPage) NotDone() bool { - return !page.lplrr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListPrivateLinkResourcesResultPage) Response() ListPrivateLinkResourcesResult { - return page.lplrr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListPrivateLinkResourcesResultPage) Values() []PrivateLinkResource { - if page.lplrr.IsEmpty() { - return nil - } - return *page.lplrr.Value -} - -// Creates a new instance of the ListPrivateLinkResourcesResultPage type. -func NewListPrivateLinkResourcesResultPage(cur ListPrivateLinkResourcesResult, getNextPage func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error)) ListPrivateLinkResourcesResultPage { - return ListPrivateLinkResourcesResultPage{ - fn: getNextPage, - lplrr: cur, - } -} - -// LocationQuota quotas associated with a Batch region for a particular subscription. -type LocationQuota struct { - autorest.Response `json:"-"` - // AccountQuota - READ-ONLY; The number of Batch accounts that may be created under the subscription in the specified region. - AccountQuota *int32 `json:"accountQuota,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationQuota. -func (lq LocationQuota) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetadataItem the Batch service does not assign any meaning to this metadata; it is solely for the use of -// user code. -type MetadataItem struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// MountConfiguration ... -type MountConfiguration struct { - // AzureBlobFileSystemConfiguration - This property is mutually exclusive with all other properties. - AzureBlobFileSystemConfiguration *AzureBlobFileSystemConfiguration `json:"azureBlobFileSystemConfiguration,omitempty"` - // NfsMountConfiguration - This property is mutually exclusive with all other properties. - NfsMountConfiguration *NFSMountConfiguration `json:"nfsMountConfiguration,omitempty"` - // CifsMountConfiguration - This property is mutually exclusive with all other properties. - CifsMountConfiguration *CIFSMountConfiguration `json:"cifsMountConfiguration,omitempty"` - // AzureFileShareConfiguration - This property is mutually exclusive with all other properties. - AzureFileShareConfiguration *AzureFileShareConfiguration `json:"azureFileShareConfiguration,omitempty"` -} - -// NetworkConfiguration the network configuration for a pool. -type NetworkConfiguration struct { - // SubnetID - The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration - SubnetID *string `json:"subnetId,omitempty"` - // DynamicVNetAssignmentScope - Possible values include: 'DynamicVNetAssignmentScopeNone', 'DynamicVNetAssignmentScopeJob' - DynamicVNetAssignmentScope DynamicVNetAssignmentScope `json:"dynamicVNetAssignmentScope,omitempty"` - // EndpointConfiguration - Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. - EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` - // PublicIPAddressConfiguration - This property is only supported on Pools with the virtualMachineConfiguration property. - PublicIPAddressConfiguration *PublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` -} - -// NetworkSecurityGroupRule ... -type NetworkSecurityGroupRule struct { - // Priority - Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. - Priority *int32 `json:"priority,omitempty"` - // Access - Possible values include: 'NetworkSecurityGroupRuleAccessAllow', 'NetworkSecurityGroupRuleAccessDeny' - Access NetworkSecurityGroupRuleAccess `json:"access,omitempty"` - // SourceAddressPrefix - Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - // SourcePortRanges - Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If any other values are provided the request fails with HTTP status code 400. Default value will be *. - SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` -} - -// NFSMountConfiguration ... -type NFSMountConfiguration struct { - Source *string `json:"source,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. - MountOptions *string `json:"mountOptions,omitempty"` -} - -// NodePlacementConfiguration allocation configuration used by Batch Service to provision the nodes. -type NodePlacementConfiguration struct { - // Policy - Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. Possible values include: 'NodePlacementPolicyTypeRegional', 'NodePlacementPolicyTypeZonal' - Policy NodePlacementPolicyType `json:"policy,omitempty"` -} - -// Operation ... -type Operation struct { - // Name - This is of the format {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` - Origin *string `json:"origin,omitempty"` - Properties interface{} `json:"properties,omitempty"` -} - -// OperationDisplay ... -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - // Operation - For example: read, write, delete, or listKeys/action - Operation *string `json:"operation,omitempty"` - Resource *string `json:"resource,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationListResult ... -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OSDisk ... -type OSDisk struct { - EphemeralOSDiskSettings *DiffDiskSettings `json:"ephemeralOSDiskSettings,omitempty"` -} - -// OutboundEnvironmentEndpoint a collection of related endpoints from the same service for which the Batch -// service requires outbound access. -type OutboundEnvironmentEndpoint struct { - // Category - READ-ONLY; The type of service that the Batch service connects to. - Category *string `json:"category,omitempty"` - // Endpoints - READ-ONLY; The endpoints for this service to which the Batch service makes outbound calls. - Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpoint. -func (oee OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OutboundEnvironmentEndpointCollection values returned by the List operation. -type OutboundEnvironmentEndpointCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The collection of outbound network dependency endpoints returned by the listing operation. - Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. -func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oeec.NextLink != nil { - objectMap["nextLink"] = oeec.NextLink - } - return json.Marshal(objectMap) -} - -// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of -// OutboundEnvironmentEndpoint values. -type OutboundEnvironmentEndpointCollectionIterator struct { - i int - page OutboundEnvironmentEndpointCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { - if !iter.page.NotDone() { - return OutboundEnvironmentEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. -func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { - return OutboundEnvironmentEndpointCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { - return oeec.Value == nil || len(*oeec.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { - return oeec.NextLink != nil && len(*oeec.NextLink) != 0 -} - -// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oeec.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oeec.NextLink))) -} - -// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. -type OutboundEnvironmentEndpointCollectionPage struct { - fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) - oeec OutboundEnvironmentEndpointCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oeec) - if err != nil { - return err - } - page.oeec = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { - return !page.oeec.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { - return page.oeec -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { - if page.oeec.IsEmpty() { - return nil - } - return *page.oeec.Value -} - -// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. -func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { - return OutboundEnvironmentEndpointCollectionPage{ - fn: getNextPage, - oeec: cur, - } -} - -// Pool contains information about a pool. -type Pool struct { - autorest.Response `json:"-"` - // PoolProperties - The properties associated with the pool. - *PoolProperties `json:"properties,omitempty"` - // Identity - The type of identity used for the Batch Pool. - Identity *PoolIdentity `json:"identity,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Pool. -func (p Pool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.PoolProperties != nil { - objectMap["properties"] = p.PoolProperties - } - if p.Identity != nil { - objectMap["identity"] = p.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Pool struct. -func (p *Pool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var poolProperties PoolProperties - err = json.Unmarshal(*v, &poolProperties) - if err != nil { - return err - } - p.PoolProperties = &poolProperties - } - case "identity": - if v != nil { - var identity PoolIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - p.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - p.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - p.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - p.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - p.Etag = &etag - } - } - } - - return nil -} - -// PoolDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type PoolDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolDeleteFuture.Result. -func (future *PoolDeleteFuture) result(client PoolClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.PoolDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PoolEndpointConfiguration ... -type PoolEndpointConfiguration struct { - // InboundNatPools - The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. - InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` -} - -// PoolIdentity the identity of the Batch pool, if configured. If the pool identity is updated during -// update an existing pool, only the new vms which are created after the pool shrinks to 0 will have the -// updated identities -type PoolIdentity struct { - // Type - The type of identity used for the Batch Pool. Possible values include: 'PoolIdentityTypeUserAssigned', 'PoolIdentityTypeNone' - Type PoolIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the Batch pool. - UserAssignedIdentities map[string]*UserAssignedIdentities `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for PoolIdentity. -func (pi PoolIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pi.Type != "" { - objectMap["type"] = pi.Type - } - if pi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = pi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// PoolProperties pool properties. -type PoolProperties struct { - // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. - DisplayName *string `json:"displayName,omitempty"` - // LastModified - READ-ONLY; This is the last time at which the pool level data, such as the targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute node changing state. - LastModified *date.Time `json:"lastModified,omitempty"` - // CreationTime - READ-ONLY - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - READ-ONLY; Possible values include: 'PoolProvisioningStateSucceeded', 'PoolProvisioningStateDeleting' - ProvisioningState PoolProvisioningState `json:"provisioningState,omitempty"` - // ProvisioningStateTransitionTime - READ-ONLY - ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` - // AllocationState - READ-ONLY; Possible values include: 'AllocationStateSteady', 'AllocationStateResizing', 'AllocationStateStopping' - AllocationState AllocationState `json:"allocationState,omitempty"` - // AllocationStateTransitionTime - READ-ONLY - AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` - // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). - VMSize *string `json:"vmSize,omitempty"` - // DeploymentConfiguration - Using CloudServiceConfiguration specifies that the nodes should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). - DeploymentConfiguration *DeploymentConfiguration `json:"deploymentConfiguration,omitempty"` - // CurrentDedicatedNodes - READ-ONLY - CurrentDedicatedNodes *int32 `json:"currentDedicatedNodes,omitempty"` - // CurrentLowPriorityNodes - READ-ONLY - CurrentLowPriorityNodes *int32 `json:"currentLowPriorityNodes,omitempty"` - ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` - // AutoScaleRun - READ-ONLY; This property is set only if the pool automatically scales, i.e. autoScaleSettings are used. - AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` - // InterNodeCommunication - This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values include: 'InterNodeCommunicationStateEnabled', 'InterNodeCommunicationStateDisabled' - InterNodeCommunication InterNodeCommunicationState `json:"interNodeCommunication,omitempty"` - NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` - // TaskSlotsPerNode - The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. - TaskSlotsPerNode *int32 `json:"taskSlotsPerNode,omitempty"` - // TaskSchedulingPolicy - If not specified, the default is spread. - TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` - UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` - // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. - Metadata *[]MetadataItem `json:"metadata,omitempty"` - // StartTask - In an PATCH (update) operation, this property can be set to an empty object to remove the start task from the pool. - StartTask *StartTask `json:"startTask,omitempty"` - // Certificates - For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. - Certificates *[]CertificateReference `json:"certificates,omitempty"` - // ApplicationPackages - Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. There is a maximum of 10 application package references on any given pool. - ApplicationPackages *[]ApplicationPackageReference `json:"applicationPackages,omitempty"` - // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. - ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` - // ResizeOperationStatus - READ-ONLY - ResizeOperationStatus *ResizeOperationStatus `json:"resizeOperationStatus,omitempty"` - // MountConfiguration - This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. - MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for PoolProperties. -func (pp PoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.DisplayName != nil { - objectMap["displayName"] = pp.DisplayName - } - if pp.VMSize != nil { - objectMap["vmSize"] = pp.VMSize - } - if pp.DeploymentConfiguration != nil { - objectMap["deploymentConfiguration"] = pp.DeploymentConfiguration - } - if pp.ScaleSettings != nil { - objectMap["scaleSettings"] = pp.ScaleSettings - } - if pp.InterNodeCommunication != "" { - objectMap["interNodeCommunication"] = pp.InterNodeCommunication - } - if pp.NetworkConfiguration != nil { - objectMap["networkConfiguration"] = pp.NetworkConfiguration - } - if pp.TaskSlotsPerNode != nil { - objectMap["taskSlotsPerNode"] = pp.TaskSlotsPerNode - } - if pp.TaskSchedulingPolicy != nil { - objectMap["taskSchedulingPolicy"] = pp.TaskSchedulingPolicy - } - if pp.UserAccounts != nil { - objectMap["userAccounts"] = pp.UserAccounts - } - if pp.Metadata != nil { - objectMap["metadata"] = pp.Metadata - } - if pp.StartTask != nil { - objectMap["startTask"] = pp.StartTask - } - if pp.Certificates != nil { - objectMap["certificates"] = pp.Certificates - } - if pp.ApplicationPackages != nil { - objectMap["applicationPackages"] = pp.ApplicationPackages - } - if pp.ApplicationLicenses != nil { - objectMap["applicationLicenses"] = pp.ApplicationLicenses - } - if pp.MountConfiguration != nil { - objectMap["mountConfiguration"] = pp.MountConfiguration - } - return json.Marshal(objectMap) -} - -// PrivateEndpoint the private endpoint of the private endpoint connection. -type PrivateEndpoint struct { - // ID - READ-ONLY - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection contains information about a private link resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - The properties associated with the private endpoint connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pec.Etag = &etag - } - } - } - - return nil -} - -// PrivateEndpointConnectionProperties private endpoint connection properties. -type PrivateEndpointConnectionProperties struct { - // ProvisioningState - READ-ONLY; Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateUpdating', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionUpdateFuture.Result. -func (future *PrivateEndpointConnectionUpdateFuture) result(client PrivateEndpointConnectionClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.PrivateEndpointConnectionUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.UpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkResource contains information about a private link resource. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - The properties associated with the private link resource. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - plr.Etag = &etag - } - } - } - - return nil -} - -// PrivateLinkResourceProperties private link resource properties. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The group id is used to establish the private link connection. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState the private link service connection state of the private endpoint -// connection -type PrivateLinkServiceConnectionState struct { - // Status - Possible values include: 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' - Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` - Description *string `json:"description,omitempty"` - // ActionRequired - READ-ONLY - ActionRequired *string `json:"actionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. -func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscs.Status != "" { - objectMap["status"] = plscs.Status - } - if plscs.Description != nil { - objectMap["description"] = plscs.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource a definition of an Azure resource. -type ProxyResource struct { - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PublicIPAddressConfiguration the public IP Address configuration of the networking configuration of a -// Pool. -type PublicIPAddressConfiguration struct { - // Provision - The default value is BatchManaged. Possible values include: 'IPAddressProvisioningTypeBatchManaged', 'IPAddressProvisioningTypeUserManaged', 'IPAddressProvisioningTypeNoPublicIPAddresses' - Provision IPAddressProvisioningType `json:"provision,omitempty"` - // IPAddressIds - The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. - IPAddressIds *[]string `json:"ipAddressIds,omitempty"` -} - -// ResizeError ... -type ResizeError struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - Details *[]ResizeError `json:"details,omitempty"` -} - -// ResizeOperationStatus describes either the current operation (if the pool AllocationState is Resizing) -// or the previously completed operation (if the AllocationState is Steady). -type ResizeOperationStatus struct { - TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` - TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` - // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - ResizeTimeout *string `json:"resizeTimeout,omitempty"` - // NodeDeallocationOption - The default value is requeue. Possible values include: 'ComputeNodeDeallocationOptionRequeue', 'ComputeNodeDeallocationOptionTerminate', 'ComputeNodeDeallocationOptionTaskCompletion', 'ComputeNodeDeallocationOptionRetainedData' - NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - // Errors - This property is set only if an error occurred during the last pool resize, and only when the pool allocationState is Steady. - Errors *[]ResizeError `json:"errors,omitempty"` -} - -// Resource a definition of an Azure resource. -type Resource struct { - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - READ-ONLY; The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceFile ... -type ResourceFile struct { - // AutoStorageContainerName - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. - AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` - // StorageContainerURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable from compute nodes. There are three ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access. - StorageContainerURL *string `json:"storageContainerUrl,omitempty"` - // HTTPURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable from compute nodes. There are three ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access. - HTTPURL *string `json:"httpUrl,omitempty"` - // BlobPrefix - The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. - BlobPrefix *string `json:"blobPrefix,omitempty"` - // FilePath - If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). - FilePath *string `json:"filePath,omitempty"` - // FileMode - This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. - FileMode *string `json:"fileMode,omitempty"` - IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` -} - -// ScaleSettings defines the desired size of the pool. This can either be 'fixedScale' where the requested -// targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically -// reevaluated. If this property is not specified, the pool will have a fixed scale with 0 -// targetDedicatedNodes. -type ScaleSettings struct { - // FixedScale - This property and autoScale are mutually exclusive and one of the properties must be specified. - FixedScale *FixedScaleSettings `json:"fixedScale,omitempty"` - // AutoScale - This property and fixedScale are mutually exclusive and one of the properties must be specified. - AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` -} - -// SkuCapability a SKU capability, such as the number of cores. -type SkuCapability struct { - // Name - READ-ONLY; The name of the feature. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; The value of the feature. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuCapability. -func (sc SkuCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StartTask in some cases the start task may be re-run even though the node was not rebooted. Due to this, -// start tasks should be idempotent and exit gracefully if the setup they're performing has already been -// done. Special care should be taken to avoid start tasks which create breakaway process or install/launch -// services from the start task working directory, as this will block Batch from being able to re-run the -// start task. -type StartTask struct { - // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. - CommandLine *string `json:"commandLine,omitempty"` - ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` - EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` - // UserIdentity - If omitted, the task runs as a non-administrative user unique to the task. - UserIdentity *UserIdentity `json:"userIdentity,omitempty"` - // MaxTaskRetryCount - The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit, however this is not recommended for a start task or any task. The default value is 0 (no retries). - MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` - // WaitForSuccess - If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true. - WaitForSuccess *bool `json:"waitForSuccess,omitempty"` - // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. - ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` -} - -// SupportedSku describes a Batch supported SKU. -type SupportedSku struct { - // Name - READ-ONLY; The name of the SKU. - Name *string `json:"name,omitempty"` - // FamilyName - READ-ONLY; The family name of the SKU. - FamilyName *string `json:"familyName,omitempty"` - // Capabilities - READ-ONLY; A collection of capabilities which this SKU supports. - Capabilities *[]SkuCapability `json:"capabilities,omitempty"` -} - -// MarshalJSON is the custom marshaler for SupportedSku. -func (ss SupportedSku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SupportedSkusResult the Batch List supported SKUs operation response. -type SupportedSkusResult struct { - autorest.Response `json:"-"` - // Value - The list of SKUs available for the Batch service in the location. - Value *[]SupportedSku `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SupportedSkusResult. -func (ssr SupportedSkusResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssr.Value != nil { - objectMap["value"] = ssr.Value - } - return json.Marshal(objectMap) -} - -// SupportedSkusResultIterator provides access to a complete listing of SupportedSku values. -type SupportedSkusResultIterator struct { - i int - page SupportedSkusResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SupportedSkusResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SupportedSkusResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SupportedSkusResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SupportedSkusResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SupportedSkusResultIterator) Response() SupportedSkusResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SupportedSkusResultIterator) Value() SupportedSku { - if !iter.page.NotDone() { - return SupportedSku{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SupportedSkusResultIterator type. -func NewSupportedSkusResultIterator(page SupportedSkusResultPage) SupportedSkusResultIterator { - return SupportedSkusResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssr SupportedSkusResult) IsEmpty() bool { - return ssr.Value == nil || len(*ssr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssr SupportedSkusResult) hasNextLink() bool { - return ssr.NextLink != nil && len(*ssr.NextLink) != 0 -} - -// supportedSkusResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssr SupportedSkusResult) supportedSkusResultPreparer(ctx context.Context) (*http.Request, error) { - if !ssr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssr.NextLink))) -} - -// SupportedSkusResultPage contains a page of SupportedSku values. -type SupportedSkusResultPage struct { - fn func(context.Context, SupportedSkusResult) (SupportedSkusResult, error) - ssr SupportedSkusResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SupportedSkusResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SupportedSkusResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssr) - if err != nil { - return err - } - page.ssr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SupportedSkusResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SupportedSkusResultPage) NotDone() bool { - return !page.ssr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SupportedSkusResultPage) Response() SupportedSkusResult { - return page.ssr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SupportedSkusResultPage) Values() []SupportedSku { - if page.ssr.IsEmpty() { - return nil - } - return *page.ssr.Value -} - -// Creates a new instance of the SupportedSkusResultPage type. -func NewSupportedSkusResultPage(cur SupportedSkusResult, getNextPage func(context.Context, SupportedSkusResult) (SupportedSkusResult, error)) SupportedSkusResultPage { - return SupportedSkusResultPage{ - fn: getNextPage, - ssr: cur, - } -} - -// TaskContainerSettings ... -type TaskContainerSettings struct { - // ContainerRunOptions - These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. - ContainerRunOptions *string `json:"containerRunOptions,omitempty"` - // ImageName - This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. - ImageName *string `json:"imageName,omitempty"` - // Registry - This setting can be omitted if was already provided at pool creation. - Registry *ContainerRegistry `json:"registry,omitempty"` - // WorkingDirectory - Possible values include: 'ContainerWorkingDirectoryTaskWorkingDirectory', 'ContainerWorkingDirectoryContainerImageDefault' - WorkingDirectory ContainerWorkingDirectory `json:"workingDirectory,omitempty"` -} - -// TaskSchedulingPolicy ... -type TaskSchedulingPolicy struct { - // NodeFillType - Possible values include: 'ComputeNodeFillTypeSpread', 'ComputeNodeFillTypePack' - NodeFillType ComputeNodeFillType `json:"nodeFillType,omitempty"` -} - -// UserAccount ... -type UserAccount struct { - Name *string `json:"name,omitempty"` - Password *string `json:"password,omitempty"` - // ElevationLevel - nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: 'ElevationLevelNonAdmin', 'ElevationLevelAdmin' - ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` - // LinuxUserConfiguration - This property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. - LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` - // WindowsUserConfiguration - This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. - WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` -} - -// UserAssignedIdentities the list of associated user identities. -type UserAssignedIdentities struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentities. -func (uai UserAssignedIdentities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UserIdentity specify either the userName or autoUser property, but not both. -type UserIdentity struct { - // UserName - The userName and autoUser properties are mutually exclusive; you must specify one but not both. - UserName *string `json:"userName,omitempty"` - // AutoUser - The userName and autoUser properties are mutually exclusive; you must specify one but not both. - AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` -} - -// VirtualMachineConfiguration ... -type VirtualMachineConfiguration struct { - ImageReference *ImageReference `json:"imageReference,omitempty"` - // NodeAgentSkuID - The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. - NodeAgentSkuID *string `json:"nodeAgentSkuId,omitempty"` - // WindowsConfiguration - This property must not be specified if the imageReference specifies a Linux OS image. - WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` - // DataDisks - This property must be specified if the compute nodes in the pool need to have empty data disks attached to them. - DataDisks *[]DataDisk `json:"dataDisks,omitempty"` - // LicenseType - This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: - // Windows_Server - The on-premises license is for Windows Server. - // Windows_Client - The on-premises license is for Windows Client. - LicenseType *string `json:"licenseType,omitempty"` - // ContainerConfiguration - If specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. - ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` - // DiskEncryptionConfiguration - If specified, encryption is performed on each node in the pool during node provisioning. - DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` - // NodePlacementConfiguration - This configuration will specify rules on how nodes in the pool will be physically allocated. - NodePlacementConfiguration *NodePlacementConfiguration `json:"nodePlacementConfiguration,omitempty"` - // Extensions - If specified, the extensions mentioned in this configuration will be installed on each node. - Extensions *[]VMExtension `json:"extensions,omitempty"` - // OsDisk - Contains configuration for ephemeral OSDisk settings. - OsDisk *OSDisk `json:"osDisk,omitempty"` -} - -// VirtualMachineFamilyCoreQuota a VM Family and its associated core quota for the Batch account. -type VirtualMachineFamilyCoreQuota struct { - // Name - READ-ONLY; The Virtual Machine family name. - Name *string `json:"name,omitempty"` - // CoreQuota - READ-ONLY; The core quota for the VM family for the Batch account. - CoreQuota *int32 `json:"coreQuota,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualMachineFamilyCoreQuota. -func (vmfcq VirtualMachineFamilyCoreQuota) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VMExtension ... -type VMExtension struct { - Name *string `json:"name,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Type *string `json:"type,omitempty"` - TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` - // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` - Settings interface{} `json:"settings,omitempty"` - // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings interface{} `json:"protectedSettings,omitempty"` - // ProvisionAfterExtensions - Collection of extension names after which this extension needs to be provisioned. - ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` -} - -// WindowsConfiguration ... -type WindowsConfiguration struct { - // EnableAutomaticUpdates - If omitted, the default value is true. - EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` -} - -// WindowsUserConfiguration ... -type WindowsUserConfiguration struct { - // LoginMode - Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. Possible values include: 'LoginModeBatch', 'LoginModeInteractive' - LoginMode LoginMode `json:"loginMode,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/operations.go deleted file mode 100644 index eb2366d7cadf..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the batch Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists available operations for the Microsoft.Batch provider -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Batch/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/pool.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/pool.go deleted file mode 100644 index 8b8c2f7c85bc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/pool.go +++ /dev/null @@ -1,786 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PoolClient is the batch Client -type PoolClient struct { - BaseClient -} - -// NewPoolClient creates an instance of the PoolClient client. -func NewPoolClient(subscriptionID string) PoolClient { - return NewPoolClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPoolClientWithBaseURI creates an instance of the PoolClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPoolClientWithBaseURI(baseURI string, subscriptionID string) PoolClient { - return PoolClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new pool inside the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -// parameters - additional parameters for pool creation. -// ifMatch - the entity state (ETag) version of the pool to update. A value of "*" can be used to apply the -// operation only if the pool already exists. If omitted, this operation will always be applied. -// ifNoneMatch - set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other -// values will be ignored. -func (client PoolClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PoolProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.NodeAgentSkuID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}, - {Target: "parameters.PoolProperties.ScaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale.Formula", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "parameters.PoolProperties.AutoScaleRun", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.EvaluationTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.AutoScaleRun.Error", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.Error.Code", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.AutoScaleRun.Error.Message", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.PoolProperties.NetworkConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration.InboundNatPools", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "parameters.PoolProperties.StartTask", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PoolClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client PoolClient) CreateResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PoolClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) DeleteSender(req *http.Request) (future PoolDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PoolClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DisableAutoScale disables automatic scaling for a pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) DisableAutoScale(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.DisableAutoScale") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "DisableAutoScale", err.Error()) - } - - req, err := client.DisableAutoScalePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", nil, "Failure preparing request") - return - } - - resp, err := client.DisableAutoScaleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure sending request") - return - } - - result, err = client.DisableAutoScaleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure responding to request") - return - } - - return -} - -// DisableAutoScalePreparer prepares the DisableAutoScale request. -func (client PoolClient) DisableAutoScalePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableAutoScaleSender sends the DisableAutoScale request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) DisableAutoScaleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisableAutoScaleResponder handles the response to the DisableAutoScale request. The method always -// closes the http.Response Body. -func (client PoolClient) DisableAutoScaleResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about the specified pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PoolClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PoolClient) GetResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the pools in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -// selectParameter - comma separated list of properties that should be returned. e.g. -// "properties/provisioningState". Only top level properties under properties/ are valid for selection. -// filter - oData filter expression. Valid properties for filtering are: -// -// name -// properties/allocationState -// properties/allocationStateTransitionTime -// properties/creationTime -// properties/provisioningState -// properties/provisioningStateTransitionTime -// properties/lastModified -// properties/vmSize -// properties/interNodeCommunication -// properties/scaleSettings/autoScale -// properties/scaleSettings/fixedScale -func (client PoolClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lpr.Response.Response != nil { - sc = result.lpr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lpr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lpr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lpr.hasNextLink() && result.lpr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client PoolClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client PoolClient) ListByBatchAccountResponder(resp *http.Response) (result ListPoolsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client PoolClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPoolsResult) (result ListPoolsResult, err error) { - req, err := lastResults.listPoolsResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PoolClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - return -} - -// StopResize this does not restore the pool to its previous state before the resize operation: it only stops any -// further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the -// number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state -// changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this -// API can also be used to halt the initial sizing of the pool when it is created. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) StopResize(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.StopResize") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "StopResize", err.Error()) - } - - req, err := client.StopResizePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", nil, "Failure preparing request") - return - } - - resp, err := client.StopResizeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure sending request") - return - } - - result, err = client.StopResizeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure responding to request") - return - } - - return -} - -// StopResizePreparer prepares the StopResize request. -func (client PoolClient) StopResizePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopResizeSender sends the StopResize request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) StopResizeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResizeResponder handles the response to the StopResize request. The method always -// closes the http.Response Body. -func (client PoolClient) StopResizeResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the properties of an existing pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -// parameters - pool properties that should be updated. Properties that are supplied will be updated, any -// property not supplied will be unchanged. -// ifMatch - the entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to -// apply the operation unconditionally. -func (client PoolClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PoolClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PoolClient) UpdateResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go deleted file mode 100644 index 61441bead880..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go +++ /dev/null @@ -1,358 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionClient is the batch Client -type PrivateEndpointConnectionClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionClient creates an instance of the PrivateEndpointConnectionClient client. -func NewPrivateEndpointConnectionClient(subscriptionID string) PrivateEndpointConnectionClient { - return NewPrivateEndpointConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionClientWithBaseURI creates an instance of the PrivateEndpointConnectionClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionClient { - return PrivateEndpointConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets information about the specified private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the -// account. -func (client PrivateEndpointConnectionClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: privateEndpointConnectionName, - Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the private endpoint connections in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -func (client PrivateEndpointConnectionClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lpecr.Response.Response != nil { - sc = result.lpecr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateEndpointConnectionClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lpecr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lpecr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lpecr.hasNextLink() && result.lpecr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client PrivateEndpointConnectionClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateEndpointConnectionsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateEndpointConnectionsResult) (result ListPrivateEndpointConnectionsResult, err error) { - req, err := lastResults.listPrivateEndpointConnectionsResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) - return -} - -// Update updates the properties of an existing private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the -// account. -// parameters - privateEndpointConnection properties that should be updated. Properties that are supplied will -// be updated, any property not supplied will be unchanged. -// ifMatch - the state (ETag) version of the private endpoint connection to update. This value can be omitted -// or set to "*" to apply the operation unconditionally. -func (client PrivateEndpointConnectionClient) Update(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (result PrivateEndpointConnectionUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: privateEndpointConnectionName, - Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PrivateEndpointConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go deleted file mode 100644 index 74d5e5c5a284..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go +++ /dev/null @@ -1,253 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourceClient is the batch Client -type PrivateLinkResourceClient struct { - BaseClient -} - -// NewPrivateLinkResourceClient creates an instance of the PrivateLinkResourceClient client. -func NewPrivateLinkResourceClient(subscriptionID string) PrivateLinkResourceClient { - return NewPrivateLinkResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourceClientWithBaseURI creates an instance of the PrivateLinkResourceClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourceClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourceClient { - return PrivateLinkResourceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets information about the specified private link resource. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// privateLinkResourceName - the private link resource name. This must be unique within the account. -func (client PrivateLinkResourceClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: privateLinkResourceName, - Constraints: []validation.Constraint{{Target: "privateLinkResourceName", Name: validation.MaxLength, Rule: 101, Chain: nil}, - {Target: "privateLinkResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "privateLinkResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateLinkResourceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourceClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourceClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourceClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the private link resources in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -func (client PrivateLinkResourceClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lplrr.Response.Response != nil { - sc = result.lplrr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateLinkResourceClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lplrr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lplrr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lplrr.hasNextLink() && result.lplrr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client PrivateLinkResourceClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourceClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourceClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateLinkResourcesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourceClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateLinkResourcesResult) (result ListPrivateLinkResourcesResult, err error) { - req, err := lastResults.listPrivateLinkResourcesResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourceClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/version.go deleted file mode 100644 index d8de98dcf60e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package batch - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " batch/2022-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/README.md new file mode 100644 index 000000000000..55051b3286be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application` Documentation + +The `application` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" +``` + + +### Client Initialization + +```go +client := application.NewApplicationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApplicationClient.Create` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +payload := application.Application{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.Delete` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.Get` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.List` + +```go +ctx := context.TODO() +id := application.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.List(ctx, id, application.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, application.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApplicationClient.Update` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +payload := application.Application{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/client.go new file mode 100644 index 000000000000..56913082b955 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/client.go @@ -0,0 +1,18 @@ +package application + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationClient struct { + Client autorest.Client + baseUri string +} + +func NewApplicationClientWithBaseURI(endpoint string) ApplicationClient { + return ApplicationClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_application.go new file mode 100644 index 000000000000..904987a7d919 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_application.go @@ -0,0 +1,137 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationId{} + +// ApplicationId is a struct representing the Resource ID for a Application +type ApplicationId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string + ApplicationName string +} + +// NewApplicationID returns a new ApplicationId struct +func NewApplicationID(subscriptionId string, resourceGroupName string, batchAccountName string, applicationName string) ApplicationId { + return ApplicationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + ApplicationName: applicationName, + } +} + +// ParseApplicationID parses 'input' into a ApplicationId +func ParseApplicationID(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationIDInsensitively parses 'input' case-insensitively into a ApplicationId +// note: this method should only be used for API response data and not user input +func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationID checks that 'input' can be parsed as a Application ID +func ValidateApplicationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application ID +func (id ApplicationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/applications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName, id.ApplicationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application ID +func (id ApplicationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + resourceids.StaticSegment("staticApplications", "applications", "applications"), + resourceids.UserSpecifiedSegment("applicationName", "applicationValue"), + } +} + +// String returns a human-readable description of this Application ID +func (id ApplicationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + fmt.Sprintf("Application Name: %q", id.ApplicationName), + } + return fmt.Sprintf("Application (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_batchaccount.go new file mode 100644 index 000000000000..1fb2186c8bd6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_batchaccount.go @@ -0,0 +1,124 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_create_autorest.go new file mode 100644 index 000000000000..e0cc35d33083 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_create_autorest.go @@ -0,0 +1,69 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Create ... +func (c ApplicationClient) Create(ctx context.Context, id ApplicationId, input Application) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c ApplicationClient) preparerForCreate(ctx context.Context, id ApplicationId, input Application) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_delete_autorest.go new file mode 100644 index 000000000000..3adfaf68b49b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_delete_autorest.go @@ -0,0 +1,66 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ApplicationClient) Delete(ctx context.Context, id ApplicationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ApplicationClient) preparerForDelete(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_get_autorest.go new file mode 100644 index 000000000000..694243403a5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_get_autorest.go @@ -0,0 +1,68 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Get ... +func (c ApplicationClient) Get(ctx context.Context, id ApplicationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ApplicationClient) preparerForGet(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_list_autorest.go new file mode 100644 index 000000000000..1bea9a0fafb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_list_autorest.go @@ -0,0 +1,215 @@ +package application + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Application + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Application +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Maxresults *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Maxresults != nil { + out["maxresults"] = *o.Maxresults + } + + return out +} + +// List ... +func (c ApplicationClient) List(ctx context.Context, id BatchAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ApplicationClient) preparerForList(ctx context.Context, id BatchAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/applications", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ApplicationClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Application `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ApplicationClient) ListComplete(ctx context.Context, id BatchAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, ApplicationOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationClient) ListCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, options ListOperationOptions, predicate ApplicationOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Application, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_update_autorest.go new file mode 100644 index 000000000000..3b89577a8510 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_update_autorest.go @@ -0,0 +1,69 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Update ... +func (c ApplicationClient) Update(ctx context.Context, id ApplicationId, input Application) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ApplicationClient) preparerForUpdate(ctx context.Context, id ApplicationId, input Application) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_application.go new file mode 100644 index 000000000000..0d89670c2c76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_application.go @@ -0,0 +1,12 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Application struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApplicationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_applicationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_applicationproperties.go new file mode 100644 index 000000000000..976af8379d80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_applicationproperties.go @@ -0,0 +1,10 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProperties struct { + AllowUpdates *bool `json:"allowUpdates,omitempty"` + DefaultVersion *string `json:"defaultVersion,omitempty"` + DisplayName *string `json:"displayName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/predicates.go new file mode 100644 index 000000000000..33ea31cd0443 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/predicates.go @@ -0,0 +1,29 @@ +package application + +type ApplicationOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p ApplicationOperationPredicate) Matches(input Application) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/version.go new file mode 100644 index 000000000000..e6a7ea3aa947 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/version.go @@ -0,0 +1,12 @@ +package application + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/application/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/README.md new file mode 100644 index 000000000000..39602788bb85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/README.md @@ -0,0 +1,190 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount` Documentation + +The `batchaccount` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" +``` + + +### Client Initialization + +```go +client := batchaccount.NewBatchAccountClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BatchAccountClient.Create` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +payload := batchaccount.BatchAccountCreateParameters{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BatchAccountClient.Delete` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BatchAccountClient.Get` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.GetKeys` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +read, err := client.GetKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.List` + +```go +ctx := context.TODO() +id := batchaccount.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BatchAccountClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := batchaccount.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BatchAccountClient.ListOutboundNetworkDependenciesEndpoints` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.ListOutboundNetworkDependenciesEndpoints(ctx, id)` can be used to do batched pagination +items, err := client.ListOutboundNetworkDependenciesEndpointsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BatchAccountClient.RegenerateKey` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +payload := batchaccount.BatchAccountRegenerateKeyParameters{ + // ... +} + + +read, err := client.RegenerateKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.SynchronizeAutoStorageKeys` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +read, err := client.SynchronizeAutoStorageKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.Update` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +payload := batchaccount.BatchAccountUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/client.go new file mode 100644 index 000000000000..3fbf007c1478 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/client.go @@ -0,0 +1,18 @@ +package batchaccount + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountClient struct { + Client autorest.Client + baseUri string +} + +func NewBatchAccountClientWithBaseURI(endpoint string) BatchAccountClient { + return BatchAccountClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/constants.go new file mode 100644 index 000000000000..e19d93bf49e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/constants.go @@ -0,0 +1,282 @@ +package batchaccount + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountKeyType string + +const ( + AccountKeyTypePrimary AccountKeyType = "Primary" + AccountKeyTypeSecondary AccountKeyType = "Secondary" +) + +func PossibleValuesForAccountKeyType() []string { + return []string{ + string(AccountKeyTypePrimary), + string(AccountKeyTypeSecondary), + } +} + +func parseAccountKeyType(input string) (*AccountKeyType, error) { + vals := map[string]AccountKeyType{ + "primary": AccountKeyTypePrimary, + "secondary": AccountKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccountKeyType(input) + return &out, nil +} + +type AuthenticationMode string + +const ( + AuthenticationModeAAD AuthenticationMode = "AAD" + AuthenticationModeSharedKey AuthenticationMode = "SharedKey" + AuthenticationModeTaskAuthenticationToken AuthenticationMode = "TaskAuthenticationToken" +) + +func PossibleValuesForAuthenticationMode() []string { + return []string{ + string(AuthenticationModeAAD), + string(AuthenticationModeSharedKey), + string(AuthenticationModeTaskAuthenticationToken), + } +} + +func parseAuthenticationMode(input string) (*AuthenticationMode, error) { + vals := map[string]AuthenticationMode{ + "aad": AuthenticationModeAAD, + "sharedkey": AuthenticationModeSharedKey, + "taskauthenticationtoken": AuthenticationModeTaskAuthenticationToken, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthenticationMode(input) + return &out, nil +} + +type AutoStorageAuthenticationMode string + +const ( + AutoStorageAuthenticationModeBatchAccountManagedIdentity AutoStorageAuthenticationMode = "BatchAccountManagedIdentity" + AutoStorageAuthenticationModeStorageKeys AutoStorageAuthenticationMode = "StorageKeys" +) + +func PossibleValuesForAutoStorageAuthenticationMode() []string { + return []string{ + string(AutoStorageAuthenticationModeBatchAccountManagedIdentity), + string(AutoStorageAuthenticationModeStorageKeys), + } +} + +func parseAutoStorageAuthenticationMode(input string) (*AutoStorageAuthenticationMode, error) { + vals := map[string]AutoStorageAuthenticationMode{ + "batchaccountmanagedidentity": AutoStorageAuthenticationModeBatchAccountManagedIdentity, + "storagekeys": AutoStorageAuthenticationModeStorageKeys, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutoStorageAuthenticationMode(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceMicrosoftPointBatch KeySource = "Microsoft.Batch" + KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceMicrosoftPointBatch), + string(KeySourceMicrosoftPointKeyVault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "microsoft.batch": KeySourceMicrosoftPointBatch, + "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type PoolAllocationMode string + +const ( + PoolAllocationModeBatchService PoolAllocationMode = "BatchService" + PoolAllocationModeUserSubscription PoolAllocationMode = "UserSubscription" +) + +func PossibleValuesForPoolAllocationMode() []string { + return []string{ + string(PoolAllocationModeBatchService), + string(PoolAllocationModeUserSubscription), + } +} + +func parsePoolAllocationMode(input string) (*PoolAllocationMode, error) { + vals := map[string]PoolAllocationMode{ + "batchservice": PoolAllocationModeBatchService, + "usersubscription": PoolAllocationModeUserSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PoolAllocationMode(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + string(PrivateEndpointConnectionProvisioningStateUpdating), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + "updating": PrivateEndpointConnectionProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCancelled ProvisioningState = "Cancelled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInvalid ProvisioningState = "Invalid" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCancelled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateInvalid), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "cancelled": ProvisioningStateCancelled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "invalid": ProvisioningStateInvalid, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccessType string + +const ( + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessType() []string { + return []string{ + string(PublicNetworkAccessTypeDisabled), + string(PublicNetworkAccessTypeEnabled), + } +} + +func parsePublicNetworkAccessType(input string) (*PublicNetworkAccessType, error) { + vals := map[string]PublicNetworkAccessType{ + "disabled": PublicNetworkAccessTypeDisabled, + "enabled": PublicNetworkAccessTypeEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/id_batchaccount.go new file mode 100644 index 000000000000..1d84b5df5317 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/id_batchaccount.go @@ -0,0 +1,124 @@ +package batchaccount + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_create_autorest.go new file mode 100644 index 000000000000..7ed7eef0c6ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_create_autorest.go @@ -0,0 +1,79 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c BatchAccountClient) Create(ctx context.Context, id BatchAccountId, input BatchAccountCreateParameters) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c BatchAccountClient) CreateThenPoll(ctx context.Context, id BatchAccountId, input BatchAccountCreateParameters) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c BatchAccountClient) preparerForCreate(ctx context.Context, id BatchAccountId, input BatchAccountCreateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c BatchAccountClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_delete_autorest.go new file mode 100644 index 000000000000..31f92f2877ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_delete_autorest.go @@ -0,0 +1,78 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c BatchAccountClient) Delete(ctx context.Context, id BatchAccountId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c BatchAccountClient) DeleteThenPoll(ctx context.Context, id BatchAccountId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c BatchAccountClient) preparerForDelete(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c BatchAccountClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_get_autorest.go new file mode 100644 index 000000000000..020c1fd7006b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_get_autorest.go @@ -0,0 +1,68 @@ +package batchaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccount +} + +// Get ... +func (c BatchAccountClient) Get(ctx context.Context, id BatchAccountId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BatchAccountClient) preparerForGet(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_getkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_getkeys_autorest.go new file mode 100644 index 000000000000..32847126b3e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_getkeys_autorest.go @@ -0,0 +1,69 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetKeysOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccountKeys +} + +// GetKeys ... +func (c BatchAccountClient) GetKeys(ctx context.Context, id BatchAccountId) (result GetKeysOperationResponse, err error) { + req, err := c.preparerForGetKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "GetKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "GetKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "GetKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetKeys prepares the GetKeys request. +func (c BatchAccountClient) preparerForGetKeys(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetKeys handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForGetKeys(resp *http.Response) (result GetKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_list_autorest.go new file mode 100644 index 000000000000..01aa422def4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_list_autorest.go @@ -0,0 +1,187 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]BatchAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []BatchAccount +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c BatchAccountClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c BatchAccountClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Batch/batchAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c BatchAccountClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []BatchAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c BatchAccountClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, BatchAccountOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BatchAccountClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate BatchAccountOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]BatchAccount, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..84e3e857b30d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]BatchAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []BatchAccount +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c BatchAccountClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c BatchAccountClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Batch/batchAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c BatchAccountClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []BatchAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c BatchAccountClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, BatchAccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BatchAccountClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate BatchAccountOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]BatchAccount, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listoutboundnetworkdependenciesendpoints_autorest.go new file mode 100644 index 000000000000..2ebbe34da94f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listoutboundnetworkdependenciesendpoints_autorest.go @@ -0,0 +1,186 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + Model *[]OutboundEnvironmentEndpoint + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOutboundNetworkDependenciesEndpointsOperationResponse, error) +} + +type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { + Items []OutboundEnvironmentEndpoint +} + +func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListOutboundNetworkDependenciesEndpoints ... +func (c BatchAccountClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id BatchAccountId) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListOutboundNetworkDependenciesEndpoints prepares the ListOutboundNetworkDependenciesEndpoints request. +func (c BatchAccountClient) preparerForListOutboundNetworkDependenciesEndpoints(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListOutboundNetworkDependenciesEndpointsWithNextLink prepares the ListOutboundNetworkDependenciesEndpoints request with the given nextLink token. +func (c BatchAccountClient) preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListOutboundNetworkDependenciesEndpoints handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + type page struct { + Values []OutboundEnvironmentEndpoint `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListOutboundNetworkDependenciesEndpoints(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object +func (c BatchAccountClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id BatchAccountId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BatchAccountClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + page, err := c.ListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListOutboundNetworkDependenciesEndpointsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_regeneratekey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_regeneratekey_autorest.go new file mode 100644 index 000000000000..ac0b56ea6a10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_regeneratekey_autorest.go @@ -0,0 +1,70 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccountKeys +} + +// RegenerateKey ... +func (c BatchAccountClient) RegenerateKey(ctx context.Context, id BatchAccountId, input BatchAccountRegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "RegenerateKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c BatchAccountClient) preparerForRegenerateKey(ctx context.Context, id BatchAccountId, input BatchAccountRegenerateKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKey handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForRegenerateKey(resp *http.Response) (result RegenerateKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_synchronizeautostoragekeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_synchronizeautostoragekeys_autorest.go new file mode 100644 index 000000000000..511175d63a2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_synchronizeautostoragekeys_autorest.go @@ -0,0 +1,67 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SynchronizeAutoStorageKeysOperationResponse struct { + HttpResponse *http.Response +} + +// SynchronizeAutoStorageKeys ... +func (c BatchAccountClient) SynchronizeAutoStorageKeys(ctx context.Context, id BatchAccountId) (result SynchronizeAutoStorageKeysOperationResponse, err error) { + req, err := c.preparerForSynchronizeAutoStorageKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "SynchronizeAutoStorageKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSynchronizeAutoStorageKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "SynchronizeAutoStorageKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSynchronizeAutoStorageKeys prepares the SynchronizeAutoStorageKeys request. +func (c BatchAccountClient) preparerForSynchronizeAutoStorageKeys(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/syncAutoStorageKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSynchronizeAutoStorageKeys handles the response to the SynchronizeAutoStorageKeys request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForSynchronizeAutoStorageKeys(resp *http.Response) (result SynchronizeAutoStorageKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_update_autorest.go new file mode 100644 index 000000000000..1b8c38994eb5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_update_autorest.go @@ -0,0 +1,69 @@ +package batchaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccount +} + +// Update ... +func (c BatchAccountClient) Update(ctx context.Context, id BatchAccountId, input BatchAccountUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c BatchAccountClient) preparerForUpdate(ctx context.Context, id BatchAccountId, input BatchAccountUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostoragebaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostoragebaseproperties.go new file mode 100644 index 000000000000..9eedd3fe954b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostoragebaseproperties.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoStorageBaseProperties struct { + AuthenticationMode *AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` + NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` + StorageAccountId *string `json:"storageAccountId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostorageproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostorageproperties.go new file mode 100644 index 000000000000..a0da8c8ba396 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostorageproperties.go @@ -0,0 +1,26 @@ +package batchaccount + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoStorageProperties struct { + AuthenticationMode *AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` + LastKeySync string `json:"lastKeySync"` + NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` + StorageAccountId string `json:"storageAccountId"` +} + +func (o *AutoStorageProperties) GetLastKeySyncAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.LastKeySync, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutoStorageProperties) SetLastKeySyncAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastKeySync = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccount.go new file mode 100644 index 000000000000..aa017d4a2434 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccount.go @@ -0,0 +1,18 @@ +package batchaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccount struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BatchAccountProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateparameters.go new file mode 100644 index 000000000000..d4f973e727a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateparameters.go @@ -0,0 +1,15 @@ +package batchaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountCreateParameters struct { + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Properties *BatchAccountCreateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateproperties.go new file mode 100644 index 000000000000..87fd212ccba1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateproperties.go @@ -0,0 +1,13 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountCreateProperties struct { + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + PoolAllocationMode *PoolAllocationMode `json:"poolAllocationMode,omitempty"` + PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountkeys.go new file mode 100644 index 000000000000..791eda711d81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountkeys.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountKeys struct { + AccountName *string `json:"accountName,omitempty"` + Primary *string `json:"primary,omitempty"` + Secondary *string `json:"secondary,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountproperties.go new file mode 100644 index 000000000000..cbbfd212e931 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountproperties.go @@ -0,0 +1,22 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountProperties struct { + AccountEndpoint *string `json:"accountEndpoint,omitempty"` + ActiveJobAndJobScheduleQuota *int64 `json:"activeJobAndJobScheduleQuota,omitempty"` + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` + AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` + DedicatedCoreQuota *int64 `json:"dedicatedCoreQuota,omitempty"` + DedicatedCoreQuotaPerVMFamily *[]VirtualMachineFamilyCoreQuota `json:"dedicatedCoreQuotaPerVMFamily,omitempty"` + DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + LowPriorityCoreQuota *int64 `json:"lowPriorityCoreQuota,omitempty"` + PoolAllocationMode *PoolAllocationMode `json:"poolAllocationMode,omitempty"` + PoolQuota *int64 `json:"poolQuota,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountregeneratekeyparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountregeneratekeyparameters.go new file mode 100644 index 000000000000..1eea03ff5f24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountregeneratekeyparameters.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountRegenerateKeyParameters struct { + KeyName AccountKeyType `json:"keyName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateparameters.go new file mode 100644 index 000000000000..90422490141a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateparameters.go @@ -0,0 +1,14 @@ +package batchaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountUpdateParameters struct { + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Properties *BatchAccountUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateproperties.go new file mode 100644 index 000000000000..becd3f6fd645 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateproperties.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountUpdateProperties struct { + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_computenodeidentityreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_computenodeidentityreference.go new file mode 100644 index 000000000000..99f063c16b7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_computenodeidentityreference.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeNodeIdentityReference struct { + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_encryptionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_encryptionproperties.go new file mode 100644 index 000000000000..018f83c27e56 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_encryptionproperties.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionProperties struct { + KeySource *KeySource `json:"keySource,omitempty"` + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdependency.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdependency.go new file mode 100644 index 000000000000..2b0ee92ad27b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdependency.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDependency struct { + Description *string `json:"description,omitempty"` + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdetail.go new file mode 100644 index 000000000000..521a439d6be8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdetail.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDetail struct { + Port *int64 `json:"port,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultproperties.go new file mode 100644 index 000000000000..b11e9e9ec8c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultproperties.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + KeyIdentifier *string `json:"keyIdentifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultreference.go new file mode 100644 index 000000000000..e3d275bac71e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultreference.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultReference struct { + Id string `json:"id"` + Url string `json:"url"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_outboundenvironmentendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_outboundenvironmentendpoint.go new file mode 100644 index 000000000000..b0d7c922f54e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_outboundenvironmentendpoint.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OutboundEnvironmentEndpoint struct { + Category *string `json:"category,omitempty"` + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpoint.go new file mode 100644 index 000000000000..e60387e8f83e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpoint.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnection.go new file mode 100644 index 000000000000..282e17657399 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnection.go @@ -0,0 +1,12 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..1b197a8f0937 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..72ec30f7c334 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionRequired *string `json:"actionRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_virtualmachinefamilycorequota.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_virtualmachinefamilycorequota.go new file mode 100644 index 000000000000..f1812c2636ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_virtualmachinefamilycorequota.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineFamilyCoreQuota struct { + CoreQuota *int64 `json:"coreQuota,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/predicates.go new file mode 100644 index 000000000000..075bc68a9c9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/predicates.go @@ -0,0 +1,42 @@ +package batchaccount + +type BatchAccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p BatchAccountOperationPredicate) Matches(input BatchAccount) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type OutboundEnvironmentEndpointOperationPredicate struct { + Category *string +} + +func (p OutboundEnvironmentEndpointOperationPredicate) Matches(input OutboundEnvironmentEndpoint) bool { + + if p.Category != nil && (input.Category == nil && *p.Category != *input.Category) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/version.go new file mode 100644 index 000000000000..4366c5c0ebdf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/version.go @@ -0,0 +1,12 @@ +package batchaccount + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/batchaccount/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/README.md new file mode 100644 index 000000000000..dcb4e42ddcdc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/README.md @@ -0,0 +1,123 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate` Documentation + +The `certificate` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" +``` + + +### Client Initialization + +```go +client := certificate.NewCertificateClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CertificateClient.CancelDeletion` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +read, err := client.CancelDeletion(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.Create` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +payload := certificate.CertificateCreateOrUpdateParameters{ + // ... +} + + +read, err := client.Create(ctx, id, payload, certificate.DefaultCreateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.Delete` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CertificateClient.Get` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.ListByBatchAccount` + +```go +ctx := context.TODO() +id := certificate.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.ListByBatchAccount(ctx, id, certificate.DefaultListByBatchAccountOperationOptions())` can be used to do batched pagination +items, err := client.ListByBatchAccountComplete(ctx, id, certificate.DefaultListByBatchAccountOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CertificateClient.Update` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +payload := certificate.CertificateCreateOrUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, certificate.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/client.go new file mode 100644 index 000000000000..f304bfc665dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/client.go @@ -0,0 +1,18 @@ +package certificate + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateClient struct { + Client autorest.Client + baseUri string +} + +func NewCertificateClientWithBaseURI(endpoint string) CertificateClient { + return CertificateClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/constants.go new file mode 100644 index 000000000000..0eb06a7c5bed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/constants.go @@ -0,0 +1,65 @@ +package certificate + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateFormat string + +const ( + CertificateFormatCer CertificateFormat = "Cer" + CertificateFormatPfx CertificateFormat = "Pfx" +) + +func PossibleValuesForCertificateFormat() []string { + return []string{ + string(CertificateFormatCer), + string(CertificateFormatPfx), + } +} + +func parseCertificateFormat(input string) (*CertificateFormat, error) { + vals := map[string]CertificateFormat{ + "cer": CertificateFormatCer, + "pfx": CertificateFormatPfx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateFormat(input) + return &out, nil +} + +type CertificateProvisioningState string + +const ( + CertificateProvisioningStateDeleting CertificateProvisioningState = "Deleting" + CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" + CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" +) + +func PossibleValuesForCertificateProvisioningState() []string { + return []string{ + string(CertificateProvisioningStateDeleting), + string(CertificateProvisioningStateFailed), + string(CertificateProvisioningStateSucceeded), + } +} + +func parseCertificateProvisioningState(input string) (*CertificateProvisioningState, error) { + vals := map[string]CertificateProvisioningState{ + "deleting": CertificateProvisioningStateDeleting, + "failed": CertificateProvisioningStateFailed, + "succeeded": CertificateProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_batchaccount.go new file mode 100644 index 000000000000..2c717ddb98f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_batchaccount.go @@ -0,0 +1,124 @@ +package certificate + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_certificate.go new file mode 100644 index 000000000000..73ccd308ef9d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_certificate.go @@ -0,0 +1,137 @@ +package certificate + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string + CertificateName string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, batchAccountName string, certificateName string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + CertificateName: certificateName, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_canceldeletion_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_canceldeletion_autorest.go new file mode 100644 index 000000000000..e2662040d629 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_canceldeletion_autorest.go @@ -0,0 +1,69 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CancelDeletionOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// CancelDeletion ... +func (c CertificateClient) CancelDeletion(ctx context.Context, id CertificateId) (result CancelDeletionOperationResponse, err error) { + req, err := c.preparerForCancelDeletion(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CancelDeletion", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CancelDeletion", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCancelDeletion(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CancelDeletion", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCancelDeletion prepares the CancelDeletion request. +func (c CertificateClient) preparerForCancelDeletion(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/cancelDelete", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCancelDeletion handles the response to the CancelDeletion request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForCancelDeletion(resp *http.Response) (result CancelDeletionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_create_autorest.go new file mode 100644 index 000000000000..1ed47e24c77c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_create_autorest.go @@ -0,0 +1,103 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +type CreateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Create ... +func (c CertificateClient) Create(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOperationOptions) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c CertificateClient) preparerForCreate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_delete_autorest.go new file mode 100644 index 000000000000..7df2c763a7fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_delete_autorest.go @@ -0,0 +1,78 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c CertificateClient) Delete(ctx context.Context, id CertificateId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CertificateClient) DeleteThenPoll(ctx context.Context, id CertificateId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c CertificateClient) preparerForDelete(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c CertificateClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_get_autorest.go new file mode 100644 index 000000000000..450bf969bbe7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_get_autorest.go @@ -0,0 +1,68 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// Get ... +func (c CertificateClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c CertificateClient) preparerForGet(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_listbybatchaccount_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_listbybatchaccount_autorest.go new file mode 100644 index 000000000000..792381d217a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_listbybatchaccount_autorest.go @@ -0,0 +1,225 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByBatchAccountOperationResponse struct { + HttpResponse *http.Response + Model *[]Certificate + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByBatchAccountOperationResponse, error) +} + +type ListByBatchAccountCompleteResult struct { + Items []Certificate +} + +func (r ListByBatchAccountOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByBatchAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByBatchAccountOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByBatchAccountOperationOptions struct { + Filter *string + Maxresults *int64 + Select *string +} + +func DefaultListByBatchAccountOperationOptions() ListByBatchAccountOperationOptions { + return ListByBatchAccountOperationOptions{} +} + +func (o ListByBatchAccountOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByBatchAccountOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Maxresults != nil { + out["maxresults"] = *o.Maxresults + } + + if o.Select != nil { + out["$select"] = *o.Select + } + + return out +} + +// ListByBatchAccount ... +func (c CertificateClient) ListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (resp ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccount(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByBatchAccount(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByBatchAccount prepares the ListByBatchAccount request. +func (c CertificateClient) preparerForListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/certificates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByBatchAccountWithNextLink prepares the ListByBatchAccount request with the given nextLink token. +func (c CertificateClient) preparerForListByBatchAccountWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByBatchAccount handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForListByBatchAccount(resp *http.Response) (result ListByBatchAccountOperationResponse, err error) { + type page struct { + Values []Certificate `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccountWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByBatchAccount(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByBatchAccountComplete retrieves all of the results into a single object +func (c CertificateClient) ListByBatchAccountComplete(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (ListByBatchAccountCompleteResult, error) { + return c.ListByBatchAccountCompleteMatchingPredicate(ctx, id, options, CertificateOperationPredicate{}) +} + +// ListByBatchAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CertificateClient) ListByBatchAccountCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions, predicate CertificateOperationPredicate) (resp ListByBatchAccountCompleteResult, err error) { + items := make([]Certificate, 0) + + page, err := c.ListByBatchAccount(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByBatchAccountCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_update_autorest.go new file mode 100644 index 000000000000..5bcbc4cad348 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_update_autorest.go @@ -0,0 +1,98 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c CertificateClient) Update(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c CertificateClient) preparerForUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificate.go new file mode 100644 index 000000000000..5218b0449e6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificate.go @@ -0,0 +1,12 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Certificate struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CertificateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateparameters.go new file mode 100644 index 000000000000..1d50bc058ad7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateparameters.go @@ -0,0 +1,12 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateCreateOrUpdateParameters struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateproperties.go new file mode 100644 index 000000000000..5af96095ec4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateproperties.go @@ -0,0 +1,12 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateCreateOrUpdateProperties struct { + Data string `json:"data"` + Format *CertificateFormat `json:"format,omitempty"` + Password *string `json:"password,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificateproperties.go new file mode 100644 index 000000000000..01b0c5dc1279 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificateproperties.go @@ -0,0 +1,46 @@ +package certificate + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProperties struct { + DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` + Format *CertificateFormat `json:"format,omitempty"` + PreviousProvisioningState *CertificateProvisioningState `json:"previousProvisioningState,omitempty"` + PreviousProvisioningStateTransitionTime *string `json:"previousProvisioningStateTransitionTime,omitempty"` + ProvisioningState *CertificateProvisioningState `json:"provisioningState,omitempty"` + ProvisioningStateTransitionTime *string `json:"provisioningStateTransitionTime,omitempty"` + PublicData *string `json:"publicData,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` +} + +func (o *CertificateProperties) GetPreviousProvisioningStateTransitionTimeAsTime() (*time.Time, error) { + if o.PreviousProvisioningStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreviousProvisioningStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetPreviousProvisioningStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreviousProvisioningStateTransitionTime = &formatted +} + +func (o *CertificateProperties) GetProvisioningStateTransitionTimeAsTime() (*time.Time, error) { + if o.ProvisioningStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetProvisioningStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningStateTransitionTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_deletecertificateerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_deletecertificateerror.go new file mode 100644 index 000000000000..1e12424fff41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_deletecertificateerror.go @@ -0,0 +1,11 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteCertificateError struct { + Code string `json:"code"` + Details *[]DeleteCertificateError `json:"details,omitempty"` + Message string `json:"message"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/predicates.go new file mode 100644 index 000000000000..9ba6c8179248 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/predicates.go @@ -0,0 +1,29 @@ +package certificate + +type CertificateOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p CertificateOperationPredicate) Matches(input Certificate) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/version.go new file mode 100644 index 000000000000..a3082d8db622 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/version.go @@ -0,0 +1,12 @@ +package certificate + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/certificate/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/README.md new file mode 100644 index 000000000000..d6582233c32b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/README.md @@ -0,0 +1,139 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool` Documentation + +The `pool` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" +``` + + +### Client Initialization + +```go +client := pool.NewPoolClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PoolClient.Create` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +payload := pool.Pool{ + // ... +} + + +read, err := client.Create(ctx, id, payload, pool.DefaultCreateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.Delete` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PoolClient.DisableAutoScale` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +read, err := client.DisableAutoScale(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.Get` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.ListByBatchAccount` + +```go +ctx := context.TODO() +id := pool.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.ListByBatchAccount(ctx, id, pool.DefaultListByBatchAccountOperationOptions())` can be used to do batched pagination +items, err := client.ListByBatchAccountComplete(ctx, id, pool.DefaultListByBatchAccountOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PoolClient.StopResize` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +read, err := client.StopResize(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.Update` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +payload := pool.Pool{ + // ... +} + + +read, err := client.Update(ctx, id, payload, pool.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/client.go new file mode 100644 index 000000000000..f08365830970 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/client.go @@ -0,0 +1,18 @@ +package pool + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolClient struct { + Client autorest.Client + baseUri string +} + +func NewPoolClientWithBaseURI(endpoint string) PoolClient { + return PoolClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/constants.go new file mode 100644 index 000000000000..5936d3c1716e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/constants.go @@ -0,0 +1,606 @@ +package pool + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllocationState string + +const ( + AllocationStateResizing AllocationState = "Resizing" + AllocationStateSteady AllocationState = "Steady" + AllocationStateStopping AllocationState = "Stopping" +) + +func PossibleValuesForAllocationState() []string { + return []string{ + string(AllocationStateResizing), + string(AllocationStateSteady), + string(AllocationStateStopping), + } +} + +func parseAllocationState(input string) (*AllocationState, error) { + vals := map[string]AllocationState{ + "resizing": AllocationStateResizing, + "steady": AllocationStateSteady, + "stopping": AllocationStateStopping, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationState(input) + return &out, nil +} + +type AutoUserScope string + +const ( + AutoUserScopePool AutoUserScope = "Pool" + AutoUserScopeTask AutoUserScope = "Task" +) + +func PossibleValuesForAutoUserScope() []string { + return []string{ + string(AutoUserScopePool), + string(AutoUserScopeTask), + } +} + +func parseAutoUserScope(input string) (*AutoUserScope, error) { + vals := map[string]AutoUserScope{ + "pool": AutoUserScopePool, + "task": AutoUserScopeTask, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutoUserScope(input) + return &out, nil +} + +type CachingType string + +const ( + CachingTypeNone CachingType = "None" + CachingTypeReadOnly CachingType = "ReadOnly" + CachingTypeReadWrite CachingType = "ReadWrite" +) + +func PossibleValuesForCachingType() []string { + return []string{ + string(CachingTypeNone), + string(CachingTypeReadOnly), + string(CachingTypeReadWrite), + } +} + +func parseCachingType(input string) (*CachingType, error) { + vals := map[string]CachingType{ + "none": CachingTypeNone, + "readonly": CachingTypeReadOnly, + "readwrite": CachingTypeReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingType(input) + return &out, nil +} + +type CertificateStoreLocation string + +const ( + CertificateStoreLocationCurrentUser CertificateStoreLocation = "CurrentUser" + CertificateStoreLocationLocalMachine CertificateStoreLocation = "LocalMachine" +) + +func PossibleValuesForCertificateStoreLocation() []string { + return []string{ + string(CertificateStoreLocationCurrentUser), + string(CertificateStoreLocationLocalMachine), + } +} + +func parseCertificateStoreLocation(input string) (*CertificateStoreLocation, error) { + vals := map[string]CertificateStoreLocation{ + "currentuser": CertificateStoreLocationCurrentUser, + "localmachine": CertificateStoreLocationLocalMachine, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateStoreLocation(input) + return &out, nil +} + +type CertificateVisibility string + +const ( + CertificateVisibilityRemoteUser CertificateVisibility = "RemoteUser" + CertificateVisibilityStartTask CertificateVisibility = "StartTask" + CertificateVisibilityTask CertificateVisibility = "Task" +) + +func PossibleValuesForCertificateVisibility() []string { + return []string{ + string(CertificateVisibilityRemoteUser), + string(CertificateVisibilityStartTask), + string(CertificateVisibilityTask), + } +} + +func parseCertificateVisibility(input string) (*CertificateVisibility, error) { + vals := map[string]CertificateVisibility{ + "remoteuser": CertificateVisibilityRemoteUser, + "starttask": CertificateVisibilityStartTask, + "task": CertificateVisibilityTask, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateVisibility(input) + return &out, nil +} + +type ComputeNodeDeallocationOption string + +const ( + ComputeNodeDeallocationOptionRequeue ComputeNodeDeallocationOption = "Requeue" + ComputeNodeDeallocationOptionRetainedData ComputeNodeDeallocationOption = "RetainedData" + ComputeNodeDeallocationOptionTaskCompletion ComputeNodeDeallocationOption = "TaskCompletion" + ComputeNodeDeallocationOptionTerminate ComputeNodeDeallocationOption = "Terminate" +) + +func PossibleValuesForComputeNodeDeallocationOption() []string { + return []string{ + string(ComputeNodeDeallocationOptionRequeue), + string(ComputeNodeDeallocationOptionRetainedData), + string(ComputeNodeDeallocationOptionTaskCompletion), + string(ComputeNodeDeallocationOptionTerminate), + } +} + +func parseComputeNodeDeallocationOption(input string) (*ComputeNodeDeallocationOption, error) { + vals := map[string]ComputeNodeDeallocationOption{ + "requeue": ComputeNodeDeallocationOptionRequeue, + "retaineddata": ComputeNodeDeallocationOptionRetainedData, + "taskcompletion": ComputeNodeDeallocationOptionTaskCompletion, + "terminate": ComputeNodeDeallocationOptionTerminate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeNodeDeallocationOption(input) + return &out, nil +} + +type ComputeNodeFillType string + +const ( + ComputeNodeFillTypePack ComputeNodeFillType = "Pack" + ComputeNodeFillTypeSpread ComputeNodeFillType = "Spread" +) + +func PossibleValuesForComputeNodeFillType() []string { + return []string{ + string(ComputeNodeFillTypePack), + string(ComputeNodeFillTypeSpread), + } +} + +func parseComputeNodeFillType(input string) (*ComputeNodeFillType, error) { + vals := map[string]ComputeNodeFillType{ + "pack": ComputeNodeFillTypePack, + "spread": ComputeNodeFillTypeSpread, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeNodeFillType(input) + return &out, nil +} + +type ContainerType string + +const ( + ContainerTypeDockerCompatible ContainerType = "DockerCompatible" +) + +func PossibleValuesForContainerType() []string { + return []string{ + string(ContainerTypeDockerCompatible), + } +} + +func parseContainerType(input string) (*ContainerType, error) { + vals := map[string]ContainerType{ + "dockercompatible": ContainerTypeDockerCompatible, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerType(input) + return &out, nil +} + +type ContainerWorkingDirectory string + +const ( + ContainerWorkingDirectoryContainerImageDefault ContainerWorkingDirectory = "ContainerImageDefault" + ContainerWorkingDirectoryTaskWorkingDirectory ContainerWorkingDirectory = "TaskWorkingDirectory" +) + +func PossibleValuesForContainerWorkingDirectory() []string { + return []string{ + string(ContainerWorkingDirectoryContainerImageDefault), + string(ContainerWorkingDirectoryTaskWorkingDirectory), + } +} + +func parseContainerWorkingDirectory(input string) (*ContainerWorkingDirectory, error) { + vals := map[string]ContainerWorkingDirectory{ + "containerimagedefault": ContainerWorkingDirectoryContainerImageDefault, + "taskworkingdirectory": ContainerWorkingDirectoryTaskWorkingDirectory, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerWorkingDirectory(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + } +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskEncryptionTarget string + +const ( + DiskEncryptionTargetOsDisk DiskEncryptionTarget = "OsDisk" + DiskEncryptionTargetTemporaryDisk DiskEncryptionTarget = "TemporaryDisk" +) + +func PossibleValuesForDiskEncryptionTarget() []string { + return []string{ + string(DiskEncryptionTargetOsDisk), + string(DiskEncryptionTargetTemporaryDisk), + } +} + +func parseDiskEncryptionTarget(input string) (*DiskEncryptionTarget, error) { + vals := map[string]DiskEncryptionTarget{ + "osdisk": DiskEncryptionTargetOsDisk, + "temporarydisk": DiskEncryptionTargetTemporaryDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskEncryptionTarget(input) + return &out, nil +} + +type DynamicVNetAssignmentScope string + +const ( + DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = "job" + DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = "none" +) + +func PossibleValuesForDynamicVNetAssignmentScope() []string { + return []string{ + string(DynamicVNetAssignmentScopeJob), + string(DynamicVNetAssignmentScopeNone), + } +} + +func parseDynamicVNetAssignmentScope(input string) (*DynamicVNetAssignmentScope, error) { + vals := map[string]DynamicVNetAssignmentScope{ + "job": DynamicVNetAssignmentScopeJob, + "none": DynamicVNetAssignmentScopeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DynamicVNetAssignmentScope(input) + return &out, nil +} + +type ElevationLevel string + +const ( + ElevationLevelAdmin ElevationLevel = "Admin" + ElevationLevelNonAdmin ElevationLevel = "NonAdmin" +) + +func PossibleValuesForElevationLevel() []string { + return []string{ + string(ElevationLevelAdmin), + string(ElevationLevelNonAdmin), + } +} + +func parseElevationLevel(input string) (*ElevationLevel, error) { + vals := map[string]ElevationLevel{ + "admin": ElevationLevelAdmin, + "nonadmin": ElevationLevelNonAdmin, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ElevationLevel(input) + return &out, nil +} + +type IPAddressProvisioningType string + +const ( + IPAddressProvisioningTypeBatchManaged IPAddressProvisioningType = "BatchManaged" + IPAddressProvisioningTypeNoPublicIPAddresses IPAddressProvisioningType = "NoPublicIPAddresses" + IPAddressProvisioningTypeUserManaged IPAddressProvisioningType = "UserManaged" +) + +func PossibleValuesForIPAddressProvisioningType() []string { + return []string{ + string(IPAddressProvisioningTypeBatchManaged), + string(IPAddressProvisioningTypeNoPublicIPAddresses), + string(IPAddressProvisioningTypeUserManaged), + } +} + +func parseIPAddressProvisioningType(input string) (*IPAddressProvisioningType, error) { + vals := map[string]IPAddressProvisioningType{ + "batchmanaged": IPAddressProvisioningTypeBatchManaged, + "nopublicipaddresses": IPAddressProvisioningTypeNoPublicIPAddresses, + "usermanaged": IPAddressProvisioningTypeUserManaged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPAddressProvisioningType(input) + return &out, nil +} + +type InboundEndpointProtocol string + +const ( + InboundEndpointProtocolTCP InboundEndpointProtocol = "TCP" + InboundEndpointProtocolUDP InboundEndpointProtocol = "UDP" +) + +func PossibleValuesForInboundEndpointProtocol() []string { + return []string{ + string(InboundEndpointProtocolTCP), + string(InboundEndpointProtocolUDP), + } +} + +func parseInboundEndpointProtocol(input string) (*InboundEndpointProtocol, error) { + vals := map[string]InboundEndpointProtocol{ + "tcp": InboundEndpointProtocolTCP, + "udp": InboundEndpointProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InboundEndpointProtocol(input) + return &out, nil +} + +type InterNodeCommunicationState string + +const ( + InterNodeCommunicationStateDisabled InterNodeCommunicationState = "Disabled" + InterNodeCommunicationStateEnabled InterNodeCommunicationState = "Enabled" +) + +func PossibleValuesForInterNodeCommunicationState() []string { + return []string{ + string(InterNodeCommunicationStateDisabled), + string(InterNodeCommunicationStateEnabled), + } +} + +func parseInterNodeCommunicationState(input string) (*InterNodeCommunicationState, error) { + vals := map[string]InterNodeCommunicationState{ + "disabled": InterNodeCommunicationStateDisabled, + "enabled": InterNodeCommunicationStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InterNodeCommunicationState(input) + return &out, nil +} + +type LoginMode string + +const ( + LoginModeBatch LoginMode = "Batch" + LoginModeInteractive LoginMode = "Interactive" +) + +func PossibleValuesForLoginMode() []string { + return []string{ + string(LoginModeBatch), + string(LoginModeInteractive), + } +} + +func parseLoginMode(input string) (*LoginMode, error) { + vals := map[string]LoginMode{ + "batch": LoginModeBatch, + "interactive": LoginModeInteractive, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LoginMode(input) + return &out, nil +} + +type NetworkSecurityGroupRuleAccess string + +const ( + NetworkSecurityGroupRuleAccessAllow NetworkSecurityGroupRuleAccess = "Allow" + NetworkSecurityGroupRuleAccessDeny NetworkSecurityGroupRuleAccess = "Deny" +) + +func PossibleValuesForNetworkSecurityGroupRuleAccess() []string { + return []string{ + string(NetworkSecurityGroupRuleAccessAllow), + string(NetworkSecurityGroupRuleAccessDeny), + } +} + +func parseNetworkSecurityGroupRuleAccess(input string) (*NetworkSecurityGroupRuleAccess, error) { + vals := map[string]NetworkSecurityGroupRuleAccess{ + "allow": NetworkSecurityGroupRuleAccessAllow, + "deny": NetworkSecurityGroupRuleAccessDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkSecurityGroupRuleAccess(input) + return &out, nil +} + +type NodePlacementPolicyType string + +const ( + NodePlacementPolicyTypeRegional NodePlacementPolicyType = "Regional" + NodePlacementPolicyTypeZonal NodePlacementPolicyType = "Zonal" +) + +func PossibleValuesForNodePlacementPolicyType() []string { + return []string{ + string(NodePlacementPolicyTypeRegional), + string(NodePlacementPolicyTypeZonal), + } +} + +func parseNodePlacementPolicyType(input string) (*NodePlacementPolicyType, error) { + vals := map[string]NodePlacementPolicyType{ + "regional": NodePlacementPolicyTypeRegional, + "zonal": NodePlacementPolicyTypeZonal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NodePlacementPolicyType(input) + return &out, nil +} + +type PoolProvisioningState string + +const ( + PoolProvisioningStateDeleting PoolProvisioningState = "Deleting" + PoolProvisioningStateSucceeded PoolProvisioningState = "Succeeded" +) + +func PossibleValuesForPoolProvisioningState() []string { + return []string{ + string(PoolProvisioningStateDeleting), + string(PoolProvisioningStateSucceeded), + } +} + +func parsePoolProvisioningState(input string) (*PoolProvisioningState, error) { + vals := map[string]PoolProvisioningState{ + "deleting": PoolProvisioningStateDeleting, + "succeeded": PoolProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PoolProvisioningState(input) + return &out, nil +} + +type StorageAccountType string + +const ( + StorageAccountTypePremiumLRS StorageAccountType = "Premium_LRS" + StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" +) + +func PossibleValuesForStorageAccountType() []string { + return []string{ + string(StorageAccountTypePremiumLRS), + string(StorageAccountTypeStandardLRS), + } +} + +func parseStorageAccountType(input string) (*StorageAccountType, error) { + vals := map[string]StorageAccountType{ + "premium_lrs": StorageAccountTypePremiumLRS, + "standard_lrs": StorageAccountTypeStandardLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_batchaccount.go new file mode 100644 index 000000000000..be3fb1cc16ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_batchaccount.go @@ -0,0 +1,124 @@ +package pool + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_pool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_pool.go new file mode 100644 index 000000000000..1567aa05f751 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_pool.go @@ -0,0 +1,137 @@ +package pool + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PoolId{} + +// PoolId is a struct representing the Resource ID for a Pool +type PoolId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string + PoolName string +} + +// NewPoolID returns a new PoolId struct +func NewPoolID(subscriptionId string, resourceGroupName string, batchAccountName string, poolName string) PoolId { + return PoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + PoolName: poolName, + } +} + +// ParsePoolID parses 'input' into a PoolId +func ParsePoolID(input string) (*PoolId, error) { + parser := resourceids.NewParserFromResourceIdType(PoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePoolIDInsensitively parses 'input' case-insensitively into a PoolId +// note: this method should only be used for API response data and not user input +func ParsePoolIDInsensitively(input string) (*PoolId, error) { + parser := resourceids.NewParserFromResourceIdType(PoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePoolID checks that 'input' can be parsed as a Pool ID +func ValidatePoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Pool ID +func (id PoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/pools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName, id.PoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Pool ID +func (id PoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + resourceids.StaticSegment("staticPools", "pools", "pools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + } +} + +// String returns a human-readable description of this Pool ID +func (id PoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + } + return fmt.Sprintf("Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_create_autorest.go new file mode 100644 index 000000000000..9f553c3cc133 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_create_autorest.go @@ -0,0 +1,103 @@ +package pool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +type CreateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Create ... +func (c PoolClient) Create(ctx context.Context, id PoolId, input Pool, options CreateOperationOptions) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c PoolClient) preparerForCreate(ctx context.Context, id PoolId, input Pool, options CreateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_delete_autorest.go new file mode 100644 index 000000000000..4043ec1eecda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_delete_autorest.go @@ -0,0 +1,78 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PoolClient) Delete(ctx context.Context, id PoolId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PoolClient) DeleteThenPoll(ctx context.Context, id PoolId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PoolClient) preparerForDelete(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PoolClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_disableautoscale_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_disableautoscale_autorest.go new file mode 100644 index 000000000000..05985dc08ab0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_disableautoscale_autorest.go @@ -0,0 +1,69 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisableAutoScaleOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +// DisableAutoScale ... +func (c PoolClient) DisableAutoScale(ctx context.Context, id PoolId) (result DisableAutoScaleOperationResponse, err error) { + req, err := c.preparerForDisableAutoScale(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "DisableAutoScale", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "DisableAutoScale", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDisableAutoScale(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "DisableAutoScale", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDisableAutoScale prepares the DisableAutoScale request. +func (c PoolClient) preparerForDisableAutoScale(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disableAutoScale", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDisableAutoScale handles the response to the DisableAutoScale request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForDisableAutoScale(resp *http.Response) (result DisableAutoScaleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_get_autorest.go new file mode 100644 index 000000000000..0c85a615dcf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_get_autorest.go @@ -0,0 +1,68 @@ +package pool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +// Get ... +func (c PoolClient) Get(ctx context.Context, id PoolId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PoolClient) preparerForGet(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_listbybatchaccount_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_listbybatchaccount_autorest.go new file mode 100644 index 000000000000..d0f631d73113 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_listbybatchaccount_autorest.go @@ -0,0 +1,225 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByBatchAccountOperationResponse struct { + HttpResponse *http.Response + Model *[]Pool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByBatchAccountOperationResponse, error) +} + +type ListByBatchAccountCompleteResult struct { + Items []Pool +} + +func (r ListByBatchAccountOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByBatchAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByBatchAccountOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByBatchAccountOperationOptions struct { + Filter *string + Maxresults *int64 + Select *string +} + +func DefaultListByBatchAccountOperationOptions() ListByBatchAccountOperationOptions { + return ListByBatchAccountOperationOptions{} +} + +func (o ListByBatchAccountOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByBatchAccountOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Maxresults != nil { + out["maxresults"] = *o.Maxresults + } + + if o.Select != nil { + out["$select"] = *o.Select + } + + return out +} + +// ListByBatchAccount ... +func (c PoolClient) ListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (resp ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccount(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByBatchAccount(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByBatchAccount prepares the ListByBatchAccount request. +func (c PoolClient) preparerForListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/pools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByBatchAccountWithNextLink prepares the ListByBatchAccount request with the given nextLink token. +func (c PoolClient) preparerForListByBatchAccountWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByBatchAccount handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForListByBatchAccount(resp *http.Response) (result ListByBatchAccountOperationResponse, err error) { + type page struct { + Values []Pool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccountWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByBatchAccount(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByBatchAccountComplete retrieves all of the results into a single object +func (c PoolClient) ListByBatchAccountComplete(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (ListByBatchAccountCompleteResult, error) { + return c.ListByBatchAccountCompleteMatchingPredicate(ctx, id, options, PoolOperationPredicate{}) +} + +// ListByBatchAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PoolClient) ListByBatchAccountCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions, predicate PoolOperationPredicate) (resp ListByBatchAccountCompleteResult, err error) { + items := make([]Pool, 0) + + page, err := c.ListByBatchAccount(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByBatchAccountCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_stopresize_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_stopresize_autorest.go new file mode 100644 index 000000000000..80d05b20333d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_stopresize_autorest.go @@ -0,0 +1,69 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopResizeOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +// StopResize ... +func (c PoolClient) StopResize(ctx context.Context, id PoolId) (result StopResizeOperationResponse, err error) { + req, err := c.preparerForStopResize(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "StopResize", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "StopResize", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForStopResize(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "StopResize", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForStopResize prepares the StopResize request. +func (c PoolClient) preparerForStopResize(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stopResize", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForStopResize handles the response to the StopResize request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForStopResize(resp *http.Response) (result StopResizeOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_update_autorest.go new file mode 100644 index 000000000000..cdf84d869545 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_update_autorest.go @@ -0,0 +1,98 @@ +package pool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c PoolClient) Update(ctx context.Context, id PoolId, input Pool, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c PoolClient) preparerForUpdate(ctx context.Context, id PoolId, input Pool, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_applicationpackagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_applicationpackagereference.go new file mode 100644 index 000000000000..cee391669f2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_applicationpackagereference.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPackageReference struct { + Id string `json:"id"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerun.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerun.go new file mode 100644 index 000000000000..a7fc04343423 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerun.go @@ -0,0 +1,25 @@ +package pool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoScaleRun struct { + Error *AutoScaleRunError `json:"error,omitempty"` + EvaluationTime string `json:"evaluationTime"` + Results *string `json:"results,omitempty"` +} + +func (o *AutoScaleRun) GetEvaluationTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.EvaluationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutoScaleRun) SetEvaluationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EvaluationTime = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerunerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerunerror.go new file mode 100644 index 000000000000..48fe86695c2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerunerror.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoScaleRunError struct { + Code string `json:"code"` + Details *[]AutoScaleRunError `json:"details,omitempty"` + Message string `json:"message"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalesettings.go new file mode 100644 index 000000000000..86d2808d4e4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalesettings.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoScaleSettings struct { + EvaluationInterval *string `json:"evaluationInterval,omitempty"` + Formula string `json:"formula"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autouserspecification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autouserspecification.go new file mode 100644 index 000000000000..4486ae5c6622 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autouserspecification.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoUserSpecification struct { + ElevationLevel *ElevationLevel `json:"elevationLevel,omitempty"` + Scope *AutoUserScope `json:"scope,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azureblobfilesystemconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azureblobfilesystemconfiguration.go new file mode 100644 index 000000000000..67efe0937db4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azureblobfilesystemconfiguration.go @@ -0,0 +1,14 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureBlobFileSystemConfiguration struct { + AccountKey *string `json:"accountKey,omitempty"` + AccountName string `json:"accountName"` + BlobfuseOptions *string `json:"blobfuseOptions,omitempty"` + ContainerName string `json:"containerName"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` + RelativeMountPath string `json:"relativeMountPath"` + SasKey *string `json:"sasKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azurefileshareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azurefileshareconfiguration.go new file mode 100644 index 000000000000..910a385e4b86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azurefileshareconfiguration.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureFileShareConfiguration struct { + AccountKey string `json:"accountKey"` + AccountName string `json:"accountName"` + AzureFileUrl string `json:"azureFileUrl"` + MountOptions *string `json:"mountOptions,omitempty"` + RelativeMountPath string `json:"relativeMountPath"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_certificatereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_certificatereference.go new file mode 100644 index 000000000000..d764ddbb7b9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_certificatereference.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateReference struct { + Id string `json:"id"` + StoreLocation *CertificateStoreLocation `json:"storeLocation,omitempty"` + StoreName *string `json:"storeName,omitempty"` + Visibility *[]CertificateVisibility `json:"visibility,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cifsmountconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cifsmountconfiguration.go new file mode 100644 index 000000000000..0674799c4338 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cifsmountconfiguration.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CIFSMountConfiguration struct { + MountOptions *string `json:"mountOptions,omitempty"` + Password string `json:"password"` + RelativeMountPath string `json:"relativeMountPath"` + Source string `json:"source"` + Username string `json:"username"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cloudserviceconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cloudserviceconfiguration.go new file mode 100644 index 000000000000..79a293aaf9c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cloudserviceconfiguration.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudServiceConfiguration struct { + OsFamily string `json:"osFamily"` + OsVersion *string `json:"osVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_computenodeidentityreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_computenodeidentityreference.go new file mode 100644 index 000000000000..5d061039b761 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_computenodeidentityreference.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeNodeIdentityReference struct { + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerconfiguration.go new file mode 100644 index 000000000000..976a955be924 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerconfiguration.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerConfiguration struct { + ContainerImageNames *[]string `json:"containerImageNames,omitempty"` + ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` + Type ContainerType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerregistry.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerregistry.go new file mode 100644 index 000000000000..cc4b521ecad4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerregistry.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerRegistry struct { + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` + Password *string `json:"password,omitempty"` + RegistryServer *string `json:"registryServer,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_datadisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_datadisk.go new file mode 100644 index 000000000000..8daa4484cbe1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_datadisk.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisk struct { + Caching *CachingType `json:"caching,omitempty"` + DiskSizeGB int64 `json:"diskSizeGB"` + Lun int64 `json:"lun"` + StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_deploymentconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_deploymentconfiguration.go new file mode 100644 index 000000000000..281f83d139e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_deploymentconfiguration.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentConfiguration struct { + CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` + VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diffdisksettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diffdisksettings.go new file mode 100644 index 000000000000..4a6b0aabfb27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diffdisksettings.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diskencryptionconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diskencryptionconfiguration.go new file mode 100644 index 000000000000..b25a376a8cd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diskencryptionconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionConfiguration struct { + Targets *[]DiskEncryptionTarget `json:"targets,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_environmentsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_environmentsetting.go new file mode 100644 index 000000000000..6248e4aee953 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_environmentsetting.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvironmentSetting struct { + Name string `json:"name"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_fixedscalesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_fixedscalesettings.go new file mode 100644 index 000000000000..291d31fac894 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_fixedscalesettings.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FixedScaleSettings struct { + NodeDeallocationOption *ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + TargetDedicatedNodes *int64 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int64 `json:"targetLowPriorityNodes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_imagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_imagereference.go new file mode 100644 index 000000000000..a0f7751f75f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_imagereference.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_inboundnatpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_inboundnatpool.go new file mode 100644 index 000000000000..317ae85fa22d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_inboundnatpool.go @@ -0,0 +1,13 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InboundNatPool struct { + BackendPort int64 `json:"backendPort"` + FrontendPortRangeEnd int64 `json:"frontendPortRangeEnd"` + FrontendPortRangeStart int64 `json:"frontendPortRangeStart"` + Name string `json:"name"` + NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` + Protocol InboundEndpointProtocol `json:"protocol"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_linuxuserconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_linuxuserconfiguration.go new file mode 100644 index 000000000000..60148fc3cf40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_linuxuserconfiguration.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxUserConfiguration struct { + Gid *int64 `json:"gid,omitempty"` + SshPrivateKey *string `json:"sshPrivateKey,omitempty"` + Uid *int64 `json:"uid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_metadataitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_metadataitem.go new file mode 100644 index 000000000000..88e584f88289 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_metadataitem.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MetadataItem struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_mountconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_mountconfiguration.go new file mode 100644 index 000000000000..699e78d963f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_mountconfiguration.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MountConfiguration struct { + AzureBlobFileSystemConfiguration *AzureBlobFileSystemConfiguration `json:"azureBlobFileSystemConfiguration,omitempty"` + AzureFileShareConfiguration *AzureFileShareConfiguration `json:"azureFileShareConfiguration,omitempty"` + CifsMountConfiguration *CIFSMountConfiguration `json:"cifsMountConfiguration,omitempty"` + NfsMountConfiguration *NFSMountConfiguration `json:"nfsMountConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networkconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networkconfiguration.go new file mode 100644 index 000000000000..d168a8e09601 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networkconfiguration.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkConfiguration struct { + DynamicVNetAssignmentScope *DynamicVNetAssignmentScope `json:"dynamicVNetAssignmentScope,omitempty"` + EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` + PublicIPAddressConfiguration *PublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networksecuritygrouprule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networksecuritygrouprule.go new file mode 100644 index 000000000000..5b3416320869 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networksecuritygrouprule.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkSecurityGroupRule struct { + Access NetworkSecurityGroupRuleAccess `json:"access"` + Priority int64 `json:"priority"` + SourceAddressPrefix string `json:"sourceAddressPrefix"` + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nfsmountconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nfsmountconfiguration.go new file mode 100644 index 000000000000..7b4bac563c54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nfsmountconfiguration.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NFSMountConfiguration struct { + MountOptions *string `json:"mountOptions,omitempty"` + RelativeMountPath string `json:"relativeMountPath"` + Source string `json:"source"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nodeplacementconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nodeplacementconfiguration.go new file mode 100644 index 000000000000..5b3284e1b91a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nodeplacementconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodePlacementConfiguration struct { + Policy *NodePlacementPolicyType `json:"policy,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_osdisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_osdisk.go new file mode 100644 index 000000000000..684e70a79be7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_osdisk.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDisk struct { + EphemeralOSDiskSettings *DiffDiskSettings `json:"ephemeralOSDiskSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_pool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_pool.go new file mode 100644 index 000000000000..99a23f134df7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_pool.go @@ -0,0 +1,17 @@ +package pool + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Pool struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.UserAssignedMap `json:"identity,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PoolProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolendpointconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolendpointconfiguration.go new file mode 100644 index 000000000000..bb6db6ef74c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolendpointconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolEndpointConfiguration struct { + InboundNatPools []InboundNatPool `json:"inboundNatPools"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolproperties.go new file mode 100644 index 000000000000..62a6368e2981 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolproperties.go @@ -0,0 +1,86 @@ +package pool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolProperties struct { + AllocationState *AllocationState `json:"allocationState,omitempty"` + AllocationStateTransitionTime *string `json:"allocationStateTransitionTime,omitempty"` + ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` + ApplicationPackages *[]ApplicationPackageReference `json:"applicationPackages,omitempty"` + AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` + Certificates *[]CertificateReference `json:"certificates,omitempty"` + CreationTime *string `json:"creationTime,omitempty"` + CurrentDedicatedNodes *int64 `json:"currentDedicatedNodes,omitempty"` + CurrentLowPriorityNodes *int64 `json:"currentLowPriorityNodes,omitempty"` + DeploymentConfiguration *DeploymentConfiguration `json:"deploymentConfiguration,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + InterNodeCommunication *InterNodeCommunicationState `json:"interNodeCommunication,omitempty"` + LastModified *string `json:"lastModified,omitempty"` + Metadata *[]MetadataItem `json:"metadata,omitempty"` + MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + ProvisioningState *PoolProvisioningState `json:"provisioningState,omitempty"` + ProvisioningStateTransitionTime *string `json:"provisioningStateTransitionTime,omitempty"` + ResizeOperationStatus *ResizeOperationStatus `json:"resizeOperationStatus,omitempty"` + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` + StartTask *StartTask `json:"startTask,omitempty"` + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + TaskSlotsPerNode *int64 `json:"taskSlotsPerNode,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} + +func (o *PoolProperties) GetAllocationStateTransitionTimeAsTime() (*time.Time, error) { + if o.AllocationStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.AllocationStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetAllocationStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.AllocationStateTransitionTime = &formatted +} + +func (o *PoolProperties) GetCreationTimeAsTime() (*time.Time, error) { + if o.CreationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetCreationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationTime = &formatted +} + +func (o *PoolProperties) GetLastModifiedAsTime() (*time.Time, error) { + if o.LastModified == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetLastModifiedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModified = &formatted +} + +func (o *PoolProperties) GetProvisioningStateTransitionTimeAsTime() (*time.Time, error) { + if o.ProvisioningStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetProvisioningStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningStateTransitionTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_publicipaddressconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_publicipaddressconfiguration.go new file mode 100644 index 000000000000..99001d0826f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_publicipaddressconfiguration.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressConfiguration struct { + IPAddressIds *[]string `json:"ipAddressIds,omitempty"` + Provision *IPAddressProvisioningType `json:"provision,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeerror.go new file mode 100644 index 000000000000..9b6eee87fdce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeerror.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResizeError struct { + Code string `json:"code"` + Details *[]ResizeError `json:"details,omitempty"` + Message string `json:"message"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeoperationstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeoperationstatus.go new file mode 100644 index 000000000000..b4ac9148d0ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeoperationstatus.go @@ -0,0 +1,31 @@ +package pool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResizeOperationStatus struct { + Errors *[]ResizeError `json:"errors,omitempty"` + NodeDeallocationOption *ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + StartTime *string `json:"startTime,omitempty"` + TargetDedicatedNodes *int64 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int64 `json:"targetLowPriorityNodes,omitempty"` +} + +func (o *ResizeOperationStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ResizeOperationStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resourcefile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resourcefile.go new file mode 100644 index 000000000000..9eddccfb1ede --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resourcefile.go @@ -0,0 +1,14 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceFile struct { + AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` + BlobPrefix *string `json:"blobPrefix,omitempty"` + FileMode *string `json:"fileMode,omitempty"` + FilePath *string `json:"filePath,omitempty"` + HTTPUrl *string `json:"httpUrl,omitempty"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` + StorageContainerUrl *string `json:"storageContainerUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_scalesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_scalesettings.go new file mode 100644 index 000000000000..afed1acf1962 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_scalesettings.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleSettings struct { + AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` + FixedScale *FixedScaleSettings `json:"fixedScale,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_starttask.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_starttask.go new file mode 100644 index 000000000000..6846c81fcb7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_starttask.go @@ -0,0 +1,14 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartTask struct { + CommandLine *string `json:"commandLine,omitempty"` + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + MaxTaskRetryCount *int64 `json:"maxTaskRetryCount,omitempty"` + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + WaitForSuccess *bool `json:"waitForSuccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskcontainersettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskcontainersettings.go new file mode 100644 index 000000000000..36ba77fadaef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskcontainersettings.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TaskContainerSettings struct { + ContainerRunOptions *string `json:"containerRunOptions,omitempty"` + ImageName string `json:"imageName"` + Registry *ContainerRegistry `json:"registry,omitempty"` + WorkingDirectory *ContainerWorkingDirectory `json:"workingDirectory,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskschedulingpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskschedulingpolicy.go new file mode 100644 index 000000000000..ad42b99fa048 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskschedulingpolicy.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TaskSchedulingPolicy struct { + NodeFillType ComputeNodeFillType `json:"nodeFillType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useraccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useraccount.go new file mode 100644 index 000000000000..e22af08ada54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useraccount.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAccount struct { + ElevationLevel *ElevationLevel `json:"elevationLevel,omitempty"` + LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` + Name string `json:"name"` + Password string `json:"password"` + WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useridentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useridentity.go new file mode 100644 index 000000000000..89ef2a53df9a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useridentity.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserIdentity struct { + AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` + UserName *string `json:"userName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_virtualmachineconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_virtualmachineconfiguration.go new file mode 100644 index 000000000000..400299687e95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_virtualmachineconfiguration.go @@ -0,0 +1,17 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineConfiguration struct { + ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` + Extensions *[]VmExtension `json:"extensions,omitempty"` + ImageReference ImageReference `json:"imageReference"` + LicenseType *string `json:"licenseType,omitempty"` + NodeAgentSkuId string `json:"nodeAgentSkuId"` + NodePlacementConfiguration *NodePlacementConfiguration `json:"nodePlacementConfiguration,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_vmextension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_vmextension.go new file mode 100644 index 000000000000..d6ebfb722262 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_vmextension.go @@ -0,0 +1,15 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VmExtension struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + Name string `json:"name"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + Publisher string `json:"publisher"` + Settings *interface{} `json:"settings,omitempty"` + Type string `json:"type"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsconfiguration.go new file mode 100644 index 000000000000..f3f44236405e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsuserconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsuserconfiguration.go new file mode 100644 index 000000000000..f977e22b75a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsuserconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsUserConfiguration struct { + LoginMode *LoginMode `json:"loginMode,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/predicates.go new file mode 100644 index 000000000000..6cf6b55ad296 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/predicates.go @@ -0,0 +1,29 @@ +package pool + +type PoolOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p PoolOperationPredicate) Matches(input Pool) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/version.go new file mode 100644 index 000000000000..d55c9a892b61 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/version.go @@ -0,0 +1,12 @@ +package pool + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/pool/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customdomain.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customdomain.go index 4126d8a65a3e..aeab69111fc9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customdomain.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customdomain.go @@ -5,6 +5,6 @@ package containerapps type CustomDomain struct { BindingType *BindingType `json:"bindingType,omitempty"` - CertificateId string `json:"certificateId"` + CertificateId *string `json:"certificateId,omitempty"` Name string `json:"name"` } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/enums.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/enums.go index c94257960c6d..8c94cefd9fa2 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/enums.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/enums.go @@ -254,6 +254,8 @@ func PossibleApplicationGatewayRuleSetStatusOptionsValues() []ApplicationGateway type ApplicationGatewaySkuName string const ( + // ApplicationGatewaySkuNameStandardBasic ... + ApplicationGatewaySkuNameStandardBasic ApplicationGatewaySkuName = "Standard_Basic" // ApplicationGatewaySkuNameStandardLarge ... ApplicationGatewaySkuNameStandardLarge ApplicationGatewaySkuName = "Standard_Large" // ApplicationGatewaySkuNameStandardMedium ... @@ -272,7 +274,7 @@ const ( // PossibleApplicationGatewaySkuNameValues returns an array of possible values for the ApplicationGatewaySkuName const type. func PossibleApplicationGatewaySkuNameValues() []ApplicationGatewaySkuName { - return []ApplicationGatewaySkuName{ApplicationGatewaySkuNameStandardLarge, ApplicationGatewaySkuNameStandardMedium, ApplicationGatewaySkuNameStandardSmall, ApplicationGatewaySkuNameStandardV2, ApplicationGatewaySkuNameWAFLarge, ApplicationGatewaySkuNameWAFMedium, ApplicationGatewaySkuNameWAFV2} + return []ApplicationGatewaySkuName{ApplicationGatewaySkuNameStandardBasic, ApplicationGatewaySkuNameStandardLarge, ApplicationGatewaySkuNameStandardMedium, ApplicationGatewaySkuNameStandardSmall, ApplicationGatewaySkuNameStandardV2, ApplicationGatewaySkuNameWAFLarge, ApplicationGatewaySkuNameWAFMedium, ApplicationGatewaySkuNameWAFV2} } // ApplicationGatewaySslCipherSuite enumerates the values for application gateway ssl cipher suite. @@ -405,6 +407,8 @@ type ApplicationGatewayTier string const ( // ApplicationGatewayTierStandard ... ApplicationGatewayTierStandard ApplicationGatewayTier = "Standard" + // ApplicationGatewayTierStandardBasic ... + ApplicationGatewayTierStandardBasic ApplicationGatewayTier = "Standard_Basic" // ApplicationGatewayTierStandardV2 ... ApplicationGatewayTierStandardV2 ApplicationGatewayTier = "Standard_v2" // ApplicationGatewayTierWAF ... @@ -415,7 +419,7 @@ const ( // PossibleApplicationGatewayTierValues returns an array of possible values for the ApplicationGatewayTier const type. func PossibleApplicationGatewayTierValues() []ApplicationGatewayTier { - return []ApplicationGatewayTier{ApplicationGatewayTierStandard, ApplicationGatewayTierStandardV2, ApplicationGatewayTierWAF, ApplicationGatewayTierWAFV2} + return []ApplicationGatewayTier{ApplicationGatewayTierStandard, ApplicationGatewayTierStandardBasic, ApplicationGatewayTierStandardV2, ApplicationGatewayTierWAF, ApplicationGatewayTierWAFV2} } // ApplicationGatewayTierTypes enumerates the values for application gateway tier types. diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/models.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/models.go index 3280d91703a9..b93702df32d5 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/models.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/models.go @@ -5494,9 +5494,9 @@ func (agrrpf ApplicationGatewayRoutingRulePropertiesFormat) MarshalJSON() ([]byt // ApplicationGatewaySku SKU of an application gateway. type ApplicationGatewaySku struct { - // Name - Name of an application gateway SKU. Possible values include: 'ApplicationGatewaySkuNameStandardSmall', 'ApplicationGatewaySkuNameStandardMedium', 'ApplicationGatewaySkuNameStandardLarge', 'ApplicationGatewaySkuNameWAFMedium', 'ApplicationGatewaySkuNameWAFLarge', 'ApplicationGatewaySkuNameStandardV2', 'ApplicationGatewaySkuNameWAFV2' + // Name - Name of an application gateway SKU. Possible values include: 'ApplicationGatewaySkuNameStandardSmall', 'ApplicationGatewaySkuNameStandardMedium', 'ApplicationGatewaySkuNameStandardLarge', 'ApplicationGatewaySkuNameWAFMedium', 'ApplicationGatewaySkuNameWAFLarge', 'ApplicationGatewaySkuNameStandardV2', 'ApplicationGatewaySkuNameStandardBasic', 'ApplicationGatewaySkuNameWAFV2' Name ApplicationGatewaySkuName `json:"name,omitempty"` - // Tier - Tier of an application gateway. Possible values include: 'ApplicationGatewayTierStandard', 'ApplicationGatewayTierWAF', 'ApplicationGatewayTierStandardV2', 'ApplicationGatewayTierWAFV2' + // Tier - Tier of an application gateway. Possible values include: 'ApplicationGatewayTierStandard', 'ApplicationGatewayTierWAF', 'ApplicationGatewayTierStandardV2', 'ApplicationGatewayTierWAFV2', 'ApplicationGatewayTierStandardBasic' Tier ApplicationGatewayTier `json:"tier,omitempty"` // Capacity - Capacity (instance count) of an application gateway. Capacity *int32 `json:"capacity,omitempty"` @@ -46396,7 +46396,7 @@ type SystemData struct { LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. + // LastModifiedAt - The timestamp of resource last modification (UTC) LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go index 3574a9982d9b..9051a72992c5 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go @@ -58,7 +58,8 @@ func (client ActionsClient) CreateOrUpdate(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: action, Constraints: []validation.Constraint{{Target: "action.ActionRequestProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "action.ActionRequestProperties.TriggerURI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -155,7 +156,8 @@ func (client ActionsClient) Delete(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ActionsClient", "Delete", err.Error()) } @@ -246,7 +248,8 @@ func (client ActionsClient) Get(ctx context.Context, resourceGroupName string, w {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ActionsClient", "Get", err.Error()) } @@ -337,7 +340,8 @@ func (client ActionsClient) ListByAlertRule(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ActionsClient", "ListByAlertRule", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go index ecb335a72198..acfb5d14279f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go @@ -57,7 +57,8 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -149,7 +150,8 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "Delete", err.Error()) } @@ -238,7 +240,8 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "Get", err.Error()) } @@ -327,7 +330,8 @@ func (client AlertRulesClient) List(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go index 4a0b22266619..3168e2792245 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go @@ -57,7 +57,8 @@ func (client AlertRuleTemplatesClient) Get(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRuleTemplatesClient", "Get", err.Error()) } @@ -146,7 +147,8 @@ func (client AlertRuleTemplatesClient) List(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRuleTemplatesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go index 76a6dde89db3..439472b9150b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go @@ -57,7 +57,8 @@ func (client AutomationRulesClient) CreateOrUpdate(ctx context.Context, resource {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: automationRuleToUpsert, Constraints: []validation.Constraint{{Target: "automationRuleToUpsert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties", Name: validation.Null, Rule: true, @@ -170,7 +171,8 @@ func (client AutomationRulesClient) Delete(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AutomationRulesClient", "Delete", err.Error()) } @@ -260,7 +262,8 @@ func (client AutomationRulesClient) Get(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AutomationRulesClient", "Get", err.Error()) } @@ -349,7 +352,8 @@ func (client AutomationRulesClient) List(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AutomationRulesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go index ccd87a14634d..969bf0878bb5 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go @@ -57,7 +57,8 @@ func (client BookmarkClient) Expand(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkClient", "Expand", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go index a008c74cbae2..b9b2d7b2b71b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go @@ -59,7 +59,8 @@ func (client BookmarkRelationsClient) CreateOrUpdate(ctx context.Context, resour {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: relation, Constraints: []validation.Constraint{{Target: "relation.RelationProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "relation.RelationProperties.RelatedResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,7 +157,8 @@ func (client BookmarkRelationsClient) Delete(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkRelationsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client BookmarkRelationsClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkRelationsClient", "Get", err.Error()) } @@ -344,7 +347,8 @@ func (client BookmarkRelationsClient) List(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkRelationsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go index 1bb2ba7d5cf6..1f2afce2a31d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go @@ -57,7 +57,8 @@ func (client BookmarksClient) CreateOrUpdate(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: bookmark, Constraints: []validation.Constraint{{Target: "bookmark.BookmarkProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "bookmark.BookmarkProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -154,7 +155,8 @@ func (client BookmarksClient) Delete(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarksClient", "Delete", err.Error()) } @@ -243,7 +245,8 @@ func (client BookmarksClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarksClient", "Get", err.Error()) } @@ -332,7 +335,8 @@ func (client BookmarksClient) List(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarksClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go index 49f47deb7985..6824770c4439 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go @@ -57,7 +57,8 @@ func (client DataConnectorsClient) Connect(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Connect", err.Error()) } @@ -149,7 +150,8 @@ func (client DataConnectorsClient) CreateOrUpdate(ctx context.Context, resourceG {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "CreateOrUpdate", err.Error()) } @@ -241,7 +243,8 @@ func (client DataConnectorsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Delete", err.Error()) } @@ -330,7 +333,8 @@ func (client DataConnectorsClient) Disconnect(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Disconnect", err.Error()) } @@ -419,7 +423,8 @@ func (client DataConnectorsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Get", err.Error()) } @@ -508,7 +513,8 @@ func (client DataConnectorsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go index ba2798ed418d..f8e33b4cb5d8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go @@ -58,7 +58,8 @@ func (client DataConnectorsCheckRequirementsClient) Post(ctx context.Context, re {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsCheckRequirementsClient", "Post", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go index b35a88feea9c..eb2e020a22ac 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go @@ -57,7 +57,8 @@ func (client EntitiesClient) Expand(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "Expand", err.Error()) } @@ -149,7 +150,8 @@ func (client EntitiesClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "Get", err.Error()) } @@ -240,7 +242,8 @@ func (client EntitiesClient) GetInsights(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { @@ -334,7 +337,8 @@ func (client EntitiesClient) List(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "List", err.Error()) } @@ -465,7 +469,8 @@ func (client EntitiesClient) Queries(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "Queries", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go index 988cc44891f1..7e6680321e40 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go @@ -58,7 +58,8 @@ func (client EntitiesGetTimelineClient) List(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go index 20210c17f049..5b2f4f7f4cd1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go @@ -63,7 +63,8 @@ func (client EntitiesRelationsClient) List(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesRelationsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go index 18ccbf723d7d..7ecede43f569 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go @@ -57,7 +57,8 @@ func (client EntityQueriesClient) CreateOrUpdate(ctx context.Context, resourceGr {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "CreateOrUpdate", err.Error()) } @@ -149,7 +150,8 @@ func (client EntityQueriesClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "Delete", err.Error()) } @@ -238,7 +240,8 @@ func (client EntityQueriesClient) Get(ctx context.Context, resourceGroupName str {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "Get", err.Error()) } @@ -328,7 +331,8 @@ func (client EntityQueriesClient) List(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go index 5f275741ca09..cca782f8ecc1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go @@ -58,7 +58,8 @@ func (client EntityQueryTemplatesClient) Get(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueryTemplatesClient", "Get", err.Error()) } @@ -148,7 +149,8 @@ func (client EntityQueryTemplatesClient) List(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueryTemplatesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go index c6bfe5324823..7b96da2cb8a1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go @@ -57,7 +57,8 @@ func (client EntityRelationsClient) GetRelation(ctx context.Context, resourceGro {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityRelationsClient", "GetRelation", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go index ed5dd6d56863..a7e2fcd9f1be 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go @@ -57,7 +57,8 @@ func (client FileImportsClient) Create(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: fileImport, Constraints: []validation.Constraint{{Target: "fileImport.FileImportProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "fileImport.FileImportProperties.ImportFile", Name: validation.Null, Rule: true, Chain: nil}, @@ -154,7 +155,8 @@ func (client FileImportsClient) Delete(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.FileImportsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client FileImportsClient) Get(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.FileImportsClient", "Get", err.Error()) } @@ -342,7 +345,8 @@ func (client FileImportsClient) List(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.FileImportsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go index 30d6ef2e9824..ba64cf9448cb 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go @@ -59,7 +59,8 @@ func (client IncidentCommentsClient) CreateOrUpdate(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: incidentComment, Constraints: []validation.Constraint{{Target: "incidentComment.IncidentCommentProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "incidentComment.IncidentCommentProperties.Message", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,7 +157,8 @@ func (client IncidentCommentsClient) Delete(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentCommentsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client IncidentCommentsClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentCommentsClient", "Get", err.Error()) } @@ -344,7 +347,8 @@ func (client IncidentCommentsClient) List(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentCommentsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go index 6b128d12ab5a..a9f35b79b267 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go @@ -59,7 +59,8 @@ func (client IncidentRelationsClient) CreateOrUpdate(ctx context.Context, resour {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: relation, Constraints: []validation.Constraint{{Target: "relation.RelationProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "relation.RelationProperties.RelatedResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,7 +157,8 @@ func (client IncidentRelationsClient) Delete(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentRelationsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client IncidentRelationsClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentRelationsClient", "Get", err.Error()) } @@ -344,7 +347,8 @@ func (client IncidentRelationsClient) List(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentRelationsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go index df163efdbabe..1cd65ce68742 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go @@ -57,7 +57,8 @@ func (client IncidentsClient) CreateOrUpdate(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: incident, Constraints: []validation.Constraint{{Target: "incident.IncidentProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "incident.IncidentProperties.Title", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -154,7 +155,8 @@ func (client IncidentsClient) CreateTeam(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: teamProperties, Constraints: []validation.Constraint{{Target: "teamProperties.TeamName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "CreateTeam", err.Error()) @@ -248,7 +250,8 @@ func (client IncidentsClient) Delete(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "Delete", err.Error()) } @@ -337,7 +340,8 @@ func (client IncidentsClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "Get", err.Error()) } @@ -432,7 +436,8 @@ func (client IncidentsClient) List(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "List", err.Error()) } @@ -575,7 +580,8 @@ func (client IncidentsClient) ListAlerts(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "ListAlerts", err.Error()) } @@ -665,7 +671,8 @@ func (client IncidentsClient) ListBookmarks(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "ListBookmarks", err.Error()) } @@ -755,7 +762,8 @@ func (client IncidentsClient) ListEntities(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "ListEntities", err.Error()) } @@ -844,7 +852,8 @@ func (client IncidentsClient) RunPlaybook(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: requestBody, Constraints: []validation.Constraint{{Target: "requestBody", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "requestBody.LogicAppsResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go index 7a84b31846c6..e2f8e490417c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go @@ -57,7 +57,8 @@ func (client MetadataClient) Create(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: metadata, Constraints: []validation.Constraint{{Target: "metadata.MetadataProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "metadata.MetadataProperties.ParentID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -152,7 +153,8 @@ func (client MetadataClient) Delete(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "Delete", err.Error()) } @@ -241,7 +243,8 @@ func (client MetadataClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "Get", err.Error()) } @@ -335,7 +338,8 @@ func (client MetadataClient) List(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "List", err.Error()) } @@ -479,7 +483,8 @@ func (client MetadataClient) Update(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "Update", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go index aaceee26fba6..509889613336 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go @@ -56,7 +56,8 @@ func (client OfficeConsentsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.OfficeConsentsClient", "Delete", err.Error()) } @@ -145,7 +146,8 @@ func (client OfficeConsentsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.OfficeConsentsClient", "Get", err.Error()) } @@ -234,7 +236,8 @@ func (client OfficeConsentsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.OfficeConsentsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go index 991f6325f1c9..14408f6a3034 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go @@ -56,7 +56,8 @@ func (client ProductSettingsClient) Delete(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "Delete", err.Error()) } @@ -145,7 +146,8 @@ func (client ProductSettingsClient) Get(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "Get", err.Error()) } @@ -234,7 +236,8 @@ func (client ProductSettingsClient) List(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "List", err.Error()) } @@ -324,7 +327,8 @@ func (client ProductSettingsClient) Update(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "Update", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go index edd5c17fefb8..03055c5e185a 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go @@ -59,7 +59,8 @@ func (client SecurityMLAnalyticsSettingsClient) CreateOrUpdate(ctx context.Conte {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "CreateOrUpdate", err.Error()) } @@ -151,7 +152,8 @@ func (client SecurityMLAnalyticsSettingsClient) Delete(ctx context.Context, reso {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "Delete", err.Error()) } @@ -240,7 +242,8 @@ func (client SecurityMLAnalyticsSettingsClient) Get(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "Get", err.Error()) } @@ -329,7 +332,8 @@ func (client SecurityMLAnalyticsSettingsClient) List(ctx context.Context, resour {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go index 6c44b57a1521..a54a84dc0257 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go @@ -59,7 +59,8 @@ func (client SentinelOnboardingStatesClient) Create(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Create", err.Error()) } @@ -154,7 +155,8 @@ func (client SentinelOnboardingStatesClient) Delete(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Delete", err.Error()) } @@ -243,7 +245,8 @@ func (client SentinelOnboardingStatesClient) Get(ctx context.Context, resourceGr {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Get", err.Error()) } @@ -332,7 +335,8 @@ func (client SentinelOnboardingStatesClient) List(ctx context.Context, resourceG {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go index 6ea98127a0f3..8fd853f2a69b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go @@ -56,7 +56,8 @@ func (client SourceControlClient) ListRepositories(ctx context.Context, resource {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlClient", "ListRepositories", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go index 0348103a0c7b..a4c67f46d3f2 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go @@ -57,7 +57,8 @@ func (client SourceControlsClient) Create(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: sourceControl, Constraints: []validation.Constraint{{Target: "sourceControl.SourceControlProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "sourceControl.SourceControlProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -155,7 +156,8 @@ func (client SourceControlsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlsClient", "Delete", err.Error()) } @@ -244,7 +246,8 @@ func (client SourceControlsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlsClient", "Get", err.Error()) } @@ -333,7 +336,8 @@ func (client SourceControlsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go index 8fb42b8a2c63..45c4508b391d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go @@ -59,7 +59,8 @@ func (client ThreatIntelligenceIndicatorClient) AppendTags(ctx context.Context, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "AppendTags", err.Error()) } @@ -151,7 +152,8 @@ func (client ThreatIntelligenceIndicatorClient) Create(ctx context.Context, reso {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Create", err.Error()) } @@ -243,7 +245,8 @@ func (client ThreatIntelligenceIndicatorClient) CreateIndicator(ctx context.Cont {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "CreateIndicator", err.Error()) } @@ -334,7 +337,8 @@ func (client ThreatIntelligenceIndicatorClient) Delete(ctx context.Context, reso {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Delete", err.Error()) } @@ -423,7 +427,8 @@ func (client ThreatIntelligenceIndicatorClient) Get(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Get", err.Error()) } @@ -513,7 +518,8 @@ func (client ThreatIntelligenceIndicatorClient) QueryIndicators(ctx context.Cont {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "QueryIndicators", err.Error()) } @@ -647,7 +653,8 @@ func (client ThreatIntelligenceIndicatorClient) ReplaceTags(ctx context.Context, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "ReplaceTags", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go index ac6349065ad0..0295e0c500f7 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go @@ -58,7 +58,8 @@ func (client ThreatIntelligenceIndicatorMetricsClient) List(ctx context.Context, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorMetricsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go index 9ce52e6e9b9b..478d354734a8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go @@ -63,7 +63,8 @@ func (client ThreatIntelligenceIndicatorsClient) List(ctx context.Context, resou {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go index 30e332992b79..3df50cfbb88c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go @@ -58,7 +58,8 @@ func (client WatchlistItemsClient) CreateOrUpdate(ctx context.Context, resourceG {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: watchlistItem, Constraints: []validation.Constraint{{Target: "watchlistItem.WatchlistItemProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "watchlistItem.WatchlistItemProperties.ItemsKeyValue", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -155,7 +156,8 @@ func (client WatchlistItemsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistItemsClient", "Delete", err.Error()) } @@ -246,7 +248,8 @@ func (client WatchlistItemsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistItemsClient", "Get", err.Error()) } @@ -340,7 +343,8 @@ func (client WatchlistItemsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistItemsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go index 10ba05d3b58b..219cdfda5d23 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go @@ -61,7 +61,8 @@ func (client WatchlistsClient) CreateOrUpdate(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: watchlist, Constraints: []validation.Constraint{{Target: "watchlist.WatchlistProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "watchlist.WatchlistProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -159,7 +160,8 @@ func (client WatchlistsClient) Delete(ctx context.Context, resourceGroupName str {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistsClient", "Delete", err.Error()) } @@ -248,7 +250,8 @@ func (client WatchlistsClient) Get(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistsClient", "Get", err.Error()) } @@ -340,7 +343,8 @@ func (client WatchlistsClient) List(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistsClient", "List", err.Error()) } diff --git a/vendor/modules.txt b/vendor/modules.txt index f6f4e2892e86..2c612a12986e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -6,7 +6,6 @@ github.com/Azure/azure-sdk-for-go/services/advisor/mgmt/2020-01-01/advisor github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch -github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb @@ -163,7 +162,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/resourceproviders github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20230204.1161343 +# github.com/hashicorp/go-azure-sdk v0.20230208.1165725 ## explicit; go 1.19 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview @@ -194,6 +193,10 @@ github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skus github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/deployments github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice @@ -724,7 +727,7 @@ github.com/tombuildsstuff/giovanni/storage/accesscontrol github.com/tombuildsstuff/giovanni/storage/internal/endpoints github.com/tombuildsstuff/giovanni/storage/internal/metadata github.com/tombuildsstuff/giovanni/version -# github.com/tombuildsstuff/kermit v0.20221207.1110610 +# github.com/tombuildsstuff/kermit v0.20230208.1135849 ## explicit; go 1.18 github.com/tombuildsstuff/kermit/sdk/appplatform/2022-11-01-preview/appplatform github.com/tombuildsstuff/kermit/sdk/compute/2022-08-01/compute