diff --git a/resource-manager/containerinstance/2023-05-01/client.go b/resource-manager/containerinstance/2023-05-01/client.go index 49840737c73..73e6bbbae5e 100644 --- a/resource-manager/containerinstance/2023-05-01/client.go +++ b/resource-manager/containerinstance/2023-05-01/client.go @@ -4,20 +4,25 @@ package v2023_05_01 // Licensed under the MIT License. See NOTICE.txt in the project root for license information. import ( - "github.com/Azure/go-autorest/autorest" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2023-05-01/containerinstance" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { ContainerInstance *containerinstance.ContainerInstanceClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - containerInstanceClient := containerinstance.NewContainerInstanceClientWithBaseURI(endpoint) - configureAuthFunc(&containerInstanceClient.Client) - - return Client{ - ContainerInstance: &containerInstanceClient, +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + containerInstanceClient, err := containerinstance.NewContainerInstanceClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ContainerInstance client: %+v", err) } + configureFunc(containerInstanceClient.Client) + + return &Client{ + ContainerInstance: containerInstanceClient, + }, nil } diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/client.go b/resource-manager/containerinstance/2023-05-01/containerinstance/client.go index 7c611fe53d7..bec267c5086 100644 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/client.go +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/client.go @@ -1,18 +1,26 @@ package containerinstance -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // 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 + Client *resourcemanager.Client } -func NewContainerInstanceClientWithBaseURI(endpoint string) ContainerInstanceClient { - return ContainerInstanceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewContainerInstanceClientWithBaseURI(sdkApi sdkEnv.Api) (*ContainerInstanceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "containerinstance", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ContainerInstanceClient: %+v", err) } + + return &ContainerInstanceClient{ + Client: client, + }, nil } diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/constants.go b/resource-manager/containerinstance/2023-05-01/containerinstance/constants.go index a3ce7638277..074a23415e7 100644 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/constants.go +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/constants.go @@ -1,6 +1,10 @@ package containerinstance -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForContainerGroupIPAddressType() []string { } } +func (s *ContainerGroupIPAddressType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupIPAddressType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContainerGroupIPAddressType(input string) (*ContainerGroupIPAddressType, error) { vals := map[string]ContainerGroupIPAddressType{ "private": ContainerGroupIPAddressTypePrivate, @@ -47,6 +64,19 @@ func PossibleValuesForContainerGroupNetworkProtocol() []string { } } +func (s *ContainerGroupNetworkProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupNetworkProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContainerGroupNetworkProtocol(input string) (*ContainerGroupNetworkProtocol, error) { vals := map[string]ContainerGroupNetworkProtocol{ "tcp": ContainerGroupNetworkProtocolTCP, @@ -75,6 +105,19 @@ func PossibleValuesForContainerGroupPriority() []string { } } +func (s *ContainerGroupPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContainerGroupPriority(input string) (*ContainerGroupPriority, error) { vals := map[string]ContainerGroupPriority{ "regular": ContainerGroupPriorityRegular, @@ -105,6 +148,19 @@ func PossibleValuesForContainerGroupRestartPolicy() []string { } } +func (s *ContainerGroupRestartPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupRestartPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContainerGroupRestartPolicy(input string) (*ContainerGroupRestartPolicy, error) { vals := map[string]ContainerGroupRestartPolicy{ "always": ContainerGroupRestartPolicyAlways, @@ -136,6 +192,19 @@ func PossibleValuesForContainerGroupSku() []string { } } +func (s *ContainerGroupSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContainerGroupSku(input string) (*ContainerGroupSku, error) { vals := map[string]ContainerGroupSku{ "confidential": ContainerGroupSkuConfidential, @@ -165,6 +234,19 @@ func PossibleValuesForContainerNetworkProtocol() []string { } } +func (s *ContainerNetworkProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerNetworkProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContainerNetworkProtocol(input string) (*ContainerNetworkProtocol, error) { vals := map[string]ContainerNetworkProtocol{ "tcp": ContainerNetworkProtocolTCP, @@ -199,6 +281,19 @@ func PossibleValuesForDnsNameLabelReusePolicy() []string { } } +func (s *DnsNameLabelReusePolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDnsNameLabelReusePolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDnsNameLabelReusePolicy(input string) (*DnsNameLabelReusePolicy, error) { vals := map[string]DnsNameLabelReusePolicy{ "noreuse": DnsNameLabelReusePolicyNoreuse, @@ -232,6 +327,19 @@ func PossibleValuesForGpuSku() []string { } } +func (s *GpuSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGpuSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGpuSku(input string) (*GpuSku, error) { vals := map[string]GpuSku{ "k80": GpuSkuKEightZero, @@ -261,6 +369,19 @@ func PossibleValuesForLogAnalyticsLogType() []string { } } +func (s *LogAnalyticsLogType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLogAnalyticsLogType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLogAnalyticsLogType(input string) (*LogAnalyticsLogType, error) { vals := map[string]LogAnalyticsLogType{ "containerinsights": LogAnalyticsLogTypeContainerInsights, @@ -289,6 +410,19 @@ func PossibleValuesForOperatingSystemTypes() []string { } } +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { vals := map[string]OperatingSystemTypes{ "linux": OperatingSystemTypesLinux, @@ -317,6 +451,19 @@ func PossibleValuesForScheme() []string { } } +func (s *Scheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScheme(input string) (*Scheme, error) { vals := map[string]Scheme{ "http": SchemeHTTP, diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupscreateorupdate.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupscreateorupdate.go new file mode 100644 index 00000000000..f79115be3fd --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupscreateorupdate.go @@ -0,0 +1,75 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsCreateOrUpdate ... +func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdate(ctx context.Context, id ContainerGroupId, input ContainerGroup) (result ContainerGroupsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + 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(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupscreateorupdate_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupscreateorupdate_autorest.go deleted file mode 100644 index 0bd6a6e1bda..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupscreateorupdate_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -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 - Model *ContainerGroup -} - -// 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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsdelete.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsdelete.go new file mode 100644 index 00000000000..3052b7351c1 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsdelete.go @@ -0,0 +1,72 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsDelete ... +func (c ContainerInstanceClient) ContainerGroupsDelete(ctx context.Context, id ContainerGroupId) (result ContainerGroupsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + 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(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsdelete_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsdelete_autorest.go deleted file mode 100644 index da92832c840..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsdelete_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -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 - Model *ContainerGroup -} - -// 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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsget.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsget.go new file mode 100644 index 00000000000..a185e3f9284 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsget.go @@ -0,0 +1,54 @@ +package containerinstance + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsGet ... +func (c ContainerInstanceClient) ContainerGroupsGet(ctx context.Context, id ContainerGroupId) (result ContainerGroupsGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ContainerGroup + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsget_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsget_autorest.go deleted file mode 100644 index af6ae2e37cd..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints.go new file mode 100644 index 00000000000..e957860b761 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints.go @@ -0,0 +1,55 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsGetOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]string +} + +// ContainerGroupsGetOutboundNetworkDependenciesEndpoints ... +func (c ContainerInstanceClient) ContainerGroupsGetOutboundNetworkDependenciesEndpoints(ctx context.Context, id ContainerGroupId) (result ContainerGroupsGetOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []string + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints_autorest.go deleted file mode 100644 index 732743d8ec3..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -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 ContainerGroupsGetOutboundNetworkDependenciesEndpointsOperationResponse struct { - HttpResponse *http.Response - Model *[]string -} - -// ContainerGroupsGetOutboundNetworkDependenciesEndpoints ... -func (c ContainerInstanceClient) ContainerGroupsGetOutboundNetworkDependenciesEndpoints(ctx context.Context, id ContainerGroupId) (result ContainerGroupsGetOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForContainerGroupsGetOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGetOutboundNetworkDependenciesEndpoints", 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", "ContainerGroupsGetOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContainerGroupsGetOutboundNetworkDependenciesEndpoints(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGetOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContainerGroupsGetOutboundNetworkDependenciesEndpoints prepares the ContainerGroupsGetOutboundNetworkDependenciesEndpoints request. -func (c ContainerInstanceClient) preparerForContainerGroupsGetOutboundNetworkDependenciesEndpoints(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(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContainerGroupsGetOutboundNetworkDependenciesEndpoints handles the response to the ContainerGroupsGetOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (c ContainerInstanceClient) responderForContainerGroupsGetOutboundNetworkDependenciesEndpoints(resp *http.Response) (result ContainerGroupsGetOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslist.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslist.go new file mode 100644 index 00000000000..b125d71fc57 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslist.go @@ -0,0 +1,92 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *[]ContainerGroup +} + +type ContainerGroupsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ContainerGroup +} + +// ContainerGroupsList ... +func (c ContainerInstanceClient) ContainerGroupsList(ctx context.Context, id commonids.SubscriptionId) (result ContainerGroupsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroups", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ContainerGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ContainerGroupsListComplete retrieves all 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 the results and then applies the predicate +func (c ContainerInstanceClient) ContainerGroupsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ContainerGroupOperationPredicate) (result ContainerGroupsListCompleteResult, err error) { + items := make([]ContainerGroup, 0) + + resp, err := c.ContainerGroupsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ContainerGroupsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslist_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslist_autorest.go deleted file mode 100644 index 4d0113e72a0..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -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 -} - -// 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 -} - -// 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 -} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslistbyresourcegroup.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslistbyresourcegroup.go new file mode 100644 index 00000000000..6012783a112 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslistbyresourcegroup.go @@ -0,0 +1,92 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *[]ContainerGroup +} + +type ContainerGroupsListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ContainerGroup +} + +// ContainerGroupsListByResourceGroup ... +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ContainerGroupsListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroups", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ContainerGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ContainerGroupsListByResourceGroupComplete retrieves all 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 the results and then applies the predicate +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ContainerGroupOperationPredicate) (result ContainerGroupsListByResourceGroupCompleteResult, err error) { + items := make([]ContainerGroup, 0) + + resp, err := c.ContainerGroupsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ContainerGroupsListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go deleted file mode 100644 index 67e4b1d8b49..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -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 -} - -// 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 -} - -// 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 -} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsrestart.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsrestart.go new file mode 100644 index 00000000000..1d567778c03 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsrestart.go @@ -0,0 +1,69 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ContainerGroupsRestart ... +func (c ContainerInstanceClient) ContainerGroupsRestart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsRestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + 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(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsRestart: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsrestart_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsrestart_autorest.go deleted file mode 100644 index b4792ea3d19..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsrestart_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstart.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstart.go new file mode 100644 index 00000000000..c3e6d2c5684 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstart.go @@ -0,0 +1,70 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ContainerGroupsStart ... +func (c ContainerInstanceClient) ContainerGroupsStart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + 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(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsStart: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstart_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstart_autorest.go deleted file mode 100644 index eb0e27e83be..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstart_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstop.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstop.go new file mode 100644 index 00000000000..82a8c0b9a07 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstop.go @@ -0,0 +1,47 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData +} + +// ContainerGroupsStop ... +func (c ContainerInstanceClient) ContainerGroupsStop(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstop_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstop_autorest.go deleted file mode 100644 index 4fab0380b9b..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsstop_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsupdate.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsupdate.go new file mode 100644 index 00000000000..ab81ed5b734 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsupdate.go @@ -0,0 +1,58 @@ +package containerinstance + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsUpdate ... +func (c ContainerInstanceClient) ContainerGroupsUpdate(ctx context.Context, id ContainerGroupId, input Resource) (result ContainerGroupsUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ContainerGroup + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsupdate_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsupdate_autorest.go deleted file mode 100644 index 9981b0f6707..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containergroupsupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersattach.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersattach.go new file mode 100644 index 00000000000..bf56bbcf939 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersattach.go @@ -0,0 +1,55 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *ContainerAttachResponse +} + +// ContainersAttach ... +func (c ContainerInstanceClient) ContainersAttach(ctx context.Context, id ContainerId) (result ContainersAttachOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/attach", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ContainerAttachResponse + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersattach_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersattach_autorest.go deleted file mode 100644 index aff05fac327..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersattach_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersexecutecommand.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersexecutecommand.go new file mode 100644 index 00000000000..1701b25a299 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersexecutecommand.go @@ -0,0 +1,59 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *ContainerExecResponse +} + +// ContainersExecuteCommand ... +func (c ContainerInstanceClient) ContainersExecuteCommand(ctx context.Context, id ContainerId, input ContainerExecRequest) (result ContainersExecuteCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/exec", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ContainerExecResponse + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersexecutecommand_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersexecutecommand_autorest.go deleted file mode 100644 index 1001f4c29b1..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containersexecutecommand_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_containerslistlogs.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containerslistlogs.go new file mode 100644 index 00000000000..1f7dba6249a --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containerslistlogs.go @@ -0,0 +1,87 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *Logs +} + +type ContainersListLogsOperationOptions struct { + Tail *int64 + Timestamps *bool +} + +func DefaultContainersListLogsOperationOptions() ContainersListLogsOperationOptions { + return ContainersListLogsOperationOptions{} +} + +func (o ContainersListLogsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ContainersListLogsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ContainersListLogsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Tail != nil { + out.Append("tail", fmt.Sprintf("%v", *o.Tail)) + } + if o.Timestamps != nil { + out.Append("timestamps", fmt.Sprintf("%v", *o.Timestamps)) + } + return &out +} + +// ContainersListLogs ... +func (c ContainerInstanceClient) ContainersListLogs(ctx context.Context, id ContainerId, options ContainersListLogsOperationOptions) (result ContainersListLogsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/logs", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Logs + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containerslistlogs_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_containerslistlogs_autorest.go deleted file mode 100644 index ed9b55e5185..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_containerslistlogs_autorest.go +++ /dev/null @@ -1,103 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcachedimages.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcachedimages.go new file mode 100644 index 00000000000..2f07dea8475 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcachedimages.go @@ -0,0 +1,91 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *[]CachedImages +} + +type LocationListCachedImagesCompleteResult struct { + LatestHttpResponse *http.Response + Items []CachedImages +} + +// LocationListCachedImages ... +func (c ContainerInstanceClient) LocationListCachedImages(ctx context.Context, id LocationId) (result LocationListCachedImagesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/cachedImages", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CachedImages `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// LocationListCachedImagesComplete retrieves all 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 the results and then applies the predicate +func (c ContainerInstanceClient) LocationListCachedImagesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CachedImagesOperationPredicate) (result LocationListCachedImagesCompleteResult, err error) { + items := make([]CachedImages, 0) + + resp, err := c.LocationListCachedImages(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = LocationListCachedImagesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcachedimages_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcachedimages_autorest.go deleted file mode 100644 index 612c11dc940..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcachedimages_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -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 -} - -// 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 -} - -// 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 -} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcapabilities.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcapabilities.go new file mode 100644 index 00000000000..1957a5bb41b --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcapabilities.go @@ -0,0 +1,91 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *[]Capabilities +} + +type LocationListCapabilitiesCompleteResult struct { + LatestHttpResponse *http.Response + Items []Capabilities +} + +// LocationListCapabilities ... +func (c ContainerInstanceClient) LocationListCapabilities(ctx context.Context, id LocationId) (result LocationListCapabilitiesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/capabilities", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Capabilities `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// LocationListCapabilitiesComplete retrieves all 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 the results and then applies the predicate +func (c ContainerInstanceClient) LocationListCapabilitiesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CapabilitiesOperationPredicate) (result LocationListCapabilitiesCompleteResult, err error) { + items := make([]Capabilities, 0) + + resp, err := c.LocationListCapabilities(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = LocationListCapabilitiesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcapabilities_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcapabilities_autorest.go deleted file mode 100644 index 473480935fe..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistcapabilities_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -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 -} - -// 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 -} - -// 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 -} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistusage.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistusage.go new file mode 100644 index 00000000000..e7f7dfc3786 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistusage.go @@ -0,0 +1,55 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *UsageListResult +} + +// LocationListUsage ... +func (c ContainerInstanceClient) LocationListUsage(ctx context.Context, id LocationId) (result LocationListUsageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/usages", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model UsageListResult + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistusage_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistusage_autorest.go deleted file mode 100644 index 461b96fac0c..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_locationlistusage_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -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/resource-manager/containerinstance/2023-05-01/containerinstance/method_subnetserviceassociationlinkdelete.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_subnetserviceassociationlinkdelete.go new file mode 100644 index 00000000000..a9b469719f8 --- /dev/null +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/method_subnetserviceassociationlinkdelete.go @@ -0,0 +1,72 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubnetServiceAssociationLinkDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// SubnetServiceAssociationLinkDelete ... +func (c ContainerInstanceClient) SubnetServiceAssociationLinkDelete(ctx context.Context, id commonids.SubnetId) (result SubnetServiceAssociationLinkDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// SubnetServiceAssociationLinkDeleteThenPoll performs SubnetServiceAssociationLinkDelete then polls until it's completed +func (c ContainerInstanceClient) SubnetServiceAssociationLinkDeleteThenPoll(ctx context.Context, id commonids.SubnetId) error { + result, err := c.SubnetServiceAssociationLinkDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing SubnetServiceAssociationLinkDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after SubnetServiceAssociationLinkDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/method_subnetserviceassociationlinkdelete_autorest.go b/resource-manager/containerinstance/2023-05-01/containerinstance/method_subnetserviceassociationlinkdelete_autorest.go deleted file mode 100644 index 0a90357e821..00000000000 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/method_subnetserviceassociationlinkdelete_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -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" - "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 SubnetServiceAssociationLinkDeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// SubnetServiceAssociationLinkDelete ... -func (c ContainerInstanceClient) SubnetServiceAssociationLinkDelete(ctx context.Context, id commonids.SubnetId) (result SubnetServiceAssociationLinkDeleteOperationResponse, err error) { - req, err := c.preparerForSubnetServiceAssociationLinkDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "SubnetServiceAssociationLinkDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForSubnetServiceAssociationLinkDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "SubnetServiceAssociationLinkDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// SubnetServiceAssociationLinkDeleteThenPoll performs SubnetServiceAssociationLinkDelete then polls until it's completed -func (c ContainerInstanceClient) SubnetServiceAssociationLinkDeleteThenPoll(ctx context.Context, id commonids.SubnetId) error { - result, err := c.SubnetServiceAssociationLinkDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing SubnetServiceAssociationLinkDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after SubnetServiceAssociationLinkDelete: %+v", err) - } - - return nil -} - -// preparerForSubnetServiceAssociationLinkDelete prepares the SubnetServiceAssociationLinkDelete request. -func (c ContainerInstanceClient) preparerForSubnetServiceAssociationLinkDelete(ctx context.Context, id commonids.SubnetId) (*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(fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForSubnetServiceAssociationLinkDelete sends the SubnetServiceAssociationLinkDelete request. The method will close the -// http.Response Body if it receives an error. -func (c ContainerInstanceClient) senderForSubnetServiceAssociationLinkDelete(ctx context.Context, req *http.Request) (future SubnetServiceAssociationLinkDeleteOperationResponse, 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 -}