diff --git a/internal/services/containers/client/client.go b/internal/services/containers/client/client.go index 39101e66f4c7..8fb1162dfdc6 100644 --- a/internal/services/containers/client/client.go +++ b/internal/services/containers/client/client.go @@ -1,7 +1,8 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" + legacy "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice" legacyacr "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry" "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry" @@ -13,7 +14,7 @@ import ( type Client struct { AgentPoolsClient *containerservice.AgentPoolsClient ContainerRegistryAgentPoolsClient *containerregistry.AgentPoolsClient - GroupsClient *containerinstance.ContainerGroupsClient + ContainerInstanceClient *containerinstance.ContainerInstanceClient KubernetesClustersClient *containerservice.ManagedClustersClient MaintenanceConfigurationsClient *containerservice.MaintenanceConfigurationsClient RegistriesClient *containerregistry.RegistriesClient @@ -50,8 +51,8 @@ func NewClient(o *common.ClientOptions) *Client { tasksClient := legacyacr.NewTasksClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&tasksClient.Client, o.ResourceManagerAuthorizer) - groupsClient := containerinstance.NewContainerGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&groupsClient.Client, o.ResourceManagerAuthorizer) + containerInstanceClient := containerinstance.NewContainerInstanceClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&containerInstanceClient.Client, o.ResourceManagerAuthorizer) // AKS kubernetesClustersClient := containerservice.NewManagedClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) @@ -73,7 +74,7 @@ func NewClient(o *common.ClientOptions) *Client { AgentPoolsClient: &agentPoolsClient, ContainerRegistryAgentPoolsClient: ®istryAgentPoolsClient, KubernetesClustersClient: &kubernetesClustersClient, - GroupsClient: &groupsClient, + ContainerInstanceClient: &containerInstanceClient, MaintenanceConfigurationsClient: &maintenanceConfigurationsClient, RegistriesClient: ®istriesClient, WebhooksClient: &webhooksClient, diff --git a/internal/services/containers/container_group_data_source.go b/internal/services/containers/container_group_data_source.go index 00cf207bb797..4df21b832c1f 100644 --- a/internal/services/containers/container_group_data_source.go +++ b/internal/services/containers/container_group_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceContainerGroup() *pluginsdk.Resource { @@ -44,22 +44,22 @@ func dataSourceContainerGroup() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } func dataSourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := containerinstance.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ContainerGroupsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -67,16 +67,20 @@ func dataSourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) e } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ContainerGroupName) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ContainerGroupProperties; props != nil { - if address := props.IPAddress; address != nil { - d.Set("ip_address", address.IP) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + props := model.Properties + if address := props.IpAddress; address != nil { + d.Set("ip_address", address.Ip) d.Set("fqdn", address.Fqdn) } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/containers/container_group_resource.go b/internal/services/containers/container_group_resource.go index b52e43fbd1a2..a30d9734acd6 100644 --- a/internal/services/containers/container_group_resource.go +++ b/internal/services/containers/container_group_resource.go @@ -8,25 +8,27 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceContainerGroup() *pluginsdk.Resource { @@ -36,7 +38,7 @@ func resourceContainerGroup() *pluginsdk.Resource { Delete: resourceContainerGroupDelete, Update: resourceContainerGroupUpdate, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ContainerGroupID(id) + _, err := containerinstance.ParseContainerGroupID(id) return err }), @@ -55,18 +57,18 @@ func resourceContainerGroup() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, - "location": azure.SchemaLocation(), + "location": commonschema.Location(), - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "ip_address_type": { Type: pluginsdk.TypeString, Optional: true, - Default: string(containerinstance.ContainerGroupIPAddressTypePublic), + Default: string(containerinstance.ContainerGroupIpAddressTypePublic), ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(containerinstance.ContainerGroupIPAddressTypePublic), - string(containerinstance.ContainerGroupIPAddressTypePrivate), + string(containerinstance.ContainerGroupIpAddressTypePublic), + string(containerinstance.ContainerGroupIpAddressTypePrivate), "None", }, false), }, @@ -122,7 +124,7 @@ func resourceContainerGroup() *pluginsdk.Resource { "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), "restart_policy": { Type: pluginsdk.TypeString, @@ -607,30 +609,29 @@ func containerVolumeSchema() *pluginsdk.Schema { } func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := containerinstance.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.ContainerGroupsGet(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_container_group", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) + location := location.Normalize(d.Get("location").(string)) OSType := d.Get("os_type").(string) IPAddressType := d.Get("ip_address_type").(string) - t := d.Get("tags").(map[string]interface{}) - restartPolicy := d.Get("restart_policy").(string) + restartPolicy := containerinstance.ContainerGroupRestartPolicy(d.Get("restart_policy").(string)) diagnosticsRaw := d.Get("diagnostics").([]interface{}) diagnostics := expandContainerGroupDiagnostics(diagnosticsRaw) dnsConfig := d.Get("dns_config").([]interface{}) @@ -652,25 +653,25 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e } containerGroup := containerinstance.ContainerGroup{ - Name: utils.String(id.Name), + Name: pointer.FromString(id.ContainerGroupName), Location: &location, - Tags: tags.Expand(t), - ContainerGroupProperties: &containerinstance.ContainerGroupProperties{ + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + Properties: containerinstance.ContainerGroupProperties{ InitContainers: initContainers, Containers: containers, Diagnostics: diagnostics, - RestartPolicy: containerinstance.ContainerGroupRestartPolicy(restartPolicy), + RestartPolicy: &restartPolicy, OsType: containerinstance.OperatingSystemTypes(OSType), Volumes: &containerGroupVolumes, ImageRegistryCredentials: expandContainerImageRegistryCredentials(d), - DNSConfig: expandContainerGroupDnsConfig(dnsConfig), + DnsConfig: expandContainerGroupDnsConfig(dnsConfig), }, } // Container Groups with OS Type Windows do not support managed identities but the API also does not accept Identity Type: None // https://github.com/Azure/azure-rest-api-specs/issues/18122 if OSType != string(containerinstance.OperatingSystemTypesWindows) { - expandedIdentity, err := expandContainerGroupIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -678,13 +679,13 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e } if IPAddressType != "None" { - containerGroup.ContainerGroupProperties.IPAddress = &containerinstance.IPAddress{ + containerGroup.Properties.IpAddress = &containerinstance.IpAddress{ Ports: containerGroupPorts, - Type: containerinstance.ContainerGroupIPAddressType(IPAddressType), + Type: containerinstance.ContainerGroupIpAddressType(IPAddressType), } if dnsNameLabel := d.Get("dns_name_label").(string); dnsNameLabel != "" { - containerGroup.ContainerGroupProperties.IPAddress.DNSNameLabel = &dnsNameLabel + containerGroup.Properties.IpAddress.DnsNameLabel = &dnsNameLabel } } @@ -701,8 +702,8 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e if strings.ToLower(OSType) != "linux" { return fmt.Errorf("Currently only Linux containers can be deployed to virtual networks") } - containerGroup.ContainerGroupProperties.NetworkProfile = &containerinstance.ContainerGroupNetworkProfile{ - ID: &networkProfileIDNorm, + containerGroup.Properties.NetworkProfile = &containerinstance.ContainerGroupNetworkProfile{ + Id: networkProfileIDNorm, } } @@ -711,20 +712,15 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e if err != nil { return fmt.Errorf("parsing Key Vault Key ID: %+v", err) } - containerGroup.ContainerGroupProperties.EncryptionProperties = &containerinstance.EncryptionProperties{ - VaultBaseURL: utils.String(keyId.KeyVaultBaseUrl), - KeyName: utils.String(keyId.Name), - KeyVersion: utils.String(keyId.Version), + containerGroup.Properties.EncryptionProperties = &containerinstance.EncryptionProperties{ + VaultBaseUrl: keyId.KeyVaultBaseUrl, + KeyName: keyId.Name, + KeyVersion: keyId.Version, } } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, containerGroup) - if err != nil { - return fmt.Errorf("creating/updating %s: %+v", id, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) + if err := client.ContainerGroupsCreateOrUpdateThenPoll(ctx, id, containerGroup); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -732,11 +728,11 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e } func resourceContainerGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ContainerGroupID(d.Id()) + id, err := containerinstance.ParseContainerGroupID(d.Id()) if err != nil { return err } @@ -747,7 +743,7 @@ func resourceContainerGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) e Tags: tags.Expand(t), } - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.ContainerGroupsUpdate(ctx, *id, parameters); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } @@ -755,18 +751,18 @@ func resourceContainerGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) e } func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ContainerGroupID(d.Id()) + id, err := containerinstance.ParseContainerGroupID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ContainerGroupsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -774,26 +770,29 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err return err } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("name", id.ContainerGroupName) + d.Set("resource_group_name", id.ResourceGroupName) - identity, err := flattenContainerGroupIdentity(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 { + d.Set("location", location.NormalizeNilable(model.Location)) + identity, err := identity.FlattenSystemAndUserAssignedMap(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 err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } - if props := resp.ContainerGroupProperties; props != nil { - containerConfigs := flattenContainerGroupContainers(d, resp.Containers, props.Volumes) + props := model.Properties + containerConfigs := flattenContainerGroupContainers(d, &props.Containers, props.Volumes) if err := d.Set("container", containerConfigs); err != nil { return fmt.Errorf("setting `container`: %+v", err) } - initContainerConfigs := flattenContainerGroupInitContainers(d, resp.InitContainers, props.Volumes) + initContainerConfigs := flattenContainerGroupInitContainers(d, props.InitContainers, props.Volumes) if err := d.Set("init_container", initContainerConfigs); err != nil { return fmt.Errorf("setting `init_container`: %+v", err) } @@ -802,21 +801,26 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("setting `image_registry_credential`: %+v", err) } - if address := props.IPAddress; address != nil { + if address := props.IpAddress; address != nil { d.Set("ip_address_type", address.Type) - d.Set("ip_address", address.IP) - exposedPorts := make([]interface{}, len(*resp.ContainerGroupProperties.IPAddress.Ports)) - for i := range *resp.ContainerGroupProperties.IPAddress.Ports { - exposedPorts[i] = (*resp.ContainerGroupProperties.IPAddress.Ports)[i] + d.Set("ip_address", address.Ip) + exposedPorts := make([]interface{}, len(address.Ports)) + for i := range address.Ports { + exposedPorts[i] = (address.Ports)[i] } d.Set("exposed_port", flattenPorts(exposedPorts)) - d.Set("dns_name_label", address.DNSNameLabel) + d.Set("dns_name_label", address.DnsNameLabel) d.Set("fqdn", address.Fqdn) } - d.Set("restart_policy", string(props.RestartPolicy)) + restartPolicy := "" + if props.RestartPolicy != nil { + restartPolicy = string(*props.RestartPolicy) + } + d.Set("restart_policy", restartPolicy) + d.Set("os_type", string(props.OsType)) - d.Set("dns_config", flattenContainerGroupDnsConfig(resp.DNSConfig)) + d.Set("dns_config", flattenContainerGroupDnsConfig(props.DnsConfig)) if err := d.Set("diagnostics", flattenContainerGroupDiagnostics(d, props.Diagnostics)); err != nil { return fmt.Errorf("setting `diagnostics`: %+v", err) @@ -824,19 +828,17 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err if kvProps := props.EncryptionProperties; kvProps != nil { var keyVaultUri, keyName, keyVersion string - if kvProps.VaultBaseURL != nil && *kvProps.VaultBaseURL != "" { - keyVaultUri = *kvProps.VaultBaseURL + if kvProps.VaultBaseUrl != "" { + keyVaultUri = kvProps.VaultBaseUrl } else { return fmt.Errorf("empty value returned for Key Vault URI") } - if kvProps.KeyName != nil && *kvProps.KeyName != "" { - keyName = *kvProps.KeyName + if kvProps.KeyName != "" { + keyName = kvProps.KeyName } else { return fmt.Errorf("empty value returned for Key Vault Key Name") } - if kvProps.KeyVersion != nil { - keyVersion = *kvProps.KeyVersion - } + keyVersion = kvProps.KeyVersion keyId, err := keyVaultParse.NewNestedItemID(keyVaultUri, "keys", keyName, keyVersion) if err != nil { return err @@ -845,7 +847,7 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func flattenPorts(ports []interface{}) *pluginsdk.Set { @@ -855,15 +857,19 @@ func flattenPorts(ports []interface{}) *pluginsdk.Set { port := make(map[string]interface{}) switch t := p.(type) { case containerinstance.Port: - if v := t.Port; v != nil { - port["port"] = int(*v) + port["port"] = int(t.Port) + proto := "" + if t.Protocol != nil { + proto = string(*t.Protocol) } - port["protocol"] = string(t.Protocol) + port["protocol"] = proto case containerinstance.ContainerPort: - if v := t.Port; v != nil { - port["port"] = int(*v) + port["port"] = int(t.Port) + proto := "" + if t.Protocol != nil { + proto = string(*t.Protocol) } - port["protocol"] = string(t.Protocol) + port["protocol"] = proto } flatPorts = append(flatPorts, port) } @@ -873,35 +879,35 @@ func flattenPorts(ports []interface{}) *pluginsdk.Set { } func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ContainerGroupID(d.Id()) + id, err := containerinstance.ParseContainerGroupID(d.Id()) if err != nil { return err } networkProfileId := "" - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.ContainerGroupsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { // already deleted return nil } - return fmt.Errorf("retrieving Container Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %q: %+v", id, err) } - if props := existing.ContainerGroupProperties; props != nil { + if model := existing.Model; model != nil { + props := model.Properties if profile := props.NetworkProfile; profile != nil { - if profile.ID != nil { - id, err := networkParse.NetworkProfileID(*profile.ID) - if err != nil { - return err - } - networkProfileId = id.ID() + id, err := networkParse.NetworkProfileID(profile.Id) + if err != nil { + return err } + networkProfileId = id.ID() + // Avoid parallel deletion if "network_profile_id" is given. (not sure whether this is necessary) // See: https://github.com/hashicorp/terraform-provider-azurerm/issues/15025 locks.ByID(networkProfileId) @@ -909,12 +915,8 @@ func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) e } } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting Container Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of Container Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err := client.ContainerGroupsDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %q: %+v", id, err) } if networkProfileId != "" { @@ -925,11 +927,11 @@ func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) e } // TODO: remove when https://github.com/Azure/azure-sdk-for-go/issues/5082 has been fixed - log.Printf("[DEBUG] Waiting for Container Group %q (Resource Group %q) to be finish deleting", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %q to be finish deleting", id) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Attached"}, Target: []string{"Detached"}, - Refresh: containerGroupEnsureDetachedFromNetworkProfileRefreshFunc(ctx, networkProfileClient, networkProfileId.ResourceGroup, networkProfileId.Name, id.ResourceGroup, id.Name), + Refresh: containerGroupEnsureDetachedFromNetworkProfileRefreshFunc(ctx, networkProfileClient, networkProfileId.ResourceGroup, networkProfileId.Name, id.ResourceGroupName, id.ContainerGroupName), MinTimeout: 15 * time.Second, ContinuousTargetOccurence: 5, Timeout: d.Timeout(pluginsdk.TimeoutDelete), @@ -937,7 +939,7 @@ func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) e } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Container Group %q (Resource Group %q) to finish deleting: %s", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %q to finish deleting: %s", id, err) } } @@ -963,16 +965,16 @@ func containerGroupEnsureDetachedFromNetworkProfileRefreshFunc(ctx context.Conte continue } - parsedId, err := parse.ContainerGroupID(*nicProps.Container.ID) + parsedId, err := containerinstance.ParseContainerGroupID(*nicProps.Container.ID) if err != nil { return nil, "", err } - if parsedId.ResourceGroup != containerResourceGroupName { + if parsedId.ResourceGroupName != containerResourceGroupName { continue } - if parsedId.Name == "" || parsedId.Name != containerName { + if parsedId.ContainerGroupName == "" || parsedId.ContainerGroupName != containerName { continue } @@ -1001,9 +1003,9 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir image := data["image"].(string) container := containerinstance.InitContainerDefinition{ - Name: utils.String(name), - InitContainerPropertiesDefinition: &containerinstance.InitContainerPropertiesDefinition{ - Image: utils.String(image), + Name: name, + Properties: containerinstance.InitContainerPropertiesDefinition{ + Image: pointer.FromString(image), }, } @@ -1025,7 +1027,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir *envVars = append(*envVars, *secEnvVars...) // Set both secure and non secure environment variables - container.EnvironmentVariables = envVars + container.Properties.EnvironmentVariables = envVars if v, ok := data["commands"]; ok { c := v.([]interface{}) @@ -1034,7 +1036,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir command = append(command, v.(string)) } - container.Command = &command + container.Properties.Command = &command } if v, ok := data["volume"]; ok { @@ -1042,7 +1044,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir if err != nil { return nil, nil, err } - container.VolumeMounts = volumeMounts + container.Properties.VolumeMounts = volumeMounts expandedContainerGroupVolumes, err := expandContainerVolume(v, addedEmptyDirs, containerGroupVolumes) if err != nil { @@ -1057,7 +1059,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir return &containers, containerGroupVolumes, nil } -func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs map[string]bool) (*[]containerinstance.Container, *[]containerinstance.Port, []containerinstance.Volume, error) { +func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs map[string]bool) ([]containerinstance.Container, []containerinstance.Port, []containerinstance.Volume, error) { containersConfig := d.Get("container").([]interface{}) containers := make([]containerinstance.Container, 0) containerInstancePorts := make([]containerinstance.Port, 0) @@ -1073,13 +1075,13 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma memory := data["memory"].(float64) container := containerinstance.Container{ - Name: utils.String(name), - ContainerProperties: &containerinstance.ContainerProperties{ - Image: utils.String(image), - Resources: &containerinstance.ResourceRequirements{ - Requests: &containerinstance.ResourceRequests{ - MemoryInGB: utils.Float(memory), - CPU: utils.Float(cpu), + Name: name, + Properties: containerinstance.ContainerProperties{ + Image: image, + Resources: containerinstance.ResourceRequirements{ + Requests: containerinstance.ResourceRequests{ + MemoryInGB: memory, + Cpu: cpu, }, }, }, @@ -1096,10 +1098,10 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma gpuSku := containerinstance.GpuSku(v["sku"].(string)) gpus := containerinstance.GpuResource{ - Count: &gpuCount, + Count: int64(gpuCount), Sku: gpuSku, } - container.Resources.Requests.Gpu = &gpus + container.Properties.Resources.Requests.Gpu = &gpus } } @@ -1110,7 +1112,7 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma if !(cpuLimit == 0.0 && memLimit == 0.0 && len(gpuLimit) == 0) { limits := &containerinstance.ResourceLimits{} if cpuLimit != 0.0 { - limits.CPU = &cpuLimit + limits.Cpu = &cpuLimit } if memLimit != 0.0 { limits.MemoryInGB = &memLimit @@ -1118,14 +1120,14 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma if len(gpuLimit) == 1 && gpuLimit[0] != nil { v := gpuLimit[0].(map[string]interface{}) limits.Gpu = &containerinstance.GpuResource{} - if v := int32(v["count"].(int)); v != 0 { - limits.Gpu.Count = &v + if v := int64(v["count"].(int)); v != 0 { + limits.Gpu.Count = v } if v := containerinstance.GpuSku(v["sku"].(string)); v != "" { limits.Gpu.Sku = v } } - container.Resources.Limits = limits + container.Properties.Resources.Limits = limits } if v, ok := data["ports"].(*pluginsdk.Set); ok && len(v.List()) > 0 { @@ -1133,19 +1135,21 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma for _, v := range v.List() { portObj := v.(map[string]interface{}) - port := int32(portObj["port"].(int)) + port := int64(portObj["port"].(int)) proto := portObj["protocol"].(string) + containerProtocol := containerinstance.ContainerNetworkProtocol(proto) ports = append(ports, containerinstance.ContainerPort{ - Port: &port, - Protocol: containerinstance.ContainerNetworkProtocol(proto), + Port: port, + Protocol: &containerProtocol, }) + groupProtocol := containerinstance.ContainerGroupNetworkProtocol(proto) containerInstancePorts = append(containerInstancePorts, containerinstance.Port{ - Port: &port, - Protocol: containerinstance.ContainerGroupNetworkProtocol(proto), + Port: port, + Protocol: &groupProtocol, }) } - container.Ports = &ports + container.Properties.Ports = &ports } // Set both sensitive and non-secure environment variables @@ -1166,7 +1170,7 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma *envVars = append(*envVars, *secEnvVars...) // Set both secure and non secure environment variables - container.EnvironmentVariables = envVars + container.Properties.EnvironmentVariables = envVars if v, ok := data["commands"]; ok { c := v.([]interface{}) @@ -1175,7 +1179,7 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma command = append(command, v.(string)) } - container.Command = &command + container.Properties.Command = &command } if v, ok := data["volume"]; ok { @@ -1183,7 +1187,7 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma if err != nil { return nil, nil, nil, err } - container.VolumeMounts = volumeMounts + container.Properties.VolumeMounts = volumeMounts expandedContainerGroupVolumes, err := expandContainerVolume(v, addedEmptyDirs, containerGroupVolumes) if err != nil { @@ -1193,11 +1197,11 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma } if v, ok := data["liveness_probe"]; ok { - container.ContainerProperties.LivenessProbe = expandContainerProbe(v) + container.Properties.LivenessProbe = expandContainerProbe(v) } if v, ok := data["readiness_probe"]; ok { - container.ContainerProperties.ReadinessProbe = expandContainerProbe(v) + container.Properties.ReadinessProbe = expandContainerProbe(v) } containers = append(containers, container) @@ -1206,20 +1210,25 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma // Determine ports to be exposed on the group level, based on exposed_ports // and on what ports have been exposed on individual containers. if v, ok := d.Get("exposed_port").(*pluginsdk.Set); ok && len(v.List()) > 0 { - cgpMap := make(map[int32]map[containerinstance.ContainerGroupNetworkProtocol]bool) + cgpMap := make(map[int64]map[containerinstance.ContainerGroupNetworkProtocol]bool) for _, p := range containerInstancePorts { - if val, ok := cgpMap[*p.Port]; ok { - val[p.Protocol] = true - cgpMap[*p.Port] = val + if p.Protocol == nil { + continue + } + protocol := *p.Protocol + + if val, ok := cgpMap[p.Port]; ok { + val[protocol] = true + cgpMap[p.Port] = val } else { - protoMap := map[containerinstance.ContainerGroupNetworkProtocol]bool{p.Protocol: true} - cgpMap[*p.Port] = protoMap + protoMap := map[containerinstance.ContainerGroupNetworkProtocol]bool{protocol: true} + cgpMap[p.Port] = protoMap } } for _, p := range v.List() { portConfig := p.(map[string]interface{}) - port := int32(portConfig["port"].(int)) + port := int64(portConfig["port"].(int)) proto := portConfig["protocol"].(string) if !cgpMap[port][containerinstance.ContainerGroupNetworkProtocol(proto)] { return nil, nil, nil, fmt.Errorf("Port %d/%s is not exposed on any individual container in the container group.\n"+ @@ -1227,16 +1236,17 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma "and protocol. Any ports exposed on the container group must also be exposed on an individual container.", port, proto, port, proto) } + portProtocol := containerinstance.ContainerGroupNetworkProtocol(proto) containerGroupPorts = append(containerGroupPorts, containerinstance.Port{ - Port: &port, - Protocol: containerinstance.ContainerGroupNetworkProtocol(proto), + Port: port, + Protocol: &portProtocol, }) } } else { containerGroupPorts = containerInstancePorts // remove in 3.0 of the provider } - return &containers, &containerGroupPorts, containerGroupVolumes, nil + return containers, containerGroupPorts, containerGroupVolumes, nil } func expandContainerVolume(v interface{}, addedEmptyDirs map[string]bool, containerGroupVolumes []containerinstance.Volume) ([]containerinstance.Volume, error) { @@ -1247,12 +1257,12 @@ func expandContainerVolume(v interface{}, addedEmptyDirs map[string]bool, contai if containerVolumes != nil { for _, cgVol := range *containerVolumes { if cgVol.EmptyDir != nil { - if addedEmptyDirs[*cgVol.Name] { + if addedEmptyDirs[cgVol.Name] { // empty_dir-volumes are allowed to overlap across containers, in fact that is their primary purpose, // but the containerGroup must not declare same name of such volumes twice. continue } - addedEmptyDirs[*cgVol.Name] = true + addedEmptyDirs[cgVol.Name] = true } containerGroupVolumes = append(containerGroupVolumes, cgVol) } @@ -1267,8 +1277,8 @@ func expandContainerEnvironmentVariables(input interface{}, secure bool) *[]cont if secure { for k, v := range envVars { ev := containerinstance.EnvironmentVariable{ - Name: utils.String(k), - SecureValue: utils.String(v.(string)), + Name: k, + SecureValue: pointer.FromString(v.(string)), } output = append(output, ev) @@ -1276,8 +1286,8 @@ func expandContainerEnvironmentVariables(input interface{}, secure bool) *[]cont } else { for k, v := range envVars { ev := containerinstance.EnvironmentVariable{ - Name: utils.String(k), - Value: utils.String(v.(string)), + Name: k, + Value: pointer.FromString(v.(string)), } output = append(output, ev) @@ -1286,27 +1296,6 @@ func expandContainerEnvironmentVariables(input interface{}, secure bool) *[]cont return &output } -func expandContainerGroupIdentity(input []interface{}) (*containerinstance.ContainerGroupIdentity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := containerinstance.ContainerGroupIdentity{ - Type: containerinstance.ResourceIdentityType(string(expanded.Type)), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*containerinstance.ContainerGroupIdentityUserAssignedIdentitiesValue) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &containerinstance.ContainerGroupIdentityUserAssignedIdentitiesValue{ - // intentionally empty - } - } - } - - return &out, nil -} - func expandContainerImageRegistryCredentials(d *pluginsdk.ResourceData) *[]containerinstance.ImageRegistryCredential { credsRaw := d.Get("image_registry_credential").([]interface{}) if len(credsRaw) == 0 { @@ -1319,9 +1308,9 @@ func expandContainerImageRegistryCredentials(d *pluginsdk.ResourceData) *[]conta credConfig := c.(map[string]interface{}) output = append(output, containerinstance.ImageRegistryCredential{ - Server: utils.String(credConfig["server"].(string)), - Password: utils.String(credConfig["password"].(string)), - Username: utils.String(credConfig["username"].(string)), + Server: credConfig["server"].(string), + Password: pointer.FromString(credConfig["password"].(string)), + Username: credConfig["username"].(string), }) } @@ -1350,15 +1339,15 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume storageAccountKey := volumeConfig["storage_account_key"].(string) vm := containerinstance.VolumeMount{ - Name: utils.String(name), - MountPath: utils.String(mountPath), - ReadOnly: utils.Bool(readOnly), + Name: name, + MountPath: mountPath, + ReadOnly: pointer.FromBool(readOnly), } volumeMounts = append(volumeMounts, vm) cv := containerinstance.Volume{ - Name: utils.String(name), + Name: name, } secret := expandSecrets(volumeConfig["secret"].(map[string]interface{})) @@ -1370,7 +1359,8 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume if shareName != "" || storageAccountName != "" || storageAccountKey != "" || secret != nil || gitRepoVolume != nil { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") } - cv.EmptyDir = map[string]string{} + var m interface{} = map[string]string{} + cv.EmptyDir = &m case gitRepoVolume != nil: if shareName != "" || storageAccountName != "" || storageAccountKey != "" || secret != nil { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") @@ -1380,7 +1370,7 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume if shareName != "" || storageAccountName != "" || storageAccountKey != "" { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") } - cv.Secret = secret + cv.Secret = &secret default: if shareName == "" && storageAccountName == "" && storageAccountKey == "" { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") @@ -1388,10 +1378,10 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume return nil, nil, fmt.Errorf("when using a storage account volume, all of `share_name`, `storage_account_name`, `storage_account_key` must be specified") } cv.AzureFile = &containerinstance.AzureFileVolume{ - ShareName: utils.String(shareName), - ReadOnly: utils.Bool(readOnly), - StorageAccountName: utils.String(storageAccountName), - StorageAccountKey: utils.String(storageAccountKey), + ShareName: shareName, + ReadOnly: pointer.FromBool(readOnly), + StorageAccountName: storageAccountName, + StorageAccountKey: pointer.FromString(storageAccountKey), } } @@ -1407,25 +1397,25 @@ func expandGitRepoVolume(input []interface{}) *containerinstance.GitRepoVolume { } v := input[0].(map[string]interface{}) gitRepoVolume := &containerinstance.GitRepoVolume{ - Repository: utils.String(v["url"].(string)), + Repository: v["url"].(string), } if directory := v["directory"].(string); directory != "" { - gitRepoVolume.Directory = utils.String(directory) + gitRepoVolume.Directory = pointer.FromString(directory) } if revision := v["revision"].(string); revision != "" { - gitRepoVolume.Revision = utils.String(revision) + gitRepoVolume.Revision = pointer.FromString(revision) } return gitRepoVolume } -func expandSecrets(secretsMap map[string]interface{}) map[string]*string { +func expandSecrets(secretsMap map[string]interface{}) map[string]string { if len(secretsMap) == 0 { return nil } - output := make(map[string]*string, len(secretsMap)) + output := make(map[string]string, len(secretsMap)) for name, value := range secretsMap { - output[name] = utils.String(value.(string)) + output[name] = value.(string) } return output @@ -1446,23 +1436,23 @@ func expandContainerProbe(input interface{}) *containerinstance.ContainerProbe { probeConfig := p.(map[string]interface{}) if v := probeConfig["initial_delay_seconds"].(int); v > 0 { - probe.InitialDelaySeconds = utils.Int32(int32(v)) + probe.InitialDelaySeconds = pointer.FromInt64(int64(v)) } if v := probeConfig["period_seconds"].(int); v > 0 { - probe.PeriodSeconds = utils.Int32(int32(v)) + probe.PeriodSeconds = pointer.FromInt64(int64(v)) } if v := probeConfig["failure_threshold"].(int); v > 0 { - probe.FailureThreshold = utils.Int32(int32(v)) + probe.FailureThreshold = pointer.FromInt64(int64(v)) } if v := probeConfig["success_threshold"].(int); v > 0 { - probe.SuccessThreshold = utils.Int32(int32(v)) + probe.SuccessThreshold = pointer.FromInt64(int64(v)) } if v := probeConfig["timeout_seconds"].(int); v > 0 { - probe.TimeoutSeconds = utils.Int32(int32(v)) + probe.TimeoutSeconds = pointer.FromInt64(int64(v)) } commands := probeConfig["exec"].([]interface{}) @@ -1485,10 +1475,11 @@ func expandContainerProbe(input interface{}) *containerinstance.ContainerProbe { port := x["port"].(int) scheme := x["scheme"].(string) - probe.HTTPGet = &containerinstance.ContainerHTTPGet{ - Path: utils.String(path), - Port: utils.Int32(int32(port)), - Scheme: containerinstance.Scheme(scheme), + httpGetScheme := containerinstance.Scheme(scheme) + probe.HttpGet = &containerinstance.ContainerHttpGet{ + Path: pointer.FromString(path), + Port: int64(port), + Scheme: &httpGetScheme, } } } @@ -1496,31 +1487,6 @@ func expandContainerProbe(input interface{}) *containerinstance.ContainerProbe { return &probe } -func flattenContainerGroupIdentity(input *containerinstance.ContainerGroupIdentity) (*[]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 flattenContainerImageRegistryCredentials(d *pluginsdk.ResourceData, input *[]containerinstance.ImageRegistryCredential) []interface{} { if input == nil { return nil @@ -1530,17 +1496,13 @@ func flattenContainerImageRegistryCredentials(d *pluginsdk.ResourceData, input * output := make([]interface{}, 0) for i, cred := range *input { credConfig := make(map[string]interface{}) - if cred.Server != nil { - credConfig["server"] = *cred.Server - } - if cred.Username != nil { - credConfig["username"] = *cred.Username - } + credConfig["server"] = cred.Server + credConfig["username"] = cred.Username if len(configsOld) > i { data := configsOld[i].(map[string]interface{}) oldServer := data["server"].(string) - if cred.Server != nil && *cred.Server == oldServer { + if cred.Server == oldServer { if v, ok := d.GetOk(fmt.Sprintf("image_registry_credential.%d.password", i)); ok { credConfig["password"] = v.(string) } @@ -1565,8 +1527,7 @@ func flattenContainerGroupInitContainers(d *pluginsdk.ResourceData, initContaine containerCfg := make([]interface{}, 0, len(*initContainers)) for _, container := range *initContainers { - // TODO fix this crash point - name := *container.Name + name := container.Name // get index from name index := nameIndexMap[name] @@ -1574,26 +1535,26 @@ func flattenContainerGroupInitContainers(d *pluginsdk.ResourceData, initContaine containerConfig := make(map[string]interface{}) containerConfig["name"] = name - if v := container.Image; v != nil { + if v := container.Properties.Image; v != nil { containerConfig["image"] = *v } - if container.EnvironmentVariables != nil { - if len(*container.EnvironmentVariables) > 0 { - containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, false, d, index) - containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, true, d, index) + if container.Properties.EnvironmentVariables != nil { + if len(*container.Properties.EnvironmentVariables) > 0 { + containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, false, d, index) + containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, true, d, index) } } commands := make([]string, 0) - if command := container.Command; command != nil { + if command := container.Properties.Command; command != nil { commands = *command } containerConfig["commands"] = commands - if containerGroupVolumes != nil && container.VolumeMounts != nil { + if containerGroupVolumes != nil && container.Properties.VolumeMounts != nil { containersConfigRaw := d.Get("container").([]interface{}) - flattenContainerVolume(containerConfig, containersConfigRaw, *container.Name, container.VolumeMounts, containerGroupVolumes) + flattenContainerVolume(containerConfig, containersConfigRaw, container.Name, container.Properties.VolumeMounts, containerGroupVolumes) } containerCfg = append(containerCfg, containerConfig) } @@ -1611,8 +1572,7 @@ func flattenContainerGroupContainers(d *pluginsdk.ResourceData, containers *[]co containerCfg := make([]interface{}, 0, len(*containers)) for _, container := range *containers { - // TODO fix this crash point - name := *container.Name + name := container.Name // get index from name index := nameIndexMap[name] @@ -1620,77 +1580,68 @@ func flattenContainerGroupContainers(d *pluginsdk.ResourceData, containers *[]co containerConfig := make(map[string]interface{}) containerConfig["name"] = name - if v := container.Image; v != nil { - containerConfig["image"] = *v - } + containerConfig["image"] = container.Properties.Image - if resources := container.Resources; resources != nil { - if resourceRequests := resources.Requests; resourceRequests != nil { - if v := resourceRequests.CPU; v != nil { - containerConfig["cpu"] = *v - } - if v := resourceRequests.MemoryInGB; v != nil { - containerConfig["memory"] = *v - } + resources := container.Properties.Resources + resourceRequests := resources.Requests + containerConfig["cpu"] = resourceRequests.Cpu + containerConfig["memory"] = resourceRequests.MemoryInGB - gpus := make([]interface{}, 0) - if v := resourceRequests.Gpu; v != nil { - gpu := make(map[string]interface{}) - if v.Count != nil { - gpu["count"] = *v.Count - } - gpu["sku"] = string(v.Sku) - gpus = append(gpus, gpu) - } - containerConfig["gpu"] = gpus + gpus := make([]interface{}, 0) + if v := resourceRequests.Gpu; v != nil { + gpu := make(map[string]interface{}) + gpu["count"] = v.Count + gpu["sku"] = string(v.Sku) + gpus = append(gpus, gpu) + } + containerConfig["gpu"] = gpus + + if resourceLimits := resources.Limits; resourceLimits != nil { + if v := resourceLimits.Cpu; v != nil { + containerConfig["cpu_limit"] = *v + } + if v := resourceLimits.MemoryInGB; v != nil { + containerConfig["memory_limit"] = *v } - if resourceLimits := resources.Limits; resourceLimits != nil { - if v := resourceLimits.CPU; v != nil { - containerConfig["cpu_limit"] = *v - } - if v := resourceLimits.MemoryInGB; v != nil { - containerConfig["memory_limit"] = *v - } - gpus := make([]interface{}, 0) - if v := resourceLimits.Gpu; v != nil { - gpu := make(map[string]interface{}) - if v.Count != nil { - gpu["count"] = *v.Count - } - gpu["sku"] = string(v.Sku) - gpus = append(gpus, gpu) - } - containerConfig["gpu_limit"] = gpus + gpus := make([]interface{}, 0) + if v := resourceLimits.Gpu; v != nil { + gpu := make(map[string]interface{}) + gpu["count"] = v.Count + gpu["sku"] = string(v.Sku) + gpus = append(gpus, gpu) } + containerConfig["gpu_limit"] = gpus } - containerPorts := make([]interface{}, len(*container.Ports)) - for i := range *container.Ports { - containerPorts[i] = (*container.Ports)[i] + containerPorts := make([]interface{}, len(*container.Properties.Ports)) + if container.Properties.Ports != nil { + for i := range *container.Properties.Ports { + containerPorts[i] = (*container.Properties.Ports)[i] + } } containerConfig["ports"] = flattenPorts(containerPorts) - if container.EnvironmentVariables != nil { - if len(*container.EnvironmentVariables) > 0 { - containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, false, d, index) - containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, true, d, index) + if container.Properties.EnvironmentVariables != nil { + if len(*container.Properties.EnvironmentVariables) > 0 { + containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, false, d, index) + containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, true, d, index) } } commands := make([]string, 0) - if command := container.Command; command != nil { + if command := container.Properties.Command; command != nil { commands = *command } containerConfig["commands"] = commands - if containerGroupVolumes != nil && container.VolumeMounts != nil { + if containerGroupVolumes != nil && container.Properties.VolumeMounts != nil { containersConfigRaw := d.Get("container").([]interface{}) - flattenContainerVolume(containerConfig, containersConfigRaw, *container.Name, container.VolumeMounts, containerGroupVolumes) + flattenContainerVolume(containerConfig, containersConfigRaw, container.Name, container.Properties.VolumeMounts, containerGroupVolumes) } - containerConfig["liveness_probe"] = flattenContainerProbes(container.LivenessProbe) - containerConfig["readiness_probe"] = flattenContainerProbes(container.ReadinessProbe) + containerConfig["liveness_probe"] = flattenContainerProbes(container.Properties.LivenessProbe) + containerConfig["readiness_probe"] = flattenContainerProbes(container.Properties.ReadinessProbe) containerCfg = append(containerCfg, containerConfig) } @@ -1722,12 +1673,8 @@ func flattenContainerVolume(containerConfig map[string]interface{}, containersCo for _, vm := range *volumeMounts { volumeConfig := make(map[string]interface{}) - if vm.Name != nil { - volumeConfig["name"] = *vm.Name - } - if vm.MountPath != nil { - volumeConfig["mount_path"] = *vm.MountPath - } + volumeConfig["name"] = vm.Name + volumeConfig["mount_path"] = vm.MountPath if vm.ReadOnly != nil { volumeConfig["read_only"] = *vm.ReadOnly } @@ -1736,18 +1683,10 @@ func flattenContainerVolume(containerConfig map[string]interface{}, containersCo // and use the data if containerGroupVolumes != nil { for _, cgv := range *containerGroupVolumes { - if cgv.Name == nil || vm.Name == nil { - continue - } - - if *cgv.Name == *vm.Name { + if cgv.Name == vm.Name { if file := cgv.AzureFile; file != nil { - if file.ShareName != nil { - volumeConfig["share_name"] = *file.ShareName - } - if file.StorageAccountName != nil { - volumeConfig["storage_account_name"] = *file.StorageAccountName - } + volumeConfig["share_name"] = file.ShareName + volumeConfig["storage_account_name"] = file.StorageAccountName // skip storage_account_key, is always nil } @@ -1766,7 +1705,7 @@ func flattenContainerVolume(containerConfig map[string]interface{}, containersCo for _, cvr := range *containerVolumesConfig { cv := cvr.(map[string]interface{}) rawName := cv["name"].(string) - if vm.Name != nil && *vm.Name == rawName { + if vm.Name == rawName { storageAccountKey := cv["storage_account_key"].(string) volumeConfig["storage_account_key"] = storageAccountKey volumeConfig["secret"] = cv["secret"] @@ -1789,16 +1728,16 @@ func flattenContainerEnvironmentVariables(input *[]containerinstance.Environment if isSecure { for _, envVar := range *input { - if envVar.Name != nil && envVar.Value == nil { - envVarValue := d.Get(fmt.Sprintf("container.%d.secure_environment_variables.%s", oldContainerIndex, *envVar.Name)) - output[*envVar.Name] = envVarValue + if envVar.Value == nil { + envVarValue := d.Get(fmt.Sprintf("container.%d.secure_environment_variables.%s", oldContainerIndex, envVar.Name)) + output[envVar.Name] = envVarValue } } } else { for _, envVar := range *input { - if envVar.Name != nil && envVar.Value != nil { - log.Printf("[DEBUG] NOT SECURE: Name: %s - Value: %s", *envVar.Name, *envVar.Value) - output[*envVar.Name] = *envVar.Value + if envVar.Value != nil { + log.Printf("[DEBUG] NOT SECURE: Name: %s - Value: %s", envVar.Name, *envVar.Value) + output[envVar.Name] = *envVar.Value } } } @@ -1817,9 +1756,7 @@ func flattenGitRepoVolume(input *containerinstance.GitRepoVolume) []interface{} if input.Revision != nil { revision = *input.Revision } - if input.Repository != nil { - repository = *input.Repository - } + repository = input.Repository return []interface{}{ map[string]interface{}{ "url": repository, @@ -1842,21 +1779,13 @@ func flattenContainerProbes(input *containerinstance.ContainerProbe) []interface } httpGets := make([]interface{}, 0) - if get := input.HTTPGet; get != nil { + if get := input.HttpGet; get != nil { httpGet := make(map[string]interface{}) - if v := get.Path; v != nil { httpGet["path"] = *v } - - if v := get.Port; v != nil { - httpGet["port"] = *v - } - - if get.Scheme != "" { - httpGet["scheme"] = get.Scheme - } - + httpGet["port"] = get.Port + httpGet["scheme"] = get.Scheme httpGets = append(httpGets, httpGet) } output["http_get"] = httpGets @@ -1899,21 +1828,22 @@ func expandContainerGroupDiagnostics(input []interface{}) *containerinstance.Con workspaceKey := analyticsV["workspace_key"].(string) logAnalytics := containerinstance.LogAnalytics{ - WorkspaceID: utils.String(workspaceId), - WorkspaceKey: utils.String(workspaceKey), + WorkspaceId: workspaceId, + WorkspaceKey: workspaceKey, } if logType := analyticsV["log_type"].(string); logType != "" { - logAnalytics.LogType = containerinstance.LogAnalyticsLogType(logType) + t := containerinstance.LogAnalyticsLogType(logType) + logAnalytics.LogType = &t metadataMap := analyticsV["metadata"].(map[string]interface{}) - metadata := make(map[string]*string) + metadata := make(map[string]string) for k, v := range metadataMap { strValue := v.(string) - metadata[k] = &strValue + metadata[k] = strValue } - logAnalytics.Metadata = metadata + logAnalytics.Metadata = &metadata } return &containerinstance.ContainerGroupDiagnostics{LogAnalytics: &logAnalytics} @@ -1929,17 +1859,20 @@ func flattenContainerGroupDiagnostics(d *pluginsdk.ResourceData, input *containe if la := input.LogAnalytics; la != nil { output := make(map[string]interface{}) - output["log_type"] = string(la.LogType) + logType := "" + if la.LogType != nil { + logType = string(*la.LogType) + } + output["log_type"] = logType metadata := make(map[string]interface{}) - for k, v := range la.Metadata { - metadata[k] = *v + if la.Metadata != nil { + for k, v := range *la.Metadata { + metadata[k] = v + } } output["metadata"] = metadata - - if la.WorkspaceID != nil { - output["workspace_id"] = *la.WorkspaceID - } + output["workspace_id"] = la.WorkspaceId // the existing config may not exist at Import time, protect against it. workspaceKey := "" @@ -1975,7 +1908,7 @@ func resourceContainerGroupPortsHash(v interface{}) int { return pluginsdk.HashString(buf.String()) } -func flattenContainerGroupDnsConfig(input *containerinstance.DNSConfiguration) []interface{} { +func flattenContainerGroupDnsConfig(input *containerinstance.DnsConfiguration) []interface{} { output := make(map[string]interface{}) if input == nil { @@ -1995,18 +1928,12 @@ func flattenContainerGroupDnsConfig(input *containerinstance.DNSConfiguration) [ options = strings.Fields(*input.Options) } output["options"] = options - - // Nameservers is already an array from the API - var nameservers []string - if input.NameServers != nil { - nameservers = *input.NameServers - } - output["nameservers"] = nameservers + output["nameservers"] = input.NameServers return []interface{}{output} } -func expandContainerGroupDnsConfig(input interface{}) *containerinstance.DNSConfiguration { +func expandContainerGroupDnsConfig(input interface{}) *containerinstance.DnsConfiguration { dnsConfigRaw := input.([]interface{}) if len(dnsConfigRaw) > 0 { config := dnsConfigRaw[0].(map[string]interface{}) @@ -2024,10 +1951,10 @@ func expandContainerGroupDnsConfig(input interface{}) *containerinstance.DNSConf searchDomains = append(searchDomains, v.(string)) } - return &containerinstance.DNSConfiguration{ - Options: utils.String(strings.Join(options, " ")), - SearchDomains: utils.String(strings.Join(searchDomains, " ")), - NameServers: &nameservers, + return &containerinstance.DnsConfiguration{ + Options: pointer.FromString(strings.Join(options, " ")), + SearchDomains: pointer.FromString(strings.Join(searchDomains, " ")), + NameServers: nameservers, } } diff --git a/internal/services/containers/container_group_resource_test.go b/internal/services/containers/container_group_resource_test.go index 9beb2be6a200..491aadb9308a 100644 --- a/internal/services/containers/container_group_resource_test.go +++ b/internal/services/containers/container_group_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -2277,17 +2278,21 @@ resource "azurerm_container_group" "test" { } func (t ContainerGroupResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ContainerGroupID(state.ID) + id, err := containerinstance.ParseContainerGroupID(state.ID) if err != nil { return nil, err } - resp, err := clients.Containers.GroupsClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.Containers.ContainerInstanceClient.ContainerGroupsGet(ctx, *id) if err != nil { return nil, fmt.Errorf("reading Container Group (%s): %+v", id.String(), err) } - return utils.Bool(resp.ID != nil), nil + if resp.Model == nil { + return nil, fmt.Errorf("unexpected nil model of %q", id) + } + + return utils.Bool(resp.Model.Id != nil), nil } func (ContainerGroupResource) withPrivateEmpty(data acceptance.TestData) string { diff --git a/internal/services/containers/parse/container_group.go b/internal/services/containers/parse/container_group.go deleted file mode 100644 index 8b531bdf208d..000000000000 --- a/internal/services/containers/parse/container_group.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 ContainerGroupId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewContainerGroupID(subscriptionId, resourceGroup, name string) ContainerGroupId { - return ContainerGroupId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ContainerGroupId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Container Group", segmentsStr) -} - -func (id ContainerGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ContainerGroupID parses a ContainerGroup ID into an ContainerGroupId struct -func ContainerGroupID(input string) (*ContainerGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ContainerGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("containerGroups"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/containers/parse/container_group_test.go b/internal/services/containers/parse/container_group_test.go deleted file mode 100644 index ef4fc13542b5..000000000000 --- a/internal/services/containers/parse/container_group_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 = ContainerGroupId{} - -func TestContainerGroupIDFormatter(t *testing.T) { - actual := NewContainerGroupID("12345678-1234-9876-4563-123456789012", "resGroup1", "containerGroup1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/containerGroups/containerGroup1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestContainerGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ContainerGroupId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/containerGroups/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/containerGroups/containerGroup1", - Expected: &ContainerGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "containerGroup1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CONTAINERINSTANCE/CONTAINERGROUPS/CONTAINERGROUP1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ContainerGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/containers/resourceids.go b/internal/services/containers/resourceids.go index de37bee4a54e..6e9486c55413 100644 --- a/internal/services/containers/resourceids.go +++ b/internal/services/containers/resourceids.go @@ -3,7 +3,6 @@ package containers //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name ContainerRegistryAgentPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerRegistry/registries/registry1/agentPools/agent_pool1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerService/managedClusters/cluster1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NodePool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerService/managedClusters/cluster1/agentPools/pool1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/containerGroups/containerGroup1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerRegistryScopeMap -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerRegistry/registries/registry1/scopeMaps/scopeMap1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerRegistryTask -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.ContainerRegistry/registries/registry1/tasks/task1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerRegistryToken -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerRegistry/registries/registry1/tokens/token1 diff --git a/internal/services/containers/validate/container_group_id.go b/internal/services/containers/validate/container_group_id.go deleted file mode 100644 index c767bc2a3342..000000000000 --- a/internal/services/containers/validate/container_group_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/containers/parse" -) - -func ContainerGroupID(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.ContainerGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/containers/validate/container_group_id_test.go b/internal/services/containers/validate/container_group_id_test.go deleted file mode 100644 index ce221c97e16f..000000000000 --- a/internal/services/containers/validate/container_group_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 TestContainerGroupID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/containerGroups/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/containerGroups/containerGroup1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CONTAINERINSTANCE/CONTAINERGROUPS/CONTAINERGROUP1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ContainerGroupID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json deleted file mode 100644 index 5bf1ae599a33..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "e9a6009d8f1a98656cf5b6f1fe5809251bfa0085", - "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", - "tag": "package-2021-03", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerinstance/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/containerinstance/mgmt/2021-03-01/containerinstance/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/client.go deleted file mode 100644 index 48ebb63f1463..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerinstance implements the Azure ARM Containerinstance service API version 2021-03-01. -// -// -package containerinstance - -// 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 Containerinstance - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerinstance. -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/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go deleted file mode 100644 index 24edd5e539a7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go +++ /dev/null @@ -1,844 +0,0 @@ -package containerinstance - -// 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" -) - -// ContainerGroupsClient is the client for the ContainerGroups methods of the Containerinstance service. -type ContainerGroupsClient struct { - BaseClient -} - -// NewContainerGroupsClient creates an instance of the ContainerGroupsClient client. -func NewContainerGroupsClient(subscriptionID string) ContainerGroupsClient { - return NewContainerGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContainerGroupsClientWithBaseURI creates an instance of the ContainerGroupsClient 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 NewContainerGroupsClientWithBaseURI(baseURI string, subscriptionID string) ContainerGroupsClient { - return ContainerGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update container groups with specified configurations. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerGroup - the properties of the container group to be created or updated. -func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup ContainerGroup) (result ContainerGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: containerGroup, - Constraints: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Containers", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.IPAddress", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.IPAddress.Ports", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "containerGroup.ContainerGroupProperties.Diagnostics", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics.WorkspaceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics.WorkspaceKey", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "containerGroup.ContainerGroupProperties.NetworkProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.NetworkProfile.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "containerGroup.ContainerGroupProperties.DNSConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.DNSConfig.NameServers", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.VaultBaseURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.KeyName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.KeyVersion", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerinstance.ContainerGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerGroupName, containerGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup ContainerGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), - autorest.WithJSON(containerGroup), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified container group in the specified subscription and resource group. The operation does not -// delete other resources provided by the user, such as volumes. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Delete(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ContainerGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", 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 ContainerGroupsClient) DeleteSender(req *http.Request) (future ContainerGroupsDeleteFuture, 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 ContainerGroupsClient) DeleteResponder(resp *http.Response) (result ContainerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the properties of the specified container group in the specified subscription and resource group. The -// operation returns the properties of each container group including containers, image registry credentials, restart -// policy, IP address type, OS type, state, and volumes. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Get(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ContainerGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", 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 ContainerGroupsClient) 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 ContainerGroupsClient) GetResponder(resp *http.Response) (result ContainerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get a list of container groups in the specified subscription. This operation returns properties of each -// container group including containers, image registry credentials, restart policy, IP address type, OS type, state, -// and volumes. -func (client ContainerGroupsClient) List(ctx context.Context) (result ContainerGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.List") - defer func() { - sc := -1 - if result.cglr.Response.Response != nil { - sc = result.cglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", resp, "Failure sending request") - return - } - - result.cglr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", resp, "Failure responding to request") - return - } - if result.cglr.hasNextLink() && result.cglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ContainerGroupsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups", 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 ContainerGroupsClient) 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 ContainerGroupsClient) ListResponder(resp *http.Response) (result ContainerGroupListResult, 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 ContainerGroupsClient) listNextResults(ctx context.Context, lastResults ContainerGroupListResult) (result ContainerGroupListResult, err error) { - req, err := lastResults.containerGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "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, "containerinstance.ContainerGroupsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContainerGroupsClient) ListComplete(ctx context.Context) (result ContainerGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup get a list of container groups in a specified subscription and resource group. This operation -// returns properties of each container group including containers, image registry credentials, restart policy, IP -// address type, OS type, state, and volumes. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ContainerGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.cglr.Response.Response != nil { - sc = result.cglr.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, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.cglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.cglr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.cglr.hasNextLink() && result.cglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ContainerGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups", 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 ContainerGroupsClient) 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 ContainerGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ContainerGroupListResult, 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 ContainerGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ContainerGroupListResult) (result ContainerGroupListResult, err error) { - req, err := lastResults.containerGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "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, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContainerGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ContainerGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.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 -} - -// Restart restarts all containers in a container group in place. If container image has updates, new image will be -// downloaded. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsRestartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Restart") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RestartPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = client.RestartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Start starts all containers in a container group. Compute resources will be allocated and billing will start. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Start(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ContainerGroupsClient) StartPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) StartSender(req *http.Request) (future ContainerGroupsStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stops all containers in a container group. Compute resources will be deallocated and billing will stop. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Stop(ctx context.Context, resourceGroupName string, containerGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Stop") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StopPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ContainerGroupsClient) StopPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) StopResponder(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 container group tags with specified values. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// resource - the container group resource with just the tags to be updated. -func (client ContainerGroupsClient) Update(ctx context.Context, resourceGroupName string, containerGroupName string, resource Resource) (result ContainerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, containerGroupName, resource) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ContainerGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, containerGroupName string, resource Resource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - resource.ID = nil - resource.Name = nil - resource.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), - autorest.WithJSON(resource), - 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 ContainerGroupsClient) 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 ContainerGroupsClient) UpdateResponder(resp *http.Response) (result ContainerGroup, 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/containerinstance/mgmt/2021-03-01/containerinstance/containers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containers.go deleted file mode 100644 index 8fbdcba24fbc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containers.go +++ /dev/null @@ -1,280 +0,0 @@ -package containerinstance - -// 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" -) - -// ContainersClient is the client for the Containers methods of the Containerinstance service. -type ContainersClient struct { - BaseClient -} - -// NewContainersClient creates an instance of the ContainersClient client. -func NewContainersClient(subscriptionID string) ContainersClient { - return NewContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContainersClientWithBaseURI creates an instance of the ContainersClient 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 NewContainersClientWithBaseURI(baseURI string, subscriptionID string) ContainersClient { - return ContainersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Attach attach to the output stream of a specific container instance in a specified resource group and container -// group. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerName - the name of the container instance. -func (client ContainersClient) Attach(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string) (result ContainerAttachResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.Attach") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AttachPreparer(ctx, resourceGroupName, containerGroupName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", nil, "Failure preparing request") - return - } - - resp, err := client.AttachSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", resp, "Failure sending request") - return - } - - result, err = client.AttachResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", resp, "Failure responding to request") - return - } - - return -} - -// AttachPreparer prepares the Attach request. -func (client ContainersClient) AttachPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AttachSender sends the Attach request. The method will close the -// http.Response Body if it receives an error. -func (client ContainersClient) AttachSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AttachResponder handles the response to the Attach request. The method always -// closes the http.Response Body. -func (client ContainersClient) AttachResponder(resp *http.Response) (result ContainerAttachResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ExecuteCommand executes a command for a specific container instance in a specified resource group and container -// group. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerName - the name of the container instance. -// containerExecRequest - the request for the exec command. -func (client ContainersClient) ExecuteCommand(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, containerExecRequest ContainerExecRequest) (result ContainerExecResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ExecuteCommand") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecuteCommandPreparer(ctx, resourceGroupName, containerGroupName, containerName, containerExecRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteCommandSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", resp, "Failure sending request") - return - } - - result, err = client.ExecuteCommandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", resp, "Failure responding to request") - return - } - - return -} - -// ExecuteCommandPreparer prepares the ExecuteCommand request. -func (client ContainersClient) ExecuteCommandPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, containerExecRequest ContainerExecRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec", pathParameters), - autorest.WithJSON(containerExecRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteCommandSender sends the ExecuteCommand request. The method will close the -// http.Response Body if it receives an error. -func (client ContainersClient) ExecuteCommandSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteCommandResponder handles the response to the ExecuteCommand request. The method always -// closes the http.Response Body. -func (client ContainersClient) ExecuteCommandResponder(resp *http.Response) (result ContainerExecResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListLogs get the logs for a specified container instance in a specified resource group and container group. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerName - the name of the container instance. -// tail - the number of lines to show from the tail of the container instance log. If not provided, all -// available logs are shown up to 4mb. -// timestamps - if true, adds a timestamp at the beginning of every line of log output. If not provided, -// defaults to false. -func (client ContainersClient) ListLogs(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, tail *int32, timestamps *bool) (result Logs, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ListLogs") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListLogsPreparer(ctx, resourceGroupName, containerGroupName, containerName, tail, timestamps) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", nil, "Failure preparing request") - return - } - - resp, err := client.ListLogsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", resp, "Failure sending request") - return - } - - result, err = client.ListLogsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", resp, "Failure responding to request") - return - } - - return -} - -// ListLogsPreparer prepares the ListLogs request. -func (client ContainersClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, tail *int32, timestamps *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if tail != nil { - queryParameters["tail"] = autorest.Encode("query", *tail) - } - if timestamps != nil { - queryParameters["timestamps"] = autorest.Encode("query", *timestamps) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLogsSender sends the ListLogs request. The method will close the -// http.Response Body if it receives an error. -func (client ContainersClient) ListLogsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLogsResponder handles the response to the ListLogs request. The method always -// closes the http.Response Body. -func (client ContainersClient) ListLogsResponder(resp *http.Response) (result Logs, 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/containerinstance/mgmt/2021-03-01/containerinstance/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/enums.go deleted file mode 100644 index 9396340601e8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/enums.go +++ /dev/null @@ -1,180 +0,0 @@ -package containerinstance - -// 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. - -// ContainerGroupIPAddressType enumerates the values for container group ip address type. -type ContainerGroupIPAddressType string - -const ( - // ContainerGroupIPAddressTypePrivate ... - ContainerGroupIPAddressTypePrivate ContainerGroupIPAddressType = "Private" - // ContainerGroupIPAddressTypePublic ... - ContainerGroupIPAddressTypePublic ContainerGroupIPAddressType = "Public" -) - -// PossibleContainerGroupIPAddressTypeValues returns an array of possible values for the ContainerGroupIPAddressType const type. -func PossibleContainerGroupIPAddressTypeValues() []ContainerGroupIPAddressType { - return []ContainerGroupIPAddressType{ContainerGroupIPAddressTypePrivate, ContainerGroupIPAddressTypePublic} -} - -// ContainerGroupNetworkProtocol enumerates the values for container group network protocol. -type ContainerGroupNetworkProtocol string - -const ( - // ContainerGroupNetworkProtocolTCP ... - ContainerGroupNetworkProtocolTCP ContainerGroupNetworkProtocol = "TCP" - // ContainerGroupNetworkProtocolUDP ... - ContainerGroupNetworkProtocolUDP ContainerGroupNetworkProtocol = "UDP" -) - -// PossibleContainerGroupNetworkProtocolValues returns an array of possible values for the ContainerGroupNetworkProtocol const type. -func PossibleContainerGroupNetworkProtocolValues() []ContainerGroupNetworkProtocol { - return []ContainerGroupNetworkProtocol{ContainerGroupNetworkProtocolTCP, ContainerGroupNetworkProtocolUDP} -} - -// ContainerGroupRestartPolicy enumerates the values for container group restart policy. -type ContainerGroupRestartPolicy string - -const ( - // ContainerGroupRestartPolicyAlways ... - ContainerGroupRestartPolicyAlways ContainerGroupRestartPolicy = "Always" - // ContainerGroupRestartPolicyNever ... - ContainerGroupRestartPolicyNever ContainerGroupRestartPolicy = "Never" - // ContainerGroupRestartPolicyOnFailure ... - ContainerGroupRestartPolicyOnFailure ContainerGroupRestartPolicy = "OnFailure" -) - -// PossibleContainerGroupRestartPolicyValues returns an array of possible values for the ContainerGroupRestartPolicy const type. -func PossibleContainerGroupRestartPolicyValues() []ContainerGroupRestartPolicy { - return []ContainerGroupRestartPolicy{ContainerGroupRestartPolicyAlways, ContainerGroupRestartPolicyNever, ContainerGroupRestartPolicyOnFailure} -} - -// ContainerGroupSku enumerates the values for container group sku. -type ContainerGroupSku string - -const ( - // ContainerGroupSkuDedicated ... - ContainerGroupSkuDedicated ContainerGroupSku = "Dedicated" - // ContainerGroupSkuStandard ... - ContainerGroupSkuStandard ContainerGroupSku = "Standard" -) - -// PossibleContainerGroupSkuValues returns an array of possible values for the ContainerGroupSku const type. -func PossibleContainerGroupSkuValues() []ContainerGroupSku { - return []ContainerGroupSku{ContainerGroupSkuDedicated, ContainerGroupSkuStandard} -} - -// ContainerNetworkProtocol enumerates the values for container network protocol. -type ContainerNetworkProtocol string - -const ( - // ContainerNetworkProtocolTCP ... - ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP" - // ContainerNetworkProtocolUDP ... - ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP" -) - -// PossibleContainerNetworkProtocolValues returns an array of possible values for the ContainerNetworkProtocol const type. -func PossibleContainerNetworkProtocolValues() []ContainerNetworkProtocol { - return []ContainerNetworkProtocol{ContainerNetworkProtocolTCP, ContainerNetworkProtocolUDP} -} - -// GpuSku enumerates the values for gpu sku. -type GpuSku string - -const ( - // GpuSkuK80 ... - GpuSkuK80 GpuSku = "K80" - // GpuSkuP100 ... - GpuSkuP100 GpuSku = "P100" - // GpuSkuV100 ... - GpuSkuV100 GpuSku = "V100" -) - -// PossibleGpuSkuValues returns an array of possible values for the GpuSku const type. -func PossibleGpuSkuValues() []GpuSku { - return []GpuSku{GpuSkuK80, GpuSkuP100, GpuSkuV100} -} - -// LogAnalyticsLogType enumerates the values for log analytics log type. -type LogAnalyticsLogType string - -const ( - // LogAnalyticsLogTypeContainerInsights ... - LogAnalyticsLogTypeContainerInsights LogAnalyticsLogType = "ContainerInsights" - // LogAnalyticsLogTypeContainerInstanceLogs ... - LogAnalyticsLogTypeContainerInstanceLogs LogAnalyticsLogType = "ContainerInstanceLogs" -) - -// PossibleLogAnalyticsLogTypeValues returns an array of possible values for the LogAnalyticsLogType const type. -func PossibleLogAnalyticsLogTypeValues() []LogAnalyticsLogType { - return []LogAnalyticsLogType{LogAnalyticsLogTypeContainerInsights, LogAnalyticsLogTypeContainerInstanceLogs} -} - -// OperatingSystemTypes enumerates the values for operating system types. -type OperatingSystemTypes string - -const ( - // OperatingSystemTypesLinux ... - OperatingSystemTypesLinux OperatingSystemTypes = "Linux" - // OperatingSystemTypesWindows ... - OperatingSystemTypesWindows OperatingSystemTypes = "Windows" -) - -// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type. -func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { - return []OperatingSystemTypes{OperatingSystemTypesLinux, OperatingSystemTypesWindows} -} - -// OperationsOrigin enumerates the values for operations origin. -type OperationsOrigin string - -const ( - // OperationsOriginSystem ... - OperationsOriginSystem OperationsOrigin = "System" - // OperationsOriginUser ... - OperationsOriginUser OperationsOrigin = "User" -) - -// PossibleOperationsOriginValues returns an array of possible values for the OperationsOrigin const type. -func PossibleOperationsOriginValues() []OperationsOrigin { - return []OperationsOrigin{OperationsOriginSystem, OperationsOriginUser} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// Scheme enumerates the values for scheme. -type Scheme string - -const ( - // SchemeHTTP ... - SchemeHTTP Scheme = "http" - // SchemeHTTPS ... - SchemeHTTPS Scheme = "https" -) - -// PossibleSchemeValues returns an array of possible values for the Scheme const type. -func PossibleSchemeValues() []Scheme { - return []Scheme{SchemeHTTP, SchemeHTTPS} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/location.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/location.go deleted file mode 100644 index c9c64af27a60..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/location.go +++ /dev/null @@ -1,337 +0,0 @@ -package containerinstance - -// 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" -) - -// LocationClient is the client for the Location methods of the Containerinstance service. -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)} -} - -// ListCachedImages get the list of cached images on specific OS type for a subscription in a region. -// Parameters: -// location - the identifier for the physical azure location. -func (client LocationClient) ListCachedImages(ctx context.Context, location string) (result CachedImagesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCachedImages") - defer func() { - sc := -1 - if result.cilr.Response.Response != nil { - sc = result.cilr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listCachedImagesNextResults - req, err := client.ListCachedImagesPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", nil, "Failure preparing request") - return - } - - resp, err := client.ListCachedImagesSender(req) - if err != nil { - result.cilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", resp, "Failure sending request") - return - } - - result.cilr, err = client.ListCachedImagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", resp, "Failure responding to request") - return - } - if result.cilr.hasNextLink() && result.cilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCachedImagesPreparer prepares the ListCachedImages request. -func (client LocationClient) ListCachedImagesPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCachedImagesSender sends the ListCachedImages request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListCachedImagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCachedImagesResponder handles the response to the ListCachedImages request. The method always -// closes the http.Response Body. -func (client LocationClient) ListCachedImagesResponder(resp *http.Response) (result CachedImagesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCachedImagesNextResults retrieves the next set of results, if any. -func (client LocationClient) listCachedImagesNextResults(ctx context.Context, lastResults CachedImagesListResult) (result CachedImagesListResult, err error) { - req, err := lastResults.cachedImagesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCachedImagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCachedImagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCachedImagesComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListCachedImagesComplete(ctx context.Context, location string) (result CachedImagesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCachedImages") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListCachedImages(ctx, location) - return -} - -// ListCapabilities get the list of CPU/memory/GPU capabilities of a region. -// Parameters: -// location - the identifier for the physical azure location. -func (client LocationClient) ListCapabilities(ctx context.Context, location string) (result CapabilitiesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCapabilities") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listCapabilitiesNextResults - req, err := client.ListCapabilitiesPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", nil, "Failure preparing request") - return - } - - resp, err := client.ListCapabilitiesSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", resp, "Failure sending request") - return - } - - result.clr, err = client.ListCapabilitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCapabilitiesPreparer prepares the ListCapabilities request. -func (client LocationClient) ListCapabilitiesPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCapabilitiesSender sends the ListCapabilities request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always -// closes the http.Response Body. -func (client LocationClient) ListCapabilitiesResponder(resp *http.Response) (result CapabilitiesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCapabilitiesNextResults retrieves the next set of results, if any. -func (client LocationClient) listCapabilitiesNextResults(ctx context.Context, lastResults CapabilitiesListResult) (result CapabilitiesListResult, err error) { - req, err := lastResults.capabilitiesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCapabilitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCapabilitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCapabilitiesComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListCapabilitiesComplete(ctx context.Context, location string) (result CapabilitiesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCapabilities") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListCapabilities(ctx, location) - return -} - -// ListUsage get the usage for a subscription -// Parameters: -// location - the identifier for the physical azure location. -func (client LocationClient) ListUsage(ctx context.Context, location string) (result UsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListUsage") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListUsagePreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", resp, "Failure sending request") - return - } - - result, err = client.ListUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagePreparer prepares the ListUsage request. -func (client LocationClient) ListUsagePreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsageSender sends the ListUsage request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListUsageSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsageResponder handles the response to the ListUsage request. The method always -// closes the http.Response Body. -func (client LocationClient) ListUsageResponder(resp *http.Response) (result UsageListResult, 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/containerinstance/mgmt/2021-03-01/containerinstance/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/models.go deleted file mode 100644 index 3943f3e60232..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/models.go +++ /dev/null @@ -1,1813 +0,0 @@ -package containerinstance - -// 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/containerinstance/mgmt/2021-03-01/containerinstance" - -// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes. -type AzureFileVolume struct { - // ShareName - The name of the Azure File share to be mounted as a volume. - ShareName *string `json:"shareName,omitempty"` - // ReadOnly - The flag indicating whether the Azure File shared mounted as a volume is read-only. - ReadOnly *bool `json:"readOnly,omitempty"` - // StorageAccountName - The name of the storage account that contains the Azure File share. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // StorageAccountKey - The storage account access key used to access the Azure File share. - StorageAccountKey *string `json:"storageAccountKey,omitempty"` -} - -// CachedImages the cached image and OS type. -type CachedImages struct { - // OsType - The OS type of the cached image. - OsType *string `json:"osType,omitempty"` - // Image - The cached image name. - Image *string `json:"image,omitempty"` -} - -// CachedImagesListResult the response containing cached images. -type CachedImagesListResult struct { - autorest.Response `json:"-"` - // Value - The list of cached images. - Value *[]CachedImages `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of cached images. - NextLink *string `json:"nextLink,omitempty"` -} - -// CachedImagesListResultIterator provides access to a complete listing of CachedImages values. -type CachedImagesListResultIterator struct { - i int - page CachedImagesListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CachedImagesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CachedImagesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CachedImagesListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CachedImagesListResultIterator) Response() CachedImagesListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CachedImagesListResultIterator) Value() CachedImages { - if !iter.page.NotDone() { - return CachedImages{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CachedImagesListResultIterator type. -func NewCachedImagesListResultIterator(page CachedImagesListResultPage) CachedImagesListResultIterator { - return CachedImagesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cilr CachedImagesListResult) IsEmpty() bool { - return cilr.Value == nil || len(*cilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cilr CachedImagesListResult) hasNextLink() bool { - return cilr.NextLink != nil && len(*cilr.NextLink) != 0 -} - -// cachedImagesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cilr CachedImagesListResult) cachedImagesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !cilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cilr.NextLink))) -} - -// CachedImagesListResultPage contains a page of CachedImages values. -type CachedImagesListResultPage struct { - fn func(context.Context, CachedImagesListResult) (CachedImagesListResult, error) - cilr CachedImagesListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CachedImagesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cilr) - if err != nil { - return err - } - page.cilr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CachedImagesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CachedImagesListResultPage) NotDone() bool { - return !page.cilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CachedImagesListResultPage) Response() CachedImagesListResult { - return page.cilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CachedImagesListResultPage) Values() []CachedImages { - if page.cilr.IsEmpty() { - return nil - } - return *page.cilr.Value -} - -// Creates a new instance of the CachedImagesListResultPage type. -func NewCachedImagesListResultPage(cur CachedImagesListResult, getNextPage func(context.Context, CachedImagesListResult) (CachedImagesListResult, error)) CachedImagesListResultPage { - return CachedImagesListResultPage{ - fn: getNextPage, - cilr: cur, - } -} - -// Capabilities the regional capabilities. -type Capabilities struct { - // ResourceType - READ-ONLY; The resource type that this capability describes. - ResourceType *string `json:"resourceType,omitempty"` - // OsType - READ-ONLY; The OS type that this capability describes. - OsType *string `json:"osType,omitempty"` - // Location - READ-ONLY; The resource location. - Location *string `json:"location,omitempty"` - // IPAddressType - READ-ONLY; The ip address type that this capability describes. - IPAddressType *string `json:"ipAddressType,omitempty"` - // Gpu - READ-ONLY; The GPU sku that this capability describes. - Gpu *string `json:"gpu,omitempty"` - // Capabilities - READ-ONLY; The supported capabilities. - Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"` -} - -// MarshalJSON is the custom marshaler for Capabilities. -func (c Capabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CapabilitiesCapabilities the supported capabilities. -type CapabilitiesCapabilities struct { - // MaxMemoryInGB - READ-ONLY; The maximum allowed memory request in GB. - MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"` - // MaxCPU - READ-ONLY; The maximum allowed CPU request in cores. - MaxCPU *float64 `json:"maxCpu,omitempty"` - // MaxGpuCount - READ-ONLY; The maximum allowed GPU count. - MaxGpuCount *float64 `json:"maxGpuCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapabilitiesCapabilities. -func (c CapabilitiesCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CapabilitiesListResult the response containing list of capabilities. -type CapabilitiesListResult struct { - autorest.Response `json:"-"` - // Value - The list of capabilities. - Value *[]Capabilities `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of capabilities. - NextLink *string `json:"nextLink,omitempty"` -} - -// CapabilitiesListResultIterator provides access to a complete listing of Capabilities values. -type CapabilitiesListResultIterator struct { - i int - page CapabilitiesListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CapabilitiesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CapabilitiesListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CapabilitiesListResultIterator) Value() Capabilities { - if !iter.page.NotDone() { - return Capabilities{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CapabilitiesListResultIterator type. -func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator { - return CapabilitiesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CapabilitiesListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CapabilitiesListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// capabilitiesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !clr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(clr.NextLink))) -} - -// CapabilitiesListResultPage contains a page of Capabilities values. -type CapabilitiesListResultPage struct { - fn func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error) - clr CapabilitiesListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.clr) - if err != nil { - return err - } - page.clr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CapabilitiesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CapabilitiesListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CapabilitiesListResultPage) Response() CapabilitiesListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CapabilitiesListResultPage) Values() []Capabilities { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CapabilitiesListResultPage type. -func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage { - return CapabilitiesListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CloudError an error response from the Container Instance service. -type CloudError struct { - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Container Instance 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"` -} - -// Container a container instance. -type Container struct { - // Name - The user-provided name of the container instance. - Name *string `json:"name,omitempty"` - // ContainerProperties - The properties of the container instance. - *ContainerProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Container. -func (c Container) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.Name != nil { - objectMap["name"] = c.Name - } - if c.ContainerProperties != nil { - objectMap["properties"] = c.ContainerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Container struct. -func (c *Container) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "properties": - if v != nil { - var containerProperties ContainerProperties - err = json.Unmarshal(*v, &containerProperties) - if err != nil { - return err - } - c.ContainerProperties = &containerProperties - } - } - } - - return nil -} - -// ContainerAttachResponse the information for the output stream from container attach. -type ContainerAttachResponse struct { - autorest.Response `json:"-"` - // WebSocketURI - The uri for the output stream from the attach. - WebSocketURI *string `json:"webSocketUri,omitempty"` - // Password - The password to the output stream from the attach. Send as an Authorization header value when connecting to the websocketUri. - Password *string `json:"password,omitempty"` -} - -// ContainerExec the container execution command, for liveness or readiness probe -type ContainerExec struct { - // Command - The commands to execute within the container. - Command *[]string `json:"command,omitempty"` -} - -// ContainerExecRequest the container exec request. -type ContainerExecRequest struct { - // Command - The command to be executed. - Command *string `json:"command,omitempty"` - // TerminalSize - The size of the terminal. - TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"` -} - -// ContainerExecRequestTerminalSize the size of the terminal. -type ContainerExecRequestTerminalSize struct { - // Rows - The row size of the terminal - Rows *int32 `json:"rows,omitempty"` - // Cols - The column size of the terminal - Cols *int32 `json:"cols,omitempty"` -} - -// ContainerExecResponse the information for the container exec command. -type ContainerExecResponse struct { - autorest.Response `json:"-"` - // WebSocketURI - The uri for the exec websocket. - WebSocketURI *string `json:"webSocketUri,omitempty"` - // Password - The password to start the exec command. - Password *string `json:"password,omitempty"` -} - -// ContainerGroup a container group. -type ContainerGroup struct { - autorest.Response `json:"-"` - // Identity - The identity of the container group, if configured. - Identity *ContainerGroupIdentity `json:"identity,omitempty"` - // ContainerGroupProperties - The container group properties - *ContainerGroupProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ContainerGroup. -func (cg ContainerGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cg.Identity != nil { - objectMap["identity"] = cg.Identity - } - if cg.ContainerGroupProperties != nil { - objectMap["properties"] = cg.ContainerGroupProperties - } - if cg.Location != nil { - objectMap["location"] = cg.Location - } - if cg.Tags != nil { - objectMap["tags"] = cg.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ContainerGroup struct. -func (cg *ContainerGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ContainerGroupIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - cg.Identity = &identity - } - case "properties": - if v != nil { - var containerGroupProperties ContainerGroupProperties - err = json.Unmarshal(*v, &containerGroupProperties) - if err != nil { - return err - } - cg.ContainerGroupProperties = &containerGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cg.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cg.Tags = tags - } - } - } - - return nil -} - -// ContainerGroupDiagnostics container group diagnostic information. -type ContainerGroupDiagnostics struct { - // LogAnalytics - Container group log analytics information. - LogAnalytics *LogAnalytics `json:"logAnalytics,omitempty"` -} - -// ContainerGroupIdentity identity for the container group. -type ContainerGroupIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the container group identity. 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 container group. This property will only be provided for a system assigned identity. - TenantID *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*ContainerGroupIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ContainerGroupIdentity. -func (cgiVar ContainerGroupIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cgiVar.Type != "" { - objectMap["type"] = cgiVar.Type - } - if cgiVar.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = cgiVar.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ContainerGroupIdentityUserAssignedIdentitiesValue ... -type ContainerGroupIdentityUserAssignedIdentitiesValue 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 ContainerGroupIdentityUserAssignedIdentitiesValue. -func (cgiAiv ContainerGroupIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContainerGroupListResult the container group list response that contains the container group properties. -type ContainerGroupListResult struct { - autorest.Response `json:"-"` - // Value - The list of container groups. - Value *[]ContainerGroup `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of container groups. - NextLink *string `json:"nextLink,omitempty"` -} - -// ContainerGroupListResultIterator provides access to a complete listing of ContainerGroup values. -type ContainerGroupListResultIterator struct { - i int - page ContainerGroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ContainerGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ContainerGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ContainerGroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ContainerGroupListResultIterator) Response() ContainerGroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ContainerGroupListResultIterator) Value() ContainerGroup { - if !iter.page.NotDone() { - return ContainerGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ContainerGroupListResultIterator type. -func NewContainerGroupListResultIterator(page ContainerGroupListResultPage) ContainerGroupListResultIterator { - return ContainerGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cglr ContainerGroupListResult) IsEmpty() bool { - return cglr.Value == nil || len(*cglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cglr ContainerGroupListResult) hasNextLink() bool { - return cglr.NextLink != nil && len(*cglr.NextLink) != 0 -} - -// containerGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cglr ContainerGroupListResult) containerGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !cglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cglr.NextLink))) -} - -// ContainerGroupListResultPage contains a page of ContainerGroup values. -type ContainerGroupListResultPage struct { - fn func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error) - cglr ContainerGroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ContainerGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cglr) - if err != nil { - return err - } - page.cglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ContainerGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ContainerGroupListResultPage) NotDone() bool { - return !page.cglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ContainerGroupListResultPage) Response() ContainerGroupListResult { - return page.cglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ContainerGroupListResultPage) Values() []ContainerGroup { - if page.cglr.IsEmpty() { - return nil - } - return *page.cglr.Value -} - -// Creates a new instance of the ContainerGroupListResultPage type. -func NewContainerGroupListResultPage(cur ContainerGroupListResult, getNextPage func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error)) ContainerGroupListResultPage { - return ContainerGroupListResultPage{ - fn: getNextPage, - cglr: cur, - } -} - -// ContainerGroupNetworkProfile container group network profile information. -type ContainerGroupNetworkProfile struct { - // ID - The identifier for a network profile. - ID *string `json:"id,omitempty"` -} - -// ContainerGroupProperties the container group properties -type ContainerGroupProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the container group. This only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Containers - The containers within the container group. - Containers *[]Container `json:"containers,omitempty"` - // ImageRegistryCredentials - The image registry credentials by which the container group is created from. - ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` - // RestartPolicy - Restart policy for all containers within the container group. - // - `Always` Always restart - // - `OnFailure` Restart on failure - // - `Never` Never restart - // . Possible values include: 'ContainerGroupRestartPolicyAlways', 'ContainerGroupRestartPolicyOnFailure', 'ContainerGroupRestartPolicyNever' - RestartPolicy ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` - // IPAddress - The IP address type of the container group. - IPAddress *IPAddress `json:"ipAddress,omitempty"` - // OsType - The operating system type required by the containers in the container group. Possible values include: 'OperatingSystemTypesWindows', 'OperatingSystemTypesLinux' - OsType OperatingSystemTypes `json:"osType,omitempty"` - // Volumes - The list of volumes that can be mounted by containers in this container group. - Volumes *[]Volume `json:"volumes,omitempty"` - // InstanceView - READ-ONLY; The instance view of the container group. Only valid in response. - InstanceView *ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"` - // Diagnostics - The diagnostic information for a container group. - Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` - // NetworkProfile - The network profile information for a container group. - NetworkProfile *ContainerGroupNetworkProfile `json:"networkProfile,omitempty"` - // DNSConfig - The DNS config information for a container group. - DNSConfig *DNSConfiguration `json:"dnsConfig,omitempty"` - // Sku - The SKU for a container group. Possible values include: 'ContainerGroupSkuStandard', 'ContainerGroupSkuDedicated' - Sku ContainerGroupSku `json:"sku,omitempty"` - // EncryptionProperties - The encryption properties for a container group. - EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` - // InitContainers - The init containers for a container group. - InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerGroupProperties. -func (cg ContainerGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cg.Containers != nil { - objectMap["containers"] = cg.Containers - } - if cg.ImageRegistryCredentials != nil { - objectMap["imageRegistryCredentials"] = cg.ImageRegistryCredentials - } - if cg.RestartPolicy != "" { - objectMap["restartPolicy"] = cg.RestartPolicy - } - if cg.IPAddress != nil { - objectMap["ipAddress"] = cg.IPAddress - } - if cg.OsType != "" { - objectMap["osType"] = cg.OsType - } - if cg.Volumes != nil { - objectMap["volumes"] = cg.Volumes - } - if cg.Diagnostics != nil { - objectMap["diagnostics"] = cg.Diagnostics - } - if cg.NetworkProfile != nil { - objectMap["networkProfile"] = cg.NetworkProfile - } - if cg.DNSConfig != nil { - objectMap["dnsConfig"] = cg.DNSConfig - } - if cg.Sku != "" { - objectMap["sku"] = cg.Sku - } - if cg.EncryptionProperties != nil { - objectMap["encryptionProperties"] = cg.EncryptionProperties - } - if cg.InitContainers != nil { - objectMap["initContainers"] = cg.InitContainers - } - return json.Marshal(objectMap) -} - -// ContainerGroupPropertiesInstanceView the instance view of the container group. Only valid in response. -type ContainerGroupPropertiesInstanceView struct { - // Events - READ-ONLY; The events of this container group. - Events *[]Event `json:"events,omitempty"` - // State - READ-ONLY; The state of the container group. Only valid in response. - State *string `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerGroupPropertiesInstanceView. -func (cgV ContainerGroupPropertiesInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContainerGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ContainerGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (ContainerGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsCreateOrUpdateFuture.Result. -func (future *ContainerGroupsCreateOrUpdateFuture) result(client ContainerGroupsClient) (cg ContainerGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cg.Response.Response, err = future.GetResult(sender); err == nil && cg.Response.Response.StatusCode != http.StatusNoContent { - cg, err = client.CreateOrUpdateResponder(cg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", cg.Response.Response, "Failure responding to request") - } - } - return -} - -// ContainerGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ContainerGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (ContainerGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsDeleteFuture.Result. -func (future *ContainerGroupsDeleteFuture) result(client ContainerGroupsClient) (cg ContainerGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cg.Response.Response, err = future.GetResult(sender); err == nil && cg.Response.Response.StatusCode != http.StatusNoContent { - cg, err = client.DeleteResponder(cg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsDeleteFuture", "Result", cg.Response.Response, "Failure responding to request") - } - } - return -} - -// ContainerGroupsRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ContainerGroupsRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsRestartFuture.Result. -func (future *ContainerGroupsRestartFuture) result(client ContainerGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// ContainerGroupsStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ContainerGroupsStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsStartFuture.Result. -func (future *ContainerGroupsStartFuture) result(client ContainerGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ContainerHTTPGet the container Http Get settings, for liveness or readiness probe -type ContainerHTTPGet struct { - // Path - The path to probe. - Path *string `json:"path,omitempty"` - // Port - The port number to probe. - Port *int32 `json:"port,omitempty"` - // Scheme - The scheme. Possible values include: 'SchemeHTTP', 'SchemeHTTPS' - Scheme Scheme `json:"scheme,omitempty"` - // HTTPHeaders - The HTTP headers. - HTTPHeaders *HTTPHeaders `json:"httpHeaders,omitempty"` -} - -// ContainerPort the port exposed on the container instance. -type ContainerPort struct { - // Protocol - The protocol associated with the port. Possible values include: 'ContainerNetworkProtocolTCP', 'ContainerNetworkProtocolUDP' - Protocol ContainerNetworkProtocol `json:"protocol,omitempty"` - // Port - The port number exposed within the container group. - Port *int32 `json:"port,omitempty"` -} - -// ContainerProbe the container probe, for liveness or readiness -type ContainerProbe struct { - // Exec - The execution command to probe - Exec *ContainerExec `json:"exec,omitempty"` - // HTTPGet - The Http Get settings to probe - HTTPGet *ContainerHTTPGet `json:"httpGet,omitempty"` - // InitialDelaySeconds - The initial delay seconds. - InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` - // PeriodSeconds - The period seconds. - PeriodSeconds *int32 `json:"periodSeconds,omitempty"` - // FailureThreshold - The failure threshold. - FailureThreshold *int32 `json:"failureThreshold,omitempty"` - // SuccessThreshold - The success threshold. - SuccessThreshold *int32 `json:"successThreshold,omitempty"` - // TimeoutSeconds - The timeout seconds. - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` -} - -// ContainerProperties the container instance properties. -type ContainerProperties struct { - // Image - The name of the image used to create the container instance. - Image *string `json:"image,omitempty"` - // Command - The commands to execute within the container instance in exec form. - Command *[]string `json:"command,omitempty"` - // Ports - The exposed ports on the container instance. - Ports *[]ContainerPort `json:"ports,omitempty"` - // EnvironmentVariables - The environment variables to set in the container instance. - EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` - // InstanceView - READ-ONLY; The instance view of the container instance. Only valid in response. - InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"` - // Resources - The resource requirements of the container instance. - Resources *ResourceRequirements `json:"resources,omitempty"` - // VolumeMounts - The volume mounts available to the container instance. - VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` - // LivenessProbe - The liveness probe. - LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty"` - // ReadinessProbe - The readiness probe. - ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerProperties. -func (cp ContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Image != nil { - objectMap["image"] = cp.Image - } - if cp.Command != nil { - objectMap["command"] = cp.Command - } - if cp.Ports != nil { - objectMap["ports"] = cp.Ports - } - if cp.EnvironmentVariables != nil { - objectMap["environmentVariables"] = cp.EnvironmentVariables - } - if cp.Resources != nil { - objectMap["resources"] = cp.Resources - } - if cp.VolumeMounts != nil { - objectMap["volumeMounts"] = cp.VolumeMounts - } - if cp.LivenessProbe != nil { - objectMap["livenessProbe"] = cp.LivenessProbe - } - if cp.ReadinessProbe != nil { - objectMap["readinessProbe"] = cp.ReadinessProbe - } - return json.Marshal(objectMap) -} - -// ContainerPropertiesInstanceView the instance view of the container instance. Only valid in response. -type ContainerPropertiesInstanceView struct { - // RestartCount - READ-ONLY; The number of times that the container instance has been restarted. - RestartCount *int32 `json:"restartCount,omitempty"` - // CurrentState - READ-ONLY; Current container instance state. - CurrentState *ContainerState `json:"currentState,omitempty"` - // PreviousState - READ-ONLY; Previous container instance state. - PreviousState *ContainerState `json:"previousState,omitempty"` - // Events - READ-ONLY; The events of the container instance. - Events *[]Event `json:"events,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerPropertiesInstanceView. -func (cpV ContainerPropertiesInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContainerState the container instance state. -type ContainerState struct { - // State - READ-ONLY; The state of the container instance. - State *string `json:"state,omitempty"` - // StartTime - READ-ONLY; The date-time when the container instance state started. - StartTime *date.Time `json:"startTime,omitempty"` - // ExitCode - READ-ONLY; The container instance exit codes correspond to those from the `docker run` command. - ExitCode *int32 `json:"exitCode,omitempty"` - // FinishTime - READ-ONLY; The date-time when the container instance state finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // DetailStatus - READ-ONLY; The human-readable status of the container instance state. - DetailStatus *string `json:"detailStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerState. -func (cs ContainerState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DNSConfiguration DNS configuration for the container group. -type DNSConfiguration struct { - // NameServers - The DNS servers for the container group. - NameServers *[]string `json:"nameServers,omitempty"` - // SearchDomains - The DNS search domains for hostname lookup in the container group. - SearchDomains *string `json:"searchDomains,omitempty"` - // Options - The DNS options for the container group. - Options *string `json:"options,omitempty"` -} - -// EncryptionProperties the container group encryption properties. -type EncryptionProperties struct { - // VaultBaseURL - The keyvault base url. - VaultBaseURL *string `json:"vaultBaseUrl,omitempty"` - // KeyName - The encryption key name. - KeyName *string `json:"keyName,omitempty"` - // KeyVersion - The encryption key version. - KeyVersion *string `json:"keyVersion,omitempty"` -} - -// EnvironmentVariable the environment variable to set within the container instance. -type EnvironmentVariable struct { - // Name - The name of the environment variable. - Name *string `json:"name,omitempty"` - // Value - The value of the environment variable. - Value *string `json:"value,omitempty"` - // SecureValue - The value of the secure environment variable. - SecureValue *string `json:"secureValue,omitempty"` -} - -// Event a container group or container instance event. -type Event struct { - // Count - READ-ONLY; The count of the event. - Count *int32 `json:"count,omitempty"` - // FirstTimestamp - READ-ONLY; The date-time of the earliest logged event. - FirstTimestamp *date.Time `json:"firstTimestamp,omitempty"` - // LastTimestamp - READ-ONLY; The date-time of the latest logged event. - LastTimestamp *date.Time `json:"lastTimestamp,omitempty"` - // Name - READ-ONLY; The event name. - Name *string `json:"name,omitempty"` - // Message - READ-ONLY; The event message. - Message *string `json:"message,omitempty"` - // Type - READ-ONLY; The event type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Event. -func (e Event) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GitRepoVolume represents a volume that is populated with the contents of a git repository -type GitRepoVolume struct { - // Directory - Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. - Directory *string `json:"directory,omitempty"` - // Repository - Repository URL - Repository *string `json:"repository,omitempty"` - // Revision - Commit hash for the specified revision. - Revision *string `json:"revision,omitempty"` -} - -// GpuResource the GPU resource. -type GpuResource struct { - // Count - The count of the GPU resource. - Count *int32 `json:"count,omitempty"` - // Sku - The SKU of the GPU resource. Possible values include: 'GpuSkuK80', 'GpuSkuP100', 'GpuSkuV100' - Sku GpuSku `json:"sku,omitempty"` -} - -// HTTPHeaders the HTTP headers. -type HTTPHeaders struct { - // Name - The header name. - Name *string `json:"name,omitempty"` - // Value - The header value. - Value *string `json:"value,omitempty"` -} - -// ImageRegistryCredential image registry credential. -type ImageRegistryCredential struct { - // Server - The Docker image registry server without a protocol such as "http" and "https". - Server *string `json:"server,omitempty"` - // Username - The username for the private registry. - Username *string `json:"username,omitempty"` - // Password - The password for the private registry. - Password *string `json:"password,omitempty"` -} - -// InitContainerDefinition the init container definition. -type InitContainerDefinition struct { - // Name - The name for the init container. - Name *string `json:"name,omitempty"` - // InitContainerPropertiesDefinition - The properties for the init container. - *InitContainerPropertiesDefinition `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for InitContainerDefinition. -func (icd InitContainerDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icd.Name != nil { - objectMap["name"] = icd.Name - } - if icd.InitContainerPropertiesDefinition != nil { - objectMap["properties"] = icd.InitContainerPropertiesDefinition - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InitContainerDefinition struct. -func (icd *InitContainerDefinition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - icd.Name = &name - } - case "properties": - if v != nil { - var initContainerPropertiesDefinition InitContainerPropertiesDefinition - err = json.Unmarshal(*v, &initContainerPropertiesDefinition) - if err != nil { - return err - } - icd.InitContainerPropertiesDefinition = &initContainerPropertiesDefinition - } - } - } - - return nil -} - -// InitContainerPropertiesDefinition the init container definition properties. -type InitContainerPropertiesDefinition struct { - // Image - The image of the init container. - Image *string `json:"image,omitempty"` - // Command - The command to execute within the init container in exec form. - Command *[]string `json:"command,omitempty"` - // EnvironmentVariables - The environment variables to set in the init container. - EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` - // InstanceView - READ-ONLY; The instance view of the init container. Only valid in response. - InstanceView *InitContainerPropertiesDefinitionInstanceView `json:"instanceView,omitempty"` - // VolumeMounts - The volume mounts available to the init container. - VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` -} - -// MarshalJSON is the custom marshaler for InitContainerPropertiesDefinition. -func (icpd InitContainerPropertiesDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icpd.Image != nil { - objectMap["image"] = icpd.Image - } - if icpd.Command != nil { - objectMap["command"] = icpd.Command - } - if icpd.EnvironmentVariables != nil { - objectMap["environmentVariables"] = icpd.EnvironmentVariables - } - if icpd.VolumeMounts != nil { - objectMap["volumeMounts"] = icpd.VolumeMounts - } - return json.Marshal(objectMap) -} - -// InitContainerPropertiesDefinitionInstanceView the instance view of the init container. Only valid in -// response. -type InitContainerPropertiesDefinitionInstanceView struct { - // RestartCount - READ-ONLY; The number of times that the init container has been restarted. - RestartCount *int32 `json:"restartCount,omitempty"` - // CurrentState - READ-ONLY; The current state of the init container. - CurrentState *ContainerState `json:"currentState,omitempty"` - // PreviousState - READ-ONLY; The previous state of the init container. - PreviousState *ContainerState `json:"previousState,omitempty"` - // Events - READ-ONLY; The events of the init container. - Events *[]Event `json:"events,omitempty"` -} - -// MarshalJSON is the custom marshaler for InitContainerPropertiesDefinitionInstanceView. -func (icpdV InitContainerPropertiesDefinitionInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IPAddress IP address for the container group. -type IPAddress struct { - // Ports - The list of ports exposed on the container group. - Ports *[]Port `json:"ports,omitempty"` - // Type - Specifies if the IP is exposed to the public internet or private VNET. Possible values include: 'ContainerGroupIPAddressTypePublic', 'ContainerGroupIPAddressTypePrivate' - Type ContainerGroupIPAddressType `json:"type,omitempty"` - // IP - The IP exposed to the public internet. - IP *string `json:"ip,omitempty"` - // DNSNameLabel - The Dns name label for the IP. - DNSNameLabel *string `json:"dnsNameLabel,omitempty"` - // Fqdn - READ-ONLY; The FQDN for the IP. - Fqdn *string `json:"fqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPAddress. -func (ia IPAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ia.Ports != nil { - objectMap["ports"] = ia.Ports - } - if ia.Type != "" { - objectMap["type"] = ia.Type - } - if ia.IP != nil { - objectMap["ip"] = ia.IP - } - if ia.DNSNameLabel != nil { - objectMap["dnsNameLabel"] = ia.DNSNameLabel - } - return json.Marshal(objectMap) -} - -// LogAnalytics container group log analytics information. -type LogAnalytics struct { - // WorkspaceID - The workspace id for log analytics - WorkspaceID *string `json:"workspaceId,omitempty"` - // WorkspaceKey - The workspace key for log analytics - WorkspaceKey *string `json:"workspaceKey,omitempty"` - // LogType - The log type to be used. Possible values include: 'LogAnalyticsLogTypeContainerInsights', 'LogAnalyticsLogTypeContainerInstanceLogs' - LogType LogAnalyticsLogType `json:"logType,omitempty"` - // Metadata - Metadata for log analytics. - Metadata map[string]*string `json:"metadata"` - // WorkspaceResourceID - The workspace resource id for log analytics - WorkspaceResourceID map[string]*string `json:"workspaceResourceId"` -} - -// MarshalJSON is the custom marshaler for LogAnalytics. -func (la LogAnalytics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if la.WorkspaceID != nil { - objectMap["workspaceId"] = la.WorkspaceID - } - if la.WorkspaceKey != nil { - objectMap["workspaceKey"] = la.WorkspaceKey - } - if la.LogType != "" { - objectMap["logType"] = la.LogType - } - if la.Metadata != nil { - objectMap["metadata"] = la.Metadata - } - if la.WorkspaceResourceID != nil { - objectMap["workspaceResourceId"] = la.WorkspaceResourceID - } - return json.Marshal(objectMap) -} - -// Logs the logs. -type Logs struct { - autorest.Response `json:"-"` - // Content - The content of the log. - Content *string `json:"content,omitempty"` -} - -// Operation an operation for Azure Container Instance service. -type Operation struct { - // Name - The name of the operation. - Name *string `json:"name,omitempty"` - // Display - The display information of the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Properties - The additional properties. - Properties interface{} `json:"properties,omitempty"` - // Origin - The intended executor of the operation. Possible values include: 'OperationsOriginUser', 'OperationsOriginSystem' - Origin OperationsOrigin `json:"origin,omitempty"` -} - -// OperationDisplay the display information of the operation. -type OperationDisplay struct { - // Provider - The name of the provider of the operation. - Provider *string `json:"provider,omitempty"` - // Resource - The name of the resource type of the operation. - Resource *string `json:"resource,omitempty"` - // Operation - The friendly name of the operation. - Operation *string `json:"operation,omitempty"` - // Description - The description of the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the operation list response that contains all operations for Azure Container -// Instance service. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of operations. - Value *[]Operation `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of operations. - 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, - } -} - -// Port the port exposed on the container group. -type Port struct { - // Protocol - The protocol associated with the port. Possible values include: 'ContainerGroupNetworkProtocolTCP', 'ContainerGroupNetworkProtocolUDP' - Protocol ContainerGroupNetworkProtocol `json:"protocol,omitempty"` - // Port - The port number. - Port *int32 `json:"port,omitempty"` -} - -// Resource the Resource model definition. -type Resource struct { - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceLimits the resource limits. -type ResourceLimits struct { - // MemoryInGB - The memory limit in GB of this container instance. - MemoryInGB *float64 `json:"memoryInGB,omitempty"` - // CPU - The CPU limit of this container instance. - CPU *float64 `json:"cpu,omitempty"` - // Gpu - The GPU limit of this container instance. - Gpu *GpuResource `json:"gpu,omitempty"` -} - -// ResourceRequests the resource requests. -type ResourceRequests struct { - // MemoryInGB - The memory request in GB of this container instance. - MemoryInGB *float64 `json:"memoryInGB,omitempty"` - // CPU - The CPU request of this container instance. - CPU *float64 `json:"cpu,omitempty"` - // Gpu - The GPU request of this container instance. - Gpu *GpuResource `json:"gpu,omitempty"` -} - -// ResourceRequirements the resource requirements. -type ResourceRequirements struct { - // Requests - The resource requests of this container instance. - Requests *ResourceRequests `json:"requests,omitempty"` - // Limits - The resource limits of this container instance. - Limits *ResourceLimits `json:"limits,omitempty"` -} - -// Usage a single usage result -type Usage struct { - // Unit - READ-ONLY; Unit of the usage result - Unit *string `json:"unit,omitempty"` - // CurrentValue - READ-ONLY; The current usage of the resource - CurrentValue *int32 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The maximum permitted usage of the resource. - Limit *int32 `json:"limit,omitempty"` - // Name - READ-ONLY; The name object of the resource - Name *UsageName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UsageListResult the response containing the usage data -type UsageListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The usage data. - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsageListResult. -func (ulr UsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UsageName the name object of the resource -type UsageName struct { - // Value - READ-ONLY; The name of the resource - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The localized name of the resource - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsageName. -func (u UsageName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Volume the properties of the volume. -type Volume struct { - // Name - The name of the volume. - Name *string `json:"name,omitempty"` - // AzureFile - The Azure File volume. - AzureFile *AzureFileVolume `json:"azureFile,omitempty"` - // EmptyDir - The empty directory volume. - EmptyDir interface{} `json:"emptyDir,omitempty"` - // Secret - The secret volume. - Secret map[string]*string `json:"secret"` - // GitRepo - The git repo volume. - GitRepo *GitRepoVolume `json:"gitRepo,omitempty"` -} - -// MarshalJSON is the custom marshaler for Volume. -func (vVar Volume) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Name != nil { - objectMap["name"] = vVar.Name - } - if vVar.AzureFile != nil { - objectMap["azureFile"] = vVar.AzureFile - } - if vVar.EmptyDir != nil { - objectMap["emptyDir"] = vVar.EmptyDir - } - if vVar.Secret != nil { - objectMap["secret"] = vVar.Secret - } - if vVar.GitRepo != nil { - objectMap["gitRepo"] = vVar.GitRepo - } - return json.Marshal(objectMap) -} - -// VolumeMount the properties of the volume mount. -type VolumeMount struct { - // Name - The name of the volume mount. - Name *string `json:"name,omitempty"` - // MountPath - The path within the container where the volume should be mounted. Must not contain colon (:). - MountPath *string `json:"mountPath,omitempty"` - // ReadOnly - The flag indicating whether the volume mount is read-only. - ReadOnly *bool `json:"readOnly,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/operations.go deleted file mode 100644 index 8fc9d678e100..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Containerinstance service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list the operations for Azure Container Instance service. -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, "containerinstance.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, "containerinstance.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerInstance/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, "containerinstance.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, "containerinstance.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.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/containerinstance/mgmt/2021-03-01/containerinstance/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/version.go deleted file mode 100644 index 4b1d585d377e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerinstance - -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() + " containerinstance/2021-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/README.md new file mode 100644 index 000000000000..08d11810c6f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/README.md @@ -0,0 +1,263 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance` Documentation + +The `containerinstance` SDK allows for interaction with the Azure Resource Manager Service `containerinstance` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" +``` + + +### Client Initialization + +```go +client := containerinstance.NewContainerInstanceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsCreateOrUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +payload := containerinstance.ContainerGroup{ + // ... +} + + +if err := client.ContainerGroupsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsDelete` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +if err := client.ContainerGroupsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsGet` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +read, err := client.ContainerGroupsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsList` + +```go +ctx := context.TODO() +id := containerinstance.NewSubscriptionID() + +// alternatively `client.ContainerGroupsList(ctx, id)` can be used to do batched pagination +items, err := client.ContainerGroupsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsListByResourceGroup` + +```go +ctx := context.TODO() +id := containerinstance.NewResourceGroupID() + +// alternatively `client.ContainerGroupsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ContainerGroupsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsRestart` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +if err := client.ContainerGroupsRestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsStart` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +if err := client.ContainerGroupsStartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsStop` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +read, err := client.ContainerGroupsStop(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +payload := containerinstance.Resource{ + // ... +} + + +read, err := client.ContainerGroupsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersAttach` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue", "containerValue") + +read, err := client.ContainersAttach(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersExecuteCommand` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue", "containerValue") + +payload := containerinstance.ContainerExecRequest{ + // ... +} + + +read, err := client.ContainersExecuteCommand(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersListLogs` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue", "containerValue") + +read, err := client.ContainersListLogs(ctx, id, containerinstance.DefaultContainersListLogsOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListCachedImages` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +// alternatively `client.LocationListCachedImages(ctx, id)` can be used to do batched pagination +items, err := client.LocationListCachedImagesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListCapabilities` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +// alternatively `client.LocationListCapabilities(ctx, id)` can be used to do batched pagination +items, err := client.LocationListCapabilitiesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListUsage` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +read, err := client.LocationListUsage(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/client.go new file mode 100644 index 000000000000..7c611fe53d7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/client.go @@ -0,0 +1,18 @@ +package containerinstance + +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 ContainerInstanceClient struct { + Client autorest.Client + baseUri string +} + +func NewContainerInstanceClientWithBaseURI(endpoint string) ContainerInstanceClient { + return ContainerInstanceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/constants.go new file mode 100644 index 000000000000..4209a2b00df1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/constants.go @@ -0,0 +1,264 @@ +package containerinstance + +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 ContainerGroupIpAddressType string + +const ( + ContainerGroupIpAddressTypePrivate ContainerGroupIpAddressType = "Private" + ContainerGroupIpAddressTypePublic ContainerGroupIpAddressType = "Public" +) + +func PossibleValuesForContainerGroupIpAddressType() []string { + return []string{ + string(ContainerGroupIpAddressTypePrivate), + string(ContainerGroupIpAddressTypePublic), + } +} + +func parseContainerGroupIpAddressType(input string) (*ContainerGroupIpAddressType, error) { + vals := map[string]ContainerGroupIpAddressType{ + "private": ContainerGroupIpAddressTypePrivate, + "public": ContainerGroupIpAddressTypePublic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupIpAddressType(input) + return &out, nil +} + +type ContainerGroupNetworkProtocol string + +const ( + ContainerGroupNetworkProtocolTCP ContainerGroupNetworkProtocol = "TCP" + ContainerGroupNetworkProtocolUDP ContainerGroupNetworkProtocol = "UDP" +) + +func PossibleValuesForContainerGroupNetworkProtocol() []string { + return []string{ + string(ContainerGroupNetworkProtocolTCP), + string(ContainerGroupNetworkProtocolUDP), + } +} + +func parseContainerGroupNetworkProtocol(input string) (*ContainerGroupNetworkProtocol, error) { + vals := map[string]ContainerGroupNetworkProtocol{ + "tcp": ContainerGroupNetworkProtocolTCP, + "udp": ContainerGroupNetworkProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupNetworkProtocol(input) + return &out, nil +} + +type ContainerGroupRestartPolicy string + +const ( + ContainerGroupRestartPolicyAlways ContainerGroupRestartPolicy = "Always" + ContainerGroupRestartPolicyNever ContainerGroupRestartPolicy = "Never" + ContainerGroupRestartPolicyOnFailure ContainerGroupRestartPolicy = "OnFailure" +) + +func PossibleValuesForContainerGroupRestartPolicy() []string { + return []string{ + string(ContainerGroupRestartPolicyAlways), + string(ContainerGroupRestartPolicyNever), + string(ContainerGroupRestartPolicyOnFailure), + } +} + +func parseContainerGroupRestartPolicy(input string) (*ContainerGroupRestartPolicy, error) { + vals := map[string]ContainerGroupRestartPolicy{ + "always": ContainerGroupRestartPolicyAlways, + "never": ContainerGroupRestartPolicyNever, + "onfailure": ContainerGroupRestartPolicyOnFailure, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupRestartPolicy(input) + return &out, nil +} + +type ContainerGroupSku string + +const ( + ContainerGroupSkuDedicated ContainerGroupSku = "Dedicated" + ContainerGroupSkuStandard ContainerGroupSku = "Standard" +) + +func PossibleValuesForContainerGroupSku() []string { + return []string{ + string(ContainerGroupSkuDedicated), + string(ContainerGroupSkuStandard), + } +} + +func parseContainerGroupSku(input string) (*ContainerGroupSku, error) { + vals := map[string]ContainerGroupSku{ + "dedicated": ContainerGroupSkuDedicated, + "standard": ContainerGroupSkuStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupSku(input) + return &out, nil +} + +type ContainerNetworkProtocol string + +const ( + ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP" + ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP" +) + +func PossibleValuesForContainerNetworkProtocol() []string { + return []string{ + string(ContainerNetworkProtocolTCP), + string(ContainerNetworkProtocolUDP), + } +} + +func parseContainerNetworkProtocol(input string) (*ContainerNetworkProtocol, error) { + vals := map[string]ContainerNetworkProtocol{ + "tcp": ContainerNetworkProtocolTCP, + "udp": ContainerNetworkProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerNetworkProtocol(input) + return &out, nil +} + +type GpuSku string + +const ( + GpuSkuKEightZero GpuSku = "K80" + GpuSkuPOneHundred GpuSku = "P100" + GpuSkuVOneHundred GpuSku = "V100" +) + +func PossibleValuesForGpuSku() []string { + return []string{ + string(GpuSkuKEightZero), + string(GpuSkuPOneHundred), + string(GpuSkuVOneHundred), + } +} + +func parseGpuSku(input string) (*GpuSku, error) { + vals := map[string]GpuSku{ + "k80": GpuSkuKEightZero, + "p100": GpuSkuPOneHundred, + "v100": GpuSkuVOneHundred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GpuSku(input) + return &out, nil +} + +type LogAnalyticsLogType string + +const ( + LogAnalyticsLogTypeContainerInsights LogAnalyticsLogType = "ContainerInsights" + LogAnalyticsLogTypeContainerInstanceLogs LogAnalyticsLogType = "ContainerInstanceLogs" +) + +func PossibleValuesForLogAnalyticsLogType() []string { + return []string{ + string(LogAnalyticsLogTypeContainerInsights), + string(LogAnalyticsLogTypeContainerInstanceLogs), + } +} + +func parseLogAnalyticsLogType(input string) (*LogAnalyticsLogType, error) { + vals := map[string]LogAnalyticsLogType{ + "containerinsights": LogAnalyticsLogTypeContainerInsights, + "containerinstancelogs": LogAnalyticsLogTypeContainerInstanceLogs, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LogAnalyticsLogType(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type Scheme string + +const ( + SchemeHttp Scheme = "http" + SchemeHttps Scheme = "https" +) + +func PossibleValuesForScheme() []string { + return []string{ + string(SchemeHttp), + string(SchemeHttps), + } +} + +func parseScheme(input string) (*Scheme, error) { + vals := map[string]Scheme{ + "http": SchemeHttp, + "https": SchemeHttps, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Scheme(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_container.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_container.go new file mode 100644 index 000000000000..614af5e4336f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_container.go @@ -0,0 +1,137 @@ +package containerinstance + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ContainerId{} + +// ContainerId is a struct representing the Resource ID for a Container +type ContainerId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupName string + ContainerName string +} + +// NewContainerID returns a new ContainerId struct +func NewContainerID(subscriptionId string, resourceGroupName string, containerGroupName string, containerName string) ContainerId { + return ContainerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupName: containerGroupName, + ContainerName: containerName, + } +} + +// ParseContainerID parses 'input' into a ContainerId +func ParseContainerID(input string) (*ContainerId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { + return nil, fmt.Errorf("the segment 'containerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseContainerIDInsensitively parses 'input' case-insensitively into a ContainerId +// note: this method should only be used for API response data and not user input +func ParseContainerIDInsensitively(input string) (*ContainerId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { + return nil, fmt.Errorf("the segment 'containerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateContainerID checks that 'input' can be parsed as a Container ID +func ValidateContainerID(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 := ParseContainerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container ID +func (id ContainerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s/containers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupName, id.ContainerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container ID +func (id ContainerId) 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("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroups", "containerGroups", "containerGroups"), + resourceids.UserSpecifiedSegment("containerGroupName", "containerGroupValue"), + resourceids.StaticSegment("staticContainers", "containers", "containers"), + resourceids.UserSpecifiedSegment("containerName", "containerValue"), + } +} + +// String returns a human-readable description of this Container ID +func (id ContainerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Name: %q", id.ContainerGroupName), + fmt.Sprintf("Container Name: %q", id.ContainerName), + } + return fmt.Sprintf("Container (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_containergroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_containergroup.go new file mode 100644 index 000000000000..75ce7b7c4e41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_containergroup.go @@ -0,0 +1,124 @@ +package containerinstance + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ContainerGroupId{} + +// ContainerGroupId is a struct representing the Resource ID for a Container Group +type ContainerGroupId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupName string +} + +// NewContainerGroupID returns a new ContainerGroupId struct +func NewContainerGroupID(subscriptionId string, resourceGroupName string, containerGroupName string) ContainerGroupId { + return ContainerGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupName: containerGroupName, + } +} + +// ParseContainerGroupID parses 'input' into a ContainerGroupId +func ParseContainerGroupID(input string) (*ContainerGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseContainerGroupIDInsensitively parses 'input' case-insensitively into a ContainerGroupId +// note: this method should only be used for API response data and not user input +func ParseContainerGroupIDInsensitively(input string) (*ContainerGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateContainerGroupID checks that 'input' can be parsed as a Container Group ID +func ValidateContainerGroupID(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 := ParseContainerGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container Group ID +func (id ContainerGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container Group ID +func (id ContainerGroupId) 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("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroups", "containerGroups", "containerGroups"), + resourceids.UserSpecifiedSegment("containerGroupName", "containerGroupValue"), + } +} + +// String returns a human-readable description of this Container Group ID +func (id ContainerGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Name: %q", id.ContainerGroupName), + } + return fmt.Sprintf("Container Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_location.go new file mode 100644 index 000000000000..a1f453fb23fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_location.go @@ -0,0 +1,111 @@ +package containerinstance + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + Location string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, location string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + Location: location, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(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 := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.ContainerInstance/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupscreateorupdate_autorest.go new file mode 100644 index 000000000000..801ccd09e962 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package containerinstance + +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 ContainerGroupsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsCreateOrUpdate ... +func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdate(ctx context.Context, id ContainerGroupId, input ContainerGroup) (result ContainerGroupsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForContainerGroupsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsCreateOrUpdateThenPoll performs ContainerGroupsCreateOrUpdate then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdateThenPoll(ctx context.Context, id ContainerGroupId, input ContainerGroup) error { + result, err := c.ContainerGroupsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ContainerGroupsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsCreateOrUpdate prepares the ContainerGroupsCreateOrUpdate request. +func (c ContainerInstanceClient) preparerForContainerGroupsCreateOrUpdate(ctx context.Context, id ContainerGroupId, input ContainerGroup) (*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)) +} + +// senderForContainerGroupsCreateOrUpdate sends the ContainerGroupsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsCreateOrUpdate(ctx context.Context, req *http.Request) (future ContainerGroupsCreateOrUpdateOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containergroupsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsdelete_autorest.go new file mode 100644 index 000000000000..7468b631f234 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsdelete_autorest.go @@ -0,0 +1,78 @@ +package containerinstance + +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 ContainerGroupsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsDelete ... +func (c ContainerInstanceClient) ContainerGroupsDelete(ctx context.Context, id ContainerGroupId) (result ContainerGroupsDeleteOperationResponse, err error) { + req, err := c.preparerForContainerGroupsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsDeleteThenPoll performs ContainerGroupsDelete then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsDeleteThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsDelete: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsDelete prepares the ContainerGroupsDelete request. +func (c ContainerInstanceClient) preparerForContainerGroupsDelete(ctx context.Context, id ContainerGroupId) (*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)) +} + +// senderForContainerGroupsDelete sends the ContainerGroupsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsDelete(ctx context.Context, req *http.Request) (future ContainerGroupsDeleteOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containergroupsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsget_autorest.go new file mode 100644 index 000000000000..1a0d38f45fd2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsget_autorest.go @@ -0,0 +1,67 @@ +package containerinstance + +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 ContainerGroupsGetOperationResponse struct { + HttpResponse *http.Response + Model *ContainerGroup +} + +// ContainerGroupsGet ... +func (c ContainerInstanceClient) ContainerGroupsGet(ctx context.Context, id ContainerGroupId) (result ContainerGroupsGetOperationResponse, err error) { + req, err := c.preparerForContainerGroupsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainerGroupsGet prepares the ContainerGroupsGet request. +func (c ContainerInstanceClient) preparerForContainerGroupsGet(ctx context.Context, id ContainerGroupId) (*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)) +} + +// responderForContainerGroupsGet handles the response to the ContainerGroupsGet request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsGet(resp *http.Response) (result ContainerGroupsGetOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containergroupslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslist_autorest.go new file mode 100644 index 000000000000..b20598aa4ca4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslist_autorest.go @@ -0,0 +1,187 @@ +package containerinstance + +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 ContainerGroupsListOperationResponse struct { + HttpResponse *http.Response + Model *[]ContainerGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ContainerGroupsListOperationResponse, error) +} + +type ContainerGroupsListCompleteResult struct { + Items []ContainerGroup +} + +func (r ContainerGroupsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ContainerGroupsListOperationResponse) LoadMore(ctx context.Context) (resp ContainerGroupsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ContainerGroupsList ... +func (c ContainerInstanceClient) ContainerGroupsList(ctx context.Context, id commonids.SubscriptionId) (resp ContainerGroupsListOperationResponse, err error) { + req, err := c.preparerForContainerGroupsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForContainerGroupsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ContainerGroupsListComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) ContainerGroupsListComplete(ctx context.Context, id commonids.SubscriptionId) (ContainerGroupsListCompleteResult, error) { + return c.ContainerGroupsListCompleteMatchingPredicate(ctx, id, ContainerGroupOperationPredicate{}) +} + +// ContainerGroupsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) ContainerGroupsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ContainerGroupOperationPredicate) (resp ContainerGroupsListCompleteResult, err error) { + items := make([]ContainerGroup, 0) + + page, err := c.ContainerGroupsList(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 := ContainerGroupsListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForContainerGroupsList prepares the ContainerGroupsList request. +func (c ContainerInstanceClient) preparerForContainerGroupsList(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.ContainerInstance/containerGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForContainerGroupsListWithNextLink prepares the ContainerGroupsList request with the given nextLink token. +func (c ContainerInstanceClient) preparerForContainerGroupsListWithNextLink(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)) +} + +// responderForContainerGroupsList handles the response to the ContainerGroupsList request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsList(resp *http.Response) (result ContainerGroupsListOperationResponse, err error) { + type page struct { + Values []ContainerGroup `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 ContainerGroupsListOperationResponse, err error) { + req, err := c.preparerForContainerGroupsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go new file mode 100644 index 000000000000..105d7ee4bb44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package containerinstance + +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 ContainerGroupsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ContainerGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ContainerGroupsListByResourceGroupOperationResponse, error) +} + +type ContainerGroupsListByResourceGroupCompleteResult struct { + Items []ContainerGroup +} + +func (r ContainerGroupsListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ContainerGroupsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ContainerGroupsListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ContainerGroupsListByResourceGroup ... +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ContainerGroupsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForContainerGroupsListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForContainerGroupsListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ContainerGroupsListByResourceGroupComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ContainerGroupsListByResourceGroupCompleteResult, error) { + return c.ContainerGroupsListByResourceGroupCompleteMatchingPredicate(ctx, id, ContainerGroupOperationPredicate{}) +} + +// ContainerGroupsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ContainerGroupOperationPredicate) (resp ContainerGroupsListByResourceGroupCompleteResult, err error) { + items := make([]ContainerGroup, 0) + + page, err := c.ContainerGroupsListByResourceGroup(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 := ContainerGroupsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForContainerGroupsListByResourceGroup prepares the ContainerGroupsListByResourceGroup request. +func (c ContainerInstanceClient) preparerForContainerGroupsListByResourceGroup(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.ContainerInstance/containerGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForContainerGroupsListByResourceGroupWithNextLink prepares the ContainerGroupsListByResourceGroup request with the given nextLink token. +func (c ContainerInstanceClient) preparerForContainerGroupsListByResourceGroupWithNextLink(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)) +} + +// responderForContainerGroupsListByResourceGroup handles the response to the ContainerGroupsListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsListByResourceGroup(resp *http.Response) (result ContainerGroupsListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ContainerGroup `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 ContainerGroupsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForContainerGroupsListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsrestart_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsrestart_autorest.go new file mode 100644 index 000000000000..b4792ea3d197 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsrestart_autorest.go @@ -0,0 +1,78 @@ +package containerinstance + +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 ContainerGroupsRestartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsRestart ... +func (c ContainerInstanceClient) ContainerGroupsRestart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsRestartOperationResponse, err error) { + req, err := c.preparerForContainerGroupsRestart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsRestart", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsRestart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsRestart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsRestartThenPoll performs ContainerGroupsRestart then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsRestartThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsRestart(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsRestart: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsRestart prepares the ContainerGroupsRestart request. +func (c ContainerInstanceClient) preparerForContainerGroupsRestart(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForContainerGroupsRestart sends the ContainerGroupsRestart request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsRestart(ctx context.Context, req *http.Request) (future ContainerGroupsRestartOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containergroupsstart_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstart_autorest.go new file mode 100644 index 000000000000..eb0e27e83be3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstart_autorest.go @@ -0,0 +1,78 @@ +package containerinstance + +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 ContainerGroupsStartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsStart ... +func (c ContainerInstanceClient) ContainerGroupsStart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStartOperationResponse, err error) { + req, err := c.preparerForContainerGroupsStart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStart", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsStart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsStartThenPoll performs ContainerGroupsStart then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsStartThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsStart(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsStart: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsStart prepares the ContainerGroupsStart request. +func (c ContainerInstanceClient) preparerForContainerGroupsStart(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForContainerGroupsStart sends the ContainerGroupsStart request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsStart(ctx context.Context, req *http.Request) (future ContainerGroupsStartOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containergroupsstop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstop_autorest.go new file mode 100644 index 000000000000..0feaf54c046f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstop_autorest.go @@ -0,0 +1,66 @@ +package containerinstance + +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 ContainerGroupsStopOperationResponse struct { + HttpResponse *http.Response +} + +// ContainerGroupsStop ... +func (c ContainerInstanceClient) ContainerGroupsStop(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStopOperationResponse, err error) { + req, err := c.preparerForContainerGroupsStop(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStop", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStop", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsStop(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStop", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainerGroupsStop prepares the ContainerGroupsStop request. +func (c ContainerInstanceClient) preparerForContainerGroupsStop(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainerGroupsStop handles the response to the ContainerGroupsStop request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsStop(resp *http.Response) (result ContainerGroupsStopOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containergroupsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsupdate_autorest.go new file mode 100644 index 000000000000..add0927f328c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsupdate_autorest.go @@ -0,0 +1,68 @@ +package containerinstance + +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 ContainerGroupsUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ContainerGroup +} + +// ContainerGroupsUpdate ... +func (c ContainerInstanceClient) ContainerGroupsUpdate(ctx context.Context, id ContainerGroupId, input Resource) (result ContainerGroupsUpdateOperationResponse, err error) { + req, err := c.preparerForContainerGroupsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainerGroupsUpdate prepares the ContainerGroupsUpdate request. +func (c ContainerInstanceClient) preparerForContainerGroupsUpdate(ctx context.Context, id ContainerGroupId, input Resource) (*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)) +} + +// responderForContainerGroupsUpdate handles the response to the ContainerGroupsUpdate request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsUpdate(resp *http.Response) (result ContainerGroupsUpdateOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containersattach_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersattach_autorest.go new file mode 100644 index 000000000000..53f6a1f5b230 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersattach_autorest.go @@ -0,0 +1,68 @@ +package containerinstance + +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 ContainersAttachOperationResponse struct { + HttpResponse *http.Response + Model *ContainerAttachResponse +} + +// ContainersAttach ... +func (c ContainerInstanceClient) ContainersAttach(ctx context.Context, id ContainerId) (result ContainersAttachOperationResponse, err error) { + req, err := c.preparerForContainersAttach(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersAttach", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersAttach", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainersAttach(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersAttach", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainersAttach prepares the ContainersAttach request. +func (c ContainerInstanceClient) preparerForContainersAttach(ctx context.Context, id ContainerId) (*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/attach", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainersAttach handles the response to the ContainersAttach request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainersAttach(resp *http.Response) (result ContainersAttachOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containersexecutecommand_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersexecutecommand_autorest.go new file mode 100644 index 000000000000..d0a2325d912b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersexecutecommand_autorest.go @@ -0,0 +1,69 @@ +package containerinstance + +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 ContainersExecuteCommandOperationResponse struct { + HttpResponse *http.Response + Model *ContainerExecResponse +} + +// ContainersExecuteCommand ... +func (c ContainerInstanceClient) ContainersExecuteCommand(ctx context.Context, id ContainerId, input ContainerExecRequest) (result ContainersExecuteCommandOperationResponse, err error) { + req, err := c.preparerForContainersExecuteCommand(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersExecuteCommand", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersExecuteCommand", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainersExecuteCommand(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersExecuteCommand", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainersExecuteCommand prepares the ContainersExecuteCommand request. +func (c ContainerInstanceClient) preparerForContainersExecuteCommand(ctx context.Context, id ContainerId, input ContainerExecRequest) (*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/exec", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainersExecuteCommand handles the response to the ContainersExecuteCommand request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainersExecuteCommand(resp *http.Response) (result ContainersExecuteCommandOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_containerslistlogs_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containerslistlogs_autorest.go new file mode 100644 index 000000000000..6b6c261b1e61 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containerslistlogs_autorest.go @@ -0,0 +1,102 @@ +package containerinstance + +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 ContainersListLogsOperationResponse struct { + HttpResponse *http.Response + Model *Logs +} + +type ContainersListLogsOperationOptions struct { + Tail *int64 + Timestamps *bool +} + +func DefaultContainersListLogsOperationOptions() ContainersListLogsOperationOptions { + return ContainersListLogsOperationOptions{} +} + +func (o ContainersListLogsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ContainersListLogsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Tail != nil { + out["tail"] = *o.Tail + } + + if o.Timestamps != nil { + out["timestamps"] = *o.Timestamps + } + + return out +} + +// ContainersListLogs ... +func (c ContainerInstanceClient) ContainersListLogs(ctx context.Context, id ContainerId, options ContainersListLogsOperationOptions) (result ContainersListLogsOperationResponse, err error) { + req, err := c.preparerForContainersListLogs(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersListLogs", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersListLogs", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainersListLogs(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersListLogs", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainersListLogs prepares the ContainersListLogs request. +func (c ContainerInstanceClient) preparerForContainersListLogs(ctx context.Context, id ContainerId, options ContainersListLogsOperationOptions) (*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/logs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainersListLogs handles the response to the ContainersListLogs request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainersListLogs(resp *http.Response) (result ContainersListLogsOperationResponse, 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/containerinstance/2021-03-01/containerinstance/method_locationlistcachedimages_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcachedimages_autorest.go new file mode 100644 index 000000000000..4f63c44fa76d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcachedimages_autorest.go @@ -0,0 +1,186 @@ +package containerinstance + +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 LocationListCachedImagesOperationResponse struct { + HttpResponse *http.Response + Model *[]CachedImages + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (LocationListCachedImagesOperationResponse, error) +} + +type LocationListCachedImagesCompleteResult struct { + Items []CachedImages +} + +func (r LocationListCachedImagesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r LocationListCachedImagesOperationResponse) LoadMore(ctx context.Context) (resp LocationListCachedImagesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// LocationListCachedImages ... +func (c ContainerInstanceClient) LocationListCachedImages(ctx context.Context, id LocationId) (resp LocationListCachedImagesOperationResponse, err error) { + req, err := c.preparerForLocationListCachedImages(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForLocationListCachedImages(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// LocationListCachedImagesComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) LocationListCachedImagesComplete(ctx context.Context, id LocationId) (LocationListCachedImagesCompleteResult, error) { + return c.LocationListCachedImagesCompleteMatchingPredicate(ctx, id, CachedImagesOperationPredicate{}) +} + +// LocationListCachedImagesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) LocationListCachedImagesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CachedImagesOperationPredicate) (resp LocationListCachedImagesCompleteResult, err error) { + items := make([]CachedImages, 0) + + page, err := c.LocationListCachedImages(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 := LocationListCachedImagesCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForLocationListCachedImages prepares the LocationListCachedImages request. +func (c ContainerInstanceClient) preparerForLocationListCachedImages(ctx context.Context, id LocationId) (*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/cachedImages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForLocationListCachedImagesWithNextLink prepares the LocationListCachedImages request with the given nextLink token. +func (c ContainerInstanceClient) preparerForLocationListCachedImagesWithNextLink(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)) +} + +// responderForLocationListCachedImages handles the response to the LocationListCachedImages request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForLocationListCachedImages(resp *http.Response) (result LocationListCachedImagesOperationResponse, err error) { + type page struct { + Values []CachedImages `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 LocationListCachedImagesOperationResponse, err error) { + req, err := c.preparerForLocationListCachedImagesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLocationListCachedImages(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcapabilities_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcapabilities_autorest.go new file mode 100644 index 000000000000..89047d6d87d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcapabilities_autorest.go @@ -0,0 +1,186 @@ +package containerinstance + +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 LocationListCapabilitiesOperationResponse struct { + HttpResponse *http.Response + Model *[]Capabilities + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (LocationListCapabilitiesOperationResponse, error) +} + +type LocationListCapabilitiesCompleteResult struct { + Items []Capabilities +} + +func (r LocationListCapabilitiesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r LocationListCapabilitiesOperationResponse) LoadMore(ctx context.Context) (resp LocationListCapabilitiesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// LocationListCapabilities ... +func (c ContainerInstanceClient) LocationListCapabilities(ctx context.Context, id LocationId) (resp LocationListCapabilitiesOperationResponse, err error) { + req, err := c.preparerForLocationListCapabilities(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForLocationListCapabilities(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// LocationListCapabilitiesComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) LocationListCapabilitiesComplete(ctx context.Context, id LocationId) (LocationListCapabilitiesCompleteResult, error) { + return c.LocationListCapabilitiesCompleteMatchingPredicate(ctx, id, CapabilitiesOperationPredicate{}) +} + +// LocationListCapabilitiesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) LocationListCapabilitiesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CapabilitiesOperationPredicate) (resp LocationListCapabilitiesCompleteResult, err error) { + items := make([]Capabilities, 0) + + page, err := c.LocationListCapabilities(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 := LocationListCapabilitiesCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForLocationListCapabilities prepares the LocationListCapabilities request. +func (c ContainerInstanceClient) preparerForLocationListCapabilities(ctx context.Context, id LocationId) (*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/capabilities", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForLocationListCapabilitiesWithNextLink prepares the LocationListCapabilities request with the given nextLink token. +func (c ContainerInstanceClient) preparerForLocationListCapabilitiesWithNextLink(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)) +} + +// responderForLocationListCapabilities handles the response to the LocationListCapabilities request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForLocationListCapabilities(resp *http.Response) (result LocationListCapabilitiesOperationResponse, err error) { + type page struct { + Values []Capabilities `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 LocationListCapabilitiesOperationResponse, err error) { + req, err := c.preparerForLocationListCapabilitiesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLocationListCapabilities(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistusage_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistusage_autorest.go new file mode 100644 index 000000000000..f3bf85b1c83a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistusage_autorest.go @@ -0,0 +1,68 @@ +package containerinstance + +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 LocationListUsageOperationResponse struct { + HttpResponse *http.Response + Model *UsageListResult +} + +// LocationListUsage ... +func (c ContainerInstanceClient) LocationListUsage(ctx context.Context, id LocationId) (result LocationListUsageOperationResponse, err error) { + req, err := c.preparerForLocationListUsage(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListUsage", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListUsage", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLocationListUsage(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListUsage", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLocationListUsage prepares the LocationListUsage request. +func (c ContainerInstanceClient) preparerForLocationListUsage(ctx context.Context, id LocationId) (*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/usages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLocationListUsage handles the response to the LocationListUsage request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForLocationListUsage(resp *http.Response) (result LocationListUsageOperationResponse, 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/containerinstance/2021-03-01/containerinstance/model_azurefilevolume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_azurefilevolume.go new file mode 100644 index 000000000000..f884ba7abf4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_azurefilevolume.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureFileVolume struct { + ReadOnly *bool `json:"readOnly,omitempty"` + ShareName string `json:"shareName"` + StorageAccountKey *string `json:"storageAccountKey,omitempty"` + StorageAccountName string `json:"storageAccountName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_cachedimages.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_cachedimages.go new file mode 100644 index 000000000000..35f76b327042 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_cachedimages.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CachedImages struct { + Image string `json:"image"` + OsType string `json:"osType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilities.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilities.go new file mode 100644 index 000000000000..d515082a46d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilities.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Capabilities struct { + Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"` + Gpu *string `json:"gpu,omitempty"` + IpAddressType *string `json:"ipAddressType,omitempty"` + Location *string `json:"location,omitempty"` + OsType *string `json:"osType,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilitiescapabilities.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilitiescapabilities.go new file mode 100644 index 000000000000..257ec5ced3ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilitiescapabilities.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilitiesCapabilities struct { + MaxCpu *float64 `json:"maxCpu,omitempty"` + MaxGpuCount *float64 `json:"maxGpuCount,omitempty"` + MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_container.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_container.go new file mode 100644 index 000000000000..cd048b57c1eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_container.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Container struct { + Name string `json:"name"` + Properties ContainerProperties `json:"properties"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerattachresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerattachresponse.go new file mode 100644 index 000000000000..5944a02f3d46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerattachresponse.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAttachResponse struct { + Password *string `json:"password,omitempty"` + WebSocketUri *string `json:"webSocketUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexec.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexec.go new file mode 100644 index 000000000000..dfa94b71f192 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexec.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExec struct { + Command *[]string `json:"command,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequest.go new file mode 100644 index 000000000000..078e69d0fb88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequest.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecRequest struct { + Command *string `json:"command,omitempty"` + TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequestterminalsize.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequestterminalsize.go new file mode 100644 index 000000000000..40110632964e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequestterminalsize.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecRequestTerminalSize struct { + Cols *int64 `json:"cols,omitempty"` + Rows *int64 `json:"rows,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecresponse.go new file mode 100644 index 000000000000..61c49fda4164 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecresponse.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecResponse struct { + Password *string `json:"password,omitempty"` + WebSocketUri *string `json:"webSocketUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroup.go new file mode 100644 index 000000000000..87017579b0cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroup.go @@ -0,0 +1,18 @@ +package containerinstance + +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 ContainerGroup struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ContainerGroupProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupdiagnostics.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupdiagnostics.go new file mode 100644 index 000000000000..b26d399f4586 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupdiagnostics.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupDiagnostics struct { + LogAnalytics *LogAnalytics `json:"logAnalytics,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupnetworkprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupnetworkprofile.go new file mode 100644 index 000000000000..dbfe19e65586 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupnetworkprofile.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupNetworkProfile struct { + Id string `json:"id"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupproperties.go new file mode 100644 index 000000000000..5191baef7629 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupproperties.go @@ -0,0 +1,21 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupProperties struct { + Containers []Container `json:"containers"` + Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` + DnsConfig *DnsConfiguration `json:"dnsConfig,omitempty"` + EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` + ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` + InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` + InstanceView *ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"` + IpAddress *IpAddress `json:"ipAddress,omitempty"` + NetworkProfile *ContainerGroupNetworkProfile `json:"networkProfile,omitempty"` + OsType OperatingSystemTypes `json:"osType"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RestartPolicy *ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` + Sku *ContainerGroupSku `json:"sku,omitempty"` + Volumes *[]Volume `json:"volumes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergrouppropertiesinstanceview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergrouppropertiesinstanceview.go new file mode 100644 index 000000000000..6652cfdfeee8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergrouppropertiesinstanceview.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupPropertiesInstanceView struct { + Events *[]Event `json:"events,omitempty"` + State *string `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerhttpget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerhttpget.go new file mode 100644 index 000000000000..3ce858f1afe5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerhttpget.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerHttpGet struct { + HttpHeaders *[]HttpHeader `json:"httpHeaders,omitempty"` + Path *string `json:"path,omitempty"` + Port int64 `json:"port"` + Scheme *Scheme `json:"scheme,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerport.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerport.go new file mode 100644 index 000000000000..26e3c3d6180d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerport.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerPort struct { + Port int64 `json:"port"` + Protocol *ContainerNetworkProtocol `json:"protocol,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerprobe.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerprobe.go new file mode 100644 index 000000000000..4bdf40dfe5cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerprobe.go @@ -0,0 +1,14 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerProbe struct { + Exec *ContainerExec `json:"exec,omitempty"` + FailureThreshold *int64 `json:"failureThreshold,omitempty"` + HttpGet *ContainerHttpGet `json:"httpGet,omitempty"` + InitialDelaySeconds *int64 `json:"initialDelaySeconds,omitempty"` + PeriodSeconds *int64 `json:"periodSeconds,omitempty"` + SuccessThreshold *int64 `json:"successThreshold,omitempty"` + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerproperties.go new file mode 100644 index 000000000000..19f54823c9d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerproperties.go @@ -0,0 +1,16 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerProperties struct { + Command *[]string `json:"command,omitempty"` + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + Image string `json:"image"` + InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"` + LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty"` + Ports *[]ContainerPort `json:"ports,omitempty"` + ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty"` + Resources ResourceRequirements `json:"resources"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerpropertiesinstanceview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerpropertiesinstanceview.go new file mode 100644 index 000000000000..347af45a182b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerpropertiesinstanceview.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerPropertiesInstanceView struct { + CurrentState *ContainerState `json:"currentState,omitempty"` + Events *[]Event `json:"events,omitempty"` + PreviousState *ContainerState `json:"previousState,omitempty"` + RestartCount *int64 `json:"restartCount,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerstate.go new file mode 100644 index 000000000000..b75c2eee165a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerstate.go @@ -0,0 +1,42 @@ +package containerinstance + +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 ContainerState struct { + DetailStatus *string `json:"detailStatus,omitempty"` + ExitCode *int64 `json:"exitCode,omitempty"` + FinishTime *string `json:"finishTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` + State *string `json:"state,omitempty"` +} + +func (o *ContainerState) GetFinishTimeAsTime() (*time.Time, error) { + if o.FinishTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.FinishTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerState) SetFinishTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FinishTime = &formatted +} + +func (o *ContainerState) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerState) 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/containerinstance/2021-03-01/containerinstance/model_dnsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_dnsconfiguration.go new file mode 100644 index 000000000000..08581fd75d3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_dnsconfiguration.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsConfiguration struct { + NameServers []string `json:"nameServers"` + Options *string `json:"options,omitempty"` + SearchDomains *string `json:"searchDomains,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_encryptionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_encryptionproperties.go new file mode 100644 index 000000000000..d0aeecbc61e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_encryptionproperties.go @@ -0,0 +1,10 @@ +package containerinstance + +// 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 { + KeyName string `json:"keyName"` + KeyVersion string `json:"keyVersion"` + VaultBaseUrl string `json:"vaultBaseUrl"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_environmentvariable.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_environmentvariable.go new file mode 100644 index 000000000000..2184f90aa065 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_environmentvariable.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvironmentVariable struct { + Name string `json:"name"` + SecureValue *string `json:"secureValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_event.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_event.go new file mode 100644 index 000000000000..a66aa6de0146 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_event.go @@ -0,0 +1,43 @@ +package containerinstance + +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 Event struct { + Count *int64 `json:"count,omitempty"` + FirstTimestamp *string `json:"firstTimestamp,omitempty"` + LastTimestamp *string `json:"lastTimestamp,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +func (o *Event) GetFirstTimestampAsTime() (*time.Time, error) { + if o.FirstTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.FirstTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *Event) SetFirstTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FirstTimestamp = &formatted +} + +func (o *Event) GetLastTimestampAsTime() (*time.Time, error) { + if o.LastTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *Event) SetLastTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastTimestamp = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gitrepovolume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gitrepovolume.go new file mode 100644 index 000000000000..fe91482b0974 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gitrepovolume.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GitRepoVolume struct { + Directory *string `json:"directory,omitempty"` + Repository string `json:"repository"` + Revision *string `json:"revision,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gpuresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gpuresource.go new file mode 100644 index 000000000000..eb389f05ae8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gpuresource.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GpuResource struct { + Count int64 `json:"count"` + Sku GpuSku `json:"sku"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_httpheader.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_httpheader.go new file mode 100644 index 000000000000..b4825abbeea0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_httpheader.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HttpHeader struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_imageregistrycredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_imageregistrycredential.go new file mode 100644 index 000000000000..3bc3e568c9f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_imageregistrycredential.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageRegistryCredential struct { + Password *string `json:"password,omitempty"` + Server string `json:"server"` + Username string `json:"username"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerdefinition.go new file mode 100644 index 000000000000..01211fb4a023 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerdefinition.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerDefinition struct { + Name string `json:"name"` + Properties InitContainerPropertiesDefinition `json:"properties"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinition.go new file mode 100644 index 000000000000..301fd4ebd306 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinition.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerPropertiesDefinition struct { + Command *[]string `json:"command,omitempty"` + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + Image *string `json:"image,omitempty"` + InstanceView *InitContainerPropertiesDefinitionInstanceView `json:"instanceView,omitempty"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go new file mode 100644 index 000000000000..fd71b6bc7a1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerPropertiesDefinitionInstanceView struct { + CurrentState *ContainerState `json:"currentState,omitempty"` + Events *[]Event `json:"events,omitempty"` + PreviousState *ContainerState `json:"previousState,omitempty"` + RestartCount *int64 `json:"restartCount,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_ipaddress.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_ipaddress.go new file mode 100644 index 000000000000..b4b56f1ef622 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_ipaddress.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IpAddress struct { + DnsNameLabel *string `json:"dnsNameLabel,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + Ip *string `json:"ip,omitempty"` + Ports []Port `json:"ports"` + Type ContainerGroupIpAddressType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_loganalytics.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_loganalytics.go new file mode 100644 index 000000000000..df8644c0e3fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_loganalytics.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalytics struct { + LogType *LogAnalyticsLogType `json:"logType,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + WorkspaceId string `json:"workspaceId"` + WorkspaceKey string `json:"workspaceKey"` + WorkspaceResourceId *map[string]string `json:"workspaceResourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_logs.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_logs.go new file mode 100644 index 000000000000..7e4dbc049387 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_logs.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Logs struct { + Content *string `json:"content,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_port.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_port.go new file mode 100644 index 000000000000..e3a87272de3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_port.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Port struct { + Port int64 `json:"port"` + Protocol *ContainerGroupNetworkProtocol `json:"protocol,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resource.go new file mode 100644 index 000000000000..d9db6f7f3e6e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resource.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Resource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,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/containerinstance/2021-03-01/containerinstance/model_resourcelimits.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcelimits.go new file mode 100644 index 000000000000..8a2f7fc441d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcelimits.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceLimits struct { + Cpu *float64 `json:"cpu,omitempty"` + Gpu *GpuResource `json:"gpu,omitempty"` + MemoryInGB *float64 `json:"memoryInGB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequests.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequests.go new file mode 100644 index 000000000000..e17a7bf905ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequests.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceRequests struct { + Cpu float64 `json:"cpu"` + Gpu *GpuResource `json:"gpu,omitempty"` + MemoryInGB float64 `json:"memoryInGB"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequirements.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequirements.go new file mode 100644 index 000000000000..cdc6bfd4aaf7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequirements.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceRequirements struct { + Limits *ResourceLimits `json:"limits,omitempty"` + Requests ResourceRequests `json:"requests"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usage.go new file mode 100644 index 000000000000..2c30a75dee3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usage.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Usage struct { + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *UsageName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagelistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagelistresult.go new file mode 100644 index 000000000000..a473f08b4e78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagelistresult.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageListResult struct { + Value *[]Usage `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagename.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagename.go new file mode 100644 index 000000000000..eba1c36c68b2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagename.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volume.go new file mode 100644 index 000000000000..ea997d3e01f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volume.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Volume struct { + AzureFile *AzureFileVolume `json:"azureFile,omitempty"` + EmptyDir *interface{} `json:"emptyDir,omitempty"` + GitRepo *GitRepoVolume `json:"gitRepo,omitempty"` + Name string `json:"name"` + Secret *map[string]string `json:"secret,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volumemount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volumemount.go new file mode 100644 index 000000000000..71d7148c1bf8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volumemount.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeMount struct { + MountPath string `json:"mountPath"` + Name string `json:"name"` + ReadOnly *bool `json:"readOnly,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/predicates.go new file mode 100644 index 000000000000..02f895d68f52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/predicates.go @@ -0,0 +1,80 @@ +package containerinstance + +type CachedImagesOperationPredicate struct { + Image *string + OsType *string +} + +func (p CachedImagesOperationPredicate) Matches(input CachedImages) bool { + + if p.Image != nil && *p.Image != input.Image { + return false + } + + if p.OsType != nil && *p.OsType != input.OsType { + return false + } + + return true +} + +type CapabilitiesOperationPredicate struct { + Gpu *string + IpAddressType *string + Location *string + OsType *string + ResourceType *string +} + +func (p CapabilitiesOperationPredicate) Matches(input Capabilities) bool { + + if p.Gpu != nil && (input.Gpu == nil && *p.Gpu != *input.Gpu) { + return false + } + + if p.IpAddressType != nil && (input.IpAddressType == nil && *p.IpAddressType != *input.IpAddressType) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.OsType != nil && (input.OsType == nil && *p.OsType != *input.OsType) { + return false + } + + if p.ResourceType != nil && (input.ResourceType == nil && *p.ResourceType != *input.ResourceType) { + return false + } + + return true +} + +type ContainerGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ContainerGroupOperationPredicate) Matches(input ContainerGroup) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/version.go new file mode 100644 index 000000000000..1f296067049e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/version.go @@ -0,0 +1,12 @@ +package containerinstance + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/containerinstance/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a7e83b28c587..ef87c745cc68 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -13,7 +13,6 @@ 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/compute/mgmt/2021-11-01/compute github.com/Azure/azure-sdk-for-go/services/consumption/mgmt/2019-10-01/consumption -github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement @@ -215,6 +214,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clus github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger +github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup