diff --git a/go.mod b/go.mod index c483c806d636..a51e47cfab04 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.1 github.com/hashicorp/go-azure-helpers v0.66.1 - github.com/hashicorp/go-azure-sdk v0.20240118.1175416 + github.com/hashicorp/go-azure-sdk v0.20240122.1052955 github.com/hashicorp/go-hclog v1.5.0 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index bef74653d350..b0c520035359 100644 --- a/go.sum +++ b/go.sum @@ -115,8 +115,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.66.1 h1:SokAckK9hvQ9PZO2TmZY/CGru8KWJ4A7hcRUggHMEus= github.com/hashicorp/go-azure-helpers v0.66.1/go.mod h1:kJxXrFtJKJdOEqvad8pllAe7dhP4DbN8J6sqFZe47+4= -github.com/hashicorp/go-azure-sdk v0.20240118.1175416 h1:y3/7PWAxvmSIx5u3Cg1EmR2zyLJAM2rvAFYnW2JIeiQ= -github.com/hashicorp/go-azure-sdk v0.20240118.1175416/go.mod h1:3KI/ojBQAAMjtXPxCP9A5EyNMWlDQarITxGLmGj9tGI= +github.com/hashicorp/go-azure-sdk v0.20240122.1052955 h1:PLFuY5XIAvaZnBB036+E9vmDLbp42ZC7awq18f0HEQI= +github.com/hashicorp/go-azure-sdk v0.20240122.1052955/go.mod h1:3KI/ojBQAAMjtXPxCP9A5EyNMWlDQarITxGLmGj9tGI= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/client.go index 386c93f4eb32..8805cb693869 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/client.go @@ -4,10 +4,13 @@ package v2022_12_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/loadtestservice/2022-12-01/loadtest" "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests" "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -16,20 +19,28 @@ type Client struct { Quotas *quotas.QuotasClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - loadTestClient := loadtest.NewLoadTestClientWithBaseURI(endpoint) - configureAuthFunc(&loadTestClient.Client) - - loadTestsClient := loadtests.NewLoadTestsClientWithBaseURI(endpoint) - configureAuthFunc(&loadTestsClient.Client) +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + loadTestClient, err := loadtest.NewLoadTestClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building LoadTest client: %+v", err) + } + configureFunc(loadTestClient.Client) - quotasClient := quotas.NewQuotasClientWithBaseURI(endpoint) - configureAuthFunc("asClient.Client) + loadTestsClient, err := loadtests.NewLoadTestsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building LoadTests client: %+v", err) + } + configureFunc(loadTestsClient.Client) - return Client{ - LoadTest: &loadTestClient, - LoadTests: &loadTestsClient, - Quotas: "asClient, + quotasClient, err := quotas.NewQuotasClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Quotas client: %+v", err) } + configureFunc(quotasClient.Client) + + return &Client{ + LoadTest: loadTestClient, + LoadTests: loadTestsClient, + Quotas: quotasClient, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/client.go index 6f4dbe684bcc..bb1ff619ba72 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/client.go @@ -1,18 +1,26 @@ package loadtest -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 LoadTestClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewLoadTestClientWithBaseURI(endpoint string) LoadTestClient { - return LoadTestClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewLoadTestClientWithBaseURI(sdkApi sdkEnv.Api) (*LoadTestClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "loadtest", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LoadTestClient: %+v", err) } + + return &LoadTestClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/method_listoutboundnetworkdependenciesendpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/method_listoutboundnetworkdependenciesendpoints.go new file mode 100644 index 000000000000..6b75e8af9b9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/method_listoutboundnetworkdependenciesendpoints.go @@ -0,0 +1,91 @@ +package loadtest + +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 ListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OutboundEnvironmentEndpoint +} + +type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { + LatestHttpResponse *http.Response + Items []OutboundEnvironmentEndpoint +} + +// ListOutboundNetworkDependenciesEndpoints ... +func (c LoadTestClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id LoadTestId) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, 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.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OutboundEnvironmentEndpoint `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete retrieves all the results into a single object +func (c LoadTestClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id LoadTestId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c LoadTestClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id LoadTestId, predicate OutboundEnvironmentEndpointOperationPredicate) (result ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + resp, err := c.ListOutboundNetworkDependenciesEndpoints(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 = ListOutboundNetworkDependenciesEndpointsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/method_listoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/method_listoutboundnetworkdependenciesendpoints_autorest.go deleted file mode 100644 index bbbaeb3923e3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtest/method_listoutboundnetworkdependenciesendpoints_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package loadtest - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOutboundNetworkDependenciesEndpointsOperationResponse struct { - HttpResponse *http.Response - Model *[]OutboundEnvironmentEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOutboundNetworkDependenciesEndpointsOperationResponse, error) -} - -type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { - Items []OutboundEnvironmentEndpoint -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListOutboundNetworkDependenciesEndpoints ... -func (c LoadTestClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id LoadTestId) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtest.LoadTestClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtest.LoadTestClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtest.LoadTestClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListOutboundNetworkDependenciesEndpoints prepares the ListOutboundNetworkDependenciesEndpoints request. -func (c LoadTestClient) preparerForListOutboundNetworkDependenciesEndpoints(ctx context.Context, id LoadTestId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListOutboundNetworkDependenciesEndpointsWithNextLink prepares the ListOutboundNetworkDependenciesEndpoints request with the given nextLink token. -func (c LoadTestClient) preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListOutboundNetworkDependenciesEndpoints handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (c LoadTestClient) responderForListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - type page struct { - Values []OutboundEnvironmentEndpoint `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtest.LoadTestClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtest.LoadTestClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListOutboundNetworkDependenciesEndpoints(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtest.LoadTestClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object -func (c LoadTestClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id LoadTestId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { - return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) -} - -// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LoadTestClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id LoadTestId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { - items := make([]OutboundEnvironmentEndpoint, 0) - - page, err := c.ListOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListOutboundNetworkDependenciesEndpointsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/client.go index 52a9c9028de6..b5a9ba72097b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/client.go @@ -1,18 +1,26 @@ package loadtests -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 LoadTestsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewLoadTestsClientWithBaseURI(endpoint string) LoadTestsClient { - return LoadTestsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewLoadTestsClientWithBaseURI(sdkApi sdkEnv.Api) (*LoadTestsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "loadtests", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LoadTestsClient: %+v", err) } + + return &LoadTestsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/constants.go index 6f3d8b8afeac..973a1e94ce74 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/constants.go @@ -1,6 +1,10 @@ package loadtests -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. @@ -23,6 +27,19 @@ func PossibleValuesForResourceState() []string { } } +func (s *ResourceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseResourceState(input string) (*ResourceState, error) { vals := map[string]ResourceState{ "canceled": ResourceStateCanceled, @@ -53,6 +70,19 @@ func PossibleValuesForType() []string { } } +func (s *Type) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseType(input string) (*Type, error) { vals := map[string]Type{ "systemassigned": TypeSystemAssigned, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_createorupdate.go new file mode 100644 index 000000000000..e8ed230ccdfe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_createorupdate.go @@ -0,0 +1,74 @@ +package loadtests + +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 CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c LoadTestsClient) CreateOrUpdate(ctx context.Context, id LoadTestId, input LoadTestResource) (result CreateOrUpdateOperationResponse, 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c LoadTestsClient) CreateOrUpdateThenPoll(ctx context.Context, id LoadTestId, input LoadTestResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_createorupdate_autorest.go deleted file mode 100644 index 86c3ffb0757e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package loadtests - -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 CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c LoadTestsClient) CreateOrUpdate(ctx context.Context, id LoadTestId, input LoadTestResource) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c LoadTestsClient) CreateOrUpdateThenPoll(ctx context.Context, id LoadTestId, input LoadTestResource) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c LoadTestsClient) preparerForCreateOrUpdate(ctx context.Context, id LoadTestId, input LoadTestResource) (*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)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c LoadTestsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_delete.go new file mode 100644 index 000000000000..19ba7605ae4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_delete.go @@ -0,0 +1,71 @@ +package loadtests + +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 DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c LoadTestsClient) Delete(ctx context.Context, id LoadTestId) (result DeleteOperationResponse, 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 +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c LoadTestsClient) DeleteThenPoll(ctx context.Context, id LoadTestId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_delete_autorest.go deleted file mode 100644 index 2c08ce367d86..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package loadtests - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c LoadTestsClient) Delete(ctx context.Context, id LoadTestId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c LoadTestsClient) DeleteThenPoll(ctx context.Context, id LoadTestId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c LoadTestsClient) preparerForDelete(ctx context.Context, id LoadTestId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c LoadTestsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_get.go new file mode 100644 index 000000000000..a24873e50fa2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_get.go @@ -0,0 +1,51 @@ +package loadtests + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoadTestResource +} + +// Get ... +func (c LoadTestsClient) Get(ctx context.Context, id LoadTestId) (result GetOperationResponse, 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_get_autorest.go deleted file mode 100644 index ef7b59cff5b2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package loadtests - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *LoadTestResource -} - -// Get ... -func (c LoadTestsClient) Get(ctx context.Context, id LoadTestId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c LoadTestsClient) preparerForGet(ctx context.Context, id LoadTestId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbyresourcegroup.go new file mode 100644 index 000000000000..fe501ca8ac0f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package loadtests + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]LoadTestResource +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []LoadTestResource +} + +// ListByResourceGroup ... +func (c LoadTestsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.LoadTestService/loadTests", 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 *[]LoadTestResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c LoadTestsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, LoadTestResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c LoadTestsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate LoadTestResourceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]LoadTestResource, 0) + + resp, err := c.ListByResourceGroup(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 = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 8d6f822e2158..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package loadtests - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]LoadTestResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []LoadTestResource -} - -func (r ListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c LoadTestsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c LoadTestsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.LoadTestService/loadTests", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c LoadTestsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []LoadTestResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c LoadTestsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, LoadTestResourceOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LoadTestsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate LoadTestResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]LoadTestResource, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbysubscription.go new file mode 100644 index 000000000000..ea1c1d8d6e8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbysubscription.go @@ -0,0 +1,92 @@ +package loadtests + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]LoadTestResource +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []LoadTestResource +} + +// ListBySubscription ... +func (c LoadTestsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.LoadTestService/loadTests", 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 *[]LoadTestResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c LoadTestsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, LoadTestResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c LoadTestsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate LoadTestResourceOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]LoadTestResource, 0) + + resp, err := c.ListBySubscription(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 = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbysubscription_autorest.go deleted file mode 100644 index b376350e0343..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_listbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package loadtests - -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 ListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]LoadTestResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []LoadTestResource -} - -func (r ListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c LoadTestsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c LoadTestsClient) preparerForListBySubscription(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.LoadTestService/loadTests", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c LoadTestsClient) preparerForListBySubscriptionWithNextLink(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)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []LoadTestResource `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 ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c LoadTestsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, LoadTestResourceOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LoadTestsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate LoadTestResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]LoadTestResource, 0) - - page, err := c.ListBySubscription(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 := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_update.go new file mode 100644 index 000000000000..8e5238b50b17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_update.go @@ -0,0 +1,74 @@ +package loadtests + +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 UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c LoadTestsClient) Update(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c LoadTestsClient) UpdateThenPoll(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_update_autorest.go deleted file mode 100644 index 0db71739a308..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package loadtests - -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 UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c LoadTestsClient) Update(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c LoadTestsClient) UpdateThenPoll(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c LoadTestsClient) preparerForUpdate(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) (*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)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c LoadTestsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/client.go index eea232af4a18..acdc272dcb34 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/client.go @@ -1,18 +1,26 @@ package quotas -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 QuotasClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewQuotasClientWithBaseURI(endpoint string) QuotasClient { - return QuotasClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewQuotasClientWithBaseURI(sdkApi sdkEnv.Api) (*QuotasClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "quotas", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating QuotasClient: %+v", err) } + + return &QuotasClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/constants.go index f0de69431daf..224312b78824 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/constants.go @@ -1,6 +1,10 @@ package quotas -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. @@ -23,6 +27,19 @@ func PossibleValuesForResourceState() []string { } } +func (s *ResourceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseResourceState(input string) (*ResourceState, error) { vals := map[string]ResourceState{ "canceled": ResourceStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_checkavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_checkavailability.go new file mode 100644 index 000000000000..4d2e1ba5268c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_checkavailability.go @@ -0,0 +1,56 @@ +package quotas + +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 CheckAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckQuotaAvailabilityResponse +} + +// CheckAvailability ... +func (c QuotasClient) CheckAvailability(ctx context.Context, id QuotaId, input QuotaBucketRequest) (result CheckAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/checkAvailability", 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_checkavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_checkavailability_autorest.go deleted file mode 100644 index 6305744d126c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_checkavailability_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package quotas - -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 CheckAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckQuotaAvailabilityResponse -} - -// CheckAvailability ... -func (c QuotasClient) CheckAvailability(ctx context.Context, id QuotaId, input QuotaBucketRequest) (result CheckAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "CheckAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "CheckAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "CheckAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckAvailability prepares the CheckAvailability request. -func (c QuotasClient) preparerForCheckAvailability(ctx context.Context, id QuotaId, input QuotaBucketRequest) (*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/checkAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckAvailability handles the response to the CheckAvailability request. The method always -// closes the http.Response Body. -func (c QuotasClient) responderForCheckAvailability(resp *http.Response) (result CheckAvailabilityOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_get.go new file mode 100644 index 000000000000..fac7db849e21 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_get.go @@ -0,0 +1,51 @@ +package quotas + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaResource +} + +// Get ... +func (c QuotasClient) Get(ctx context.Context, id QuotaId) (result GetOperationResponse, 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_get_autorest.go deleted file mode 100644 index 3263858d1d55..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package quotas - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *QuotaResource -} - -// Get ... -func (c QuotasClient) Get(ctx context.Context, id QuotaId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c QuotasClient) preparerForGet(ctx context.Context, id QuotaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c QuotasClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_list.go new file mode 100644 index 000000000000..d3a7877883f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_list.go @@ -0,0 +1,91 @@ +package quotas + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]QuotaResource +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []QuotaResource +} + +// List ... +func (c QuotasClient) List(ctx context.Context, id LocationId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/quotas", 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 *[]QuotaResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c QuotasClient) ListComplete(ctx context.Context, id LocationId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, QuotaResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c QuotasClient) ListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate QuotaResourceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]QuotaResource, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_list_autorest.go deleted file mode 100644 index a63899116b69..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas/method_list_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package quotas - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]QuotaResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []QuotaResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c QuotasClient) List(ctx context.Context, id LocationId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c QuotasClient) preparerForList(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/quotas", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c QuotasClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c QuotasClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []QuotaResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotas.QuotasClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c QuotasClient) ListComplete(ctx context.Context, id LocationId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, QuotaResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c QuotasClient) ListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate QuotaResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]QuotaResource, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/client.go index a66d5bf031d0..4da0b017776e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/client.go @@ -4,20 +4,25 @@ package v2023_01_31 // 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/managedidentity/2023-01-31/managedidentities" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { ManagedIdentities *managedidentities.ManagedIdentitiesClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - managedIdentitiesClient := managedidentities.NewManagedIdentitiesClientWithBaseURI(endpoint) - configureAuthFunc(&managedIdentitiesClient.Client) - - return Client{ - ManagedIdentities: &managedIdentitiesClient, +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + managedIdentitiesClient, err := managedidentities.NewManagedIdentitiesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ManagedIdentities client: %+v", err) } + configureFunc(managedIdentitiesClient.Client) + + return &Client{ + ManagedIdentities: managedIdentitiesClient, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/client.go index b7ed375f569b..711ad433d62b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/client.go @@ -1,18 +1,26 @@ package managedidentities -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 ManagedIdentitiesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedIdentitiesClientWithBaseURI(endpoint string) ManagedIdentitiesClient { - return ManagedIdentitiesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedIdentitiesClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedIdentitiesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedidentities", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedIdentitiesClient: %+v", err) } + + return &ManagedIdentitiesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialscreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialscreateorupdate.go new file mode 100644 index 000000000000..c43eea8f378e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialscreateorupdate.go @@ -0,0 +1,56 @@ +package managedidentities + +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 FederatedIdentityCredentialsCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *FederatedIdentityCredential +} + +// FederatedIdentityCredentialsCreateOrUpdate ... +func (c ManagedIdentitiesClient) FederatedIdentityCredentialsCreateOrUpdate(ctx context.Context, id FederatedIdentityCredentialId, input FederatedIdentityCredential) (result FederatedIdentityCredentialsCreateOrUpdateOperationResponse, 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialscreateorupdate_autorest.go deleted file mode 100644 index 56b913a2f4cc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedidentities - -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 FederatedIdentityCredentialsCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *FederatedIdentityCredential -} - -// FederatedIdentityCredentialsCreateOrUpdate ... -func (c ManagedIdentitiesClient) FederatedIdentityCredentialsCreateOrUpdate(ctx context.Context, id FederatedIdentityCredentialId, input FederatedIdentityCredential) (result FederatedIdentityCredentialsCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForFederatedIdentityCredentialsCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFederatedIdentityCredentialsCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFederatedIdentityCredentialsCreateOrUpdate prepares the FederatedIdentityCredentialsCreateOrUpdate request. -func (c ManagedIdentitiesClient) preparerForFederatedIdentityCredentialsCreateOrUpdate(ctx context.Context, id FederatedIdentityCredentialId, input FederatedIdentityCredential) (*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)) -} - -// responderForFederatedIdentityCredentialsCreateOrUpdate handles the response to the FederatedIdentityCredentialsCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForFederatedIdentityCredentialsCreateOrUpdate(resp *http.Response) (result FederatedIdentityCredentialsCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsdelete.go new file mode 100644 index 000000000000..7920dca4fede --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsdelete.go @@ -0,0 +1,47 @@ +package managedidentities + +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 FederatedIdentityCredentialsDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// FederatedIdentityCredentialsDelete ... +func (c ManagedIdentitiesClient) FederatedIdentityCredentialsDelete(ctx context.Context, id FederatedIdentityCredentialId) (result FederatedIdentityCredentialsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsdelete_autorest.go deleted file mode 100644 index 98c6ea19e85e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package managedidentities - -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 FederatedIdentityCredentialsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// FederatedIdentityCredentialsDelete ... -func (c ManagedIdentitiesClient) FederatedIdentityCredentialsDelete(ctx context.Context, id FederatedIdentityCredentialId) (result FederatedIdentityCredentialsDeleteOperationResponse, err error) { - req, err := c.preparerForFederatedIdentityCredentialsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFederatedIdentityCredentialsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFederatedIdentityCredentialsDelete prepares the FederatedIdentityCredentialsDelete request. -func (c ManagedIdentitiesClient) preparerForFederatedIdentityCredentialsDelete(ctx context.Context, id FederatedIdentityCredentialId) (*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)) -} - -// responderForFederatedIdentityCredentialsDelete handles the response to the FederatedIdentityCredentialsDelete request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForFederatedIdentityCredentialsDelete(resp *http.Response) (result FederatedIdentityCredentialsDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsget.go new file mode 100644 index 000000000000..66008c63f251 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsget.go @@ -0,0 +1,51 @@ +package managedidentities + +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 FederatedIdentityCredentialsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *FederatedIdentityCredential +} + +// FederatedIdentityCredentialsGet ... +func (c ManagedIdentitiesClient) FederatedIdentityCredentialsGet(ctx context.Context, id FederatedIdentityCredentialId) (result FederatedIdentityCredentialsGetOperationResponse, 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsget_autorest.go deleted file mode 100644 index 806217093202..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedidentities - -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 FederatedIdentityCredentialsGetOperationResponse struct { - HttpResponse *http.Response - Model *FederatedIdentityCredential -} - -// FederatedIdentityCredentialsGet ... -func (c ManagedIdentitiesClient) FederatedIdentityCredentialsGet(ctx context.Context, id FederatedIdentityCredentialId) (result FederatedIdentityCredentialsGetOperationResponse, err error) { - req, err := c.preparerForFederatedIdentityCredentialsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFederatedIdentityCredentialsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFederatedIdentityCredentialsGet prepares the FederatedIdentityCredentialsGet request. -func (c ManagedIdentitiesClient) preparerForFederatedIdentityCredentialsGet(ctx context.Context, id FederatedIdentityCredentialId) (*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)) -} - -// responderForFederatedIdentityCredentialsGet handles the response to the FederatedIdentityCredentialsGet request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForFederatedIdentityCredentialsGet(resp *http.Response) (result FederatedIdentityCredentialsGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialslist.go new file mode 100644 index 000000000000..92dafdaea184 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialslist.go @@ -0,0 +1,120 @@ +package managedidentities + +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 FederatedIdentityCredentialsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]FederatedIdentityCredential +} + +type FederatedIdentityCredentialsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []FederatedIdentityCredential +} + +type FederatedIdentityCredentialsListOperationOptions struct { + Top *int64 +} + +func DefaultFederatedIdentityCredentialsListOperationOptions() FederatedIdentityCredentialsListOperationOptions { + return FederatedIdentityCredentialsListOperationOptions{} +} + +func (o FederatedIdentityCredentialsListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o FederatedIdentityCredentialsListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o FederatedIdentityCredentialsListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// FederatedIdentityCredentialsList ... +func (c ManagedIdentitiesClient) FederatedIdentityCredentialsList(ctx context.Context, id commonids.UserAssignedIdentityId, options FederatedIdentityCredentialsListOperationOptions) (result FederatedIdentityCredentialsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/federatedIdentityCredentials", id.ID()), + OptionsObject: options, + } + + 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 *[]FederatedIdentityCredential `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// FederatedIdentityCredentialsListComplete retrieves all the results into a single object +func (c ManagedIdentitiesClient) FederatedIdentityCredentialsListComplete(ctx context.Context, id commonids.UserAssignedIdentityId, options FederatedIdentityCredentialsListOperationOptions) (FederatedIdentityCredentialsListCompleteResult, error) { + return c.FederatedIdentityCredentialsListCompleteMatchingPredicate(ctx, id, options, FederatedIdentityCredentialOperationPredicate{}) +} + +// FederatedIdentityCredentialsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedIdentitiesClient) FederatedIdentityCredentialsListCompleteMatchingPredicate(ctx context.Context, id commonids.UserAssignedIdentityId, options FederatedIdentityCredentialsListOperationOptions, predicate FederatedIdentityCredentialOperationPredicate) (result FederatedIdentityCredentialsListCompleteResult, err error) { + items := make([]FederatedIdentityCredential, 0) + + resp, err := c.FederatedIdentityCredentialsList(ctx, id, options) + 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 = FederatedIdentityCredentialsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialslist_autorest.go deleted file mode 100644 index a60aa04930c6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_federatedidentitycredentialslist_autorest.go +++ /dev/null @@ -1,216 +0,0 @@ -package managedidentities - -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 FederatedIdentityCredentialsListOperationResponse struct { - HttpResponse *http.Response - Model *[]FederatedIdentityCredential - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (FederatedIdentityCredentialsListOperationResponse, error) -} - -type FederatedIdentityCredentialsListCompleteResult struct { - Items []FederatedIdentityCredential -} - -func (r FederatedIdentityCredentialsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r FederatedIdentityCredentialsListOperationResponse) LoadMore(ctx context.Context) (resp FederatedIdentityCredentialsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type FederatedIdentityCredentialsListOperationOptions struct { - Top *int64 -} - -func DefaultFederatedIdentityCredentialsListOperationOptions() FederatedIdentityCredentialsListOperationOptions { - return FederatedIdentityCredentialsListOperationOptions{} -} - -func (o FederatedIdentityCredentialsListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o FederatedIdentityCredentialsListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// FederatedIdentityCredentialsList ... -func (c ManagedIdentitiesClient) FederatedIdentityCredentialsList(ctx context.Context, id commonids.UserAssignedIdentityId, options FederatedIdentityCredentialsListOperationOptions) (resp FederatedIdentityCredentialsListOperationResponse, err error) { - req, err := c.preparerForFederatedIdentityCredentialsList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForFederatedIdentityCredentialsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForFederatedIdentityCredentialsList prepares the FederatedIdentityCredentialsList request. -func (c ManagedIdentitiesClient) preparerForFederatedIdentityCredentialsList(ctx context.Context, id commonids.UserAssignedIdentityId, options FederatedIdentityCredentialsListOperationOptions) (*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/federatedIdentityCredentials", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForFederatedIdentityCredentialsListWithNextLink prepares the FederatedIdentityCredentialsList request with the given nextLink token. -func (c ManagedIdentitiesClient) preparerForFederatedIdentityCredentialsListWithNextLink(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)) -} - -// responderForFederatedIdentityCredentialsList handles the response to the FederatedIdentityCredentialsList request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForFederatedIdentityCredentialsList(resp *http.Response) (result FederatedIdentityCredentialsListOperationResponse, err error) { - type page struct { - Values []FederatedIdentityCredential `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 FederatedIdentityCredentialsListOperationResponse, err error) { - req, err := c.preparerForFederatedIdentityCredentialsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFederatedIdentityCredentialsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "FederatedIdentityCredentialsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// FederatedIdentityCredentialsListComplete retrieves all of the results into a single object -func (c ManagedIdentitiesClient) FederatedIdentityCredentialsListComplete(ctx context.Context, id commonids.UserAssignedIdentityId, options FederatedIdentityCredentialsListOperationOptions) (FederatedIdentityCredentialsListCompleteResult, error) { - return c.FederatedIdentityCredentialsListCompleteMatchingPredicate(ctx, id, options, FederatedIdentityCredentialOperationPredicate{}) -} - -// FederatedIdentityCredentialsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedIdentitiesClient) FederatedIdentityCredentialsListCompleteMatchingPredicate(ctx context.Context, id commonids.UserAssignedIdentityId, options FederatedIdentityCredentialsListOperationOptions, predicate FederatedIdentityCredentialOperationPredicate) (resp FederatedIdentityCredentialsListCompleteResult, err error) { - items := make([]FederatedIdentityCredential, 0) - - page, err := c.FederatedIdentityCredentialsList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := FederatedIdentityCredentialsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_systemassignedidentitiesgetbyscope.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_systemassignedidentitiesgetbyscope.go new file mode 100644 index 000000000000..0548e53f359b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_systemassignedidentitiesgetbyscope.go @@ -0,0 +1,53 @@ +package managedidentities + +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 SystemAssignedIdentitiesGetByScopeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SystemAssignedIdentity +} + +// SystemAssignedIdentitiesGetByScope ... +func (c ManagedIdentitiesClient) SystemAssignedIdentitiesGetByScope(ctx context.Context, id commonids.ScopeId) (result SystemAssignedIdentitiesGetByScopeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/identities/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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_systemassignedidentitiesgetbyscope_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_systemassignedidentitiesgetbyscope_autorest.go deleted file mode 100644 index 22b0b58ddd69..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_systemassignedidentitiesgetbyscope_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package managedidentities - -import ( - "context" - "fmt" - "net/http" - - "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 SystemAssignedIdentitiesGetByScopeOperationResponse struct { - HttpResponse *http.Response - Model *SystemAssignedIdentity -} - -// SystemAssignedIdentitiesGetByScope ... -func (c ManagedIdentitiesClient) SystemAssignedIdentitiesGetByScope(ctx context.Context, id commonids.ScopeId) (result SystemAssignedIdentitiesGetByScopeOperationResponse, err error) { - req, err := c.preparerForSystemAssignedIdentitiesGetByScope(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "SystemAssignedIdentitiesGetByScope", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "SystemAssignedIdentitiesGetByScope", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForSystemAssignedIdentitiesGetByScope(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "SystemAssignedIdentitiesGetByScope", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForSystemAssignedIdentitiesGetByScope prepares the SystemAssignedIdentitiesGetByScope request. -func (c ManagedIdentitiesClient) preparerForSystemAssignedIdentitiesGetByScope(ctx context.Context, id commonids.ScopeId) (*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.ManagedIdentity/identities/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForSystemAssignedIdentitiesGetByScope handles the response to the SystemAssignedIdentitiesGetByScope request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForSystemAssignedIdentitiesGetByScope(resp *http.Response) (result SystemAssignedIdentitiesGetByScopeOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiescreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiescreateorupdate.go new file mode 100644 index 000000000000..7db543fae56e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiescreateorupdate.go @@ -0,0 +1,57 @@ +package managedidentities + +import ( + "context" + "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 UserAssignedIdentitiesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Identity +} + +// UserAssignedIdentitiesCreateOrUpdate ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesCreateOrUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input Identity) (result UserAssignedIdentitiesCreateOrUpdateOperationResponse, 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiescreateorupdate_autorest.go deleted file mode 100644 index d5f05a43907f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiescreateorupdate_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package managedidentities - -import ( - "context" - "net/http" - - "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 UserAssignedIdentitiesCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Identity -} - -// UserAssignedIdentitiesCreateOrUpdate ... -func (c ManagedIdentitiesClient) UserAssignedIdentitiesCreateOrUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input Identity) (result UserAssignedIdentitiesCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesCreateOrUpdate prepares the UserAssignedIdentitiesCreateOrUpdate request. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesCreateOrUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input Identity) (*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)) -} - -// responderForUserAssignedIdentitiesCreateOrUpdate handles the response to the UserAssignedIdentitiesCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesCreateOrUpdate(resp *http.Response) (result UserAssignedIdentitiesCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesdelete.go new file mode 100644 index 000000000000..df88b3eddcbf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesdelete.go @@ -0,0 +1,48 @@ +package managedidentities + +import ( + "context" + "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 UserAssignedIdentitiesDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// UserAssignedIdentitiesDelete ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesDelete(ctx context.Context, id commonids.UserAssignedIdentityId) (result UserAssignedIdentitiesDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesdelete_autorest.go deleted file mode 100644 index ea7e54fd0c08..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesdelete_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package managedidentities - -import ( - "context" - "net/http" - - "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 UserAssignedIdentitiesDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// UserAssignedIdentitiesDelete ... -func (c ManagedIdentitiesClient) UserAssignedIdentitiesDelete(ctx context.Context, id commonids.UserAssignedIdentityId) (result UserAssignedIdentitiesDeleteOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesDelete prepares the UserAssignedIdentitiesDelete request. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesDelete(ctx context.Context, id commonids.UserAssignedIdentityId) (*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)) -} - -// responderForUserAssignedIdentitiesDelete handles the response to the UserAssignedIdentitiesDelete request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesDelete(resp *http.Response) (result UserAssignedIdentitiesDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesget.go new file mode 100644 index 000000000000..186a1664d0b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesget.go @@ -0,0 +1,52 @@ +package managedidentities + +import ( + "context" + "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 UserAssignedIdentitiesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Identity +} + +// UserAssignedIdentitiesGet ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesGet(ctx context.Context, id commonids.UserAssignedIdentityId) (result UserAssignedIdentitiesGetOperationResponse, 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesget_autorest.go deleted file mode 100644 index dc6ce10ee8c3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesget_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedidentities - -import ( - "context" - "net/http" - - "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 UserAssignedIdentitiesGetOperationResponse struct { - HttpResponse *http.Response - Model *Identity -} - -// UserAssignedIdentitiesGet ... -func (c ManagedIdentitiesClient) UserAssignedIdentitiesGet(ctx context.Context, id commonids.UserAssignedIdentityId) (result UserAssignedIdentitiesGetOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesGet prepares the UserAssignedIdentitiesGet request. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesGet(ctx context.Context, id commonids.UserAssignedIdentityId) (*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)) -} - -// responderForUserAssignedIdentitiesGet handles the response to the UserAssignedIdentitiesGet request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesGet(resp *http.Response) (result UserAssignedIdentitiesGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbyresourcegroup.go new file mode 100644 index 000000000000..943481095e9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbyresourcegroup.go @@ -0,0 +1,92 @@ +package managedidentities + +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 UserAssignedIdentitiesListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Identity +} + +type UserAssignedIdentitiesListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Identity +} + +// UserAssignedIdentitiesListByResourceGroup ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities", 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 *[]Identity `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// UserAssignedIdentitiesListByResourceGroupComplete retrieves all the results into a single object +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (UserAssignedIdentitiesListByResourceGroupCompleteResult, error) { + return c.UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx, id, IdentityOperationPredicate{}) +} + +// UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate IdentityOperationPredicate) (result UserAssignedIdentitiesListByResourceGroupCompleteResult, err error) { + items := make([]Identity, 0) + + resp, err := c.UserAssignedIdentitiesListByResourceGroup(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 = UserAssignedIdentitiesListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbyresourcegroup_autorest.go deleted file mode 100644 index 71cbdae7248e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedidentities - -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 UserAssignedIdentitiesListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]Identity - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (UserAssignedIdentitiesListByResourceGroupOperationResponse, error) -} - -type UserAssignedIdentitiesListByResourceGroupCompleteResult struct { - Items []Identity -} - -func (r UserAssignedIdentitiesListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r UserAssignedIdentitiesListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// UserAssignedIdentitiesListByResourceGroup ... -func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForUserAssignedIdentitiesListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForUserAssignedIdentitiesListByResourceGroup prepares the UserAssignedIdentitiesListByResourceGroup request. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListByResourceGroup(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.ManagedIdentity/userAssignedIdentities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink prepares the UserAssignedIdentitiesListByResourceGroup request with the given nextLink token. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink(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)) -} - -// responderForUserAssignedIdentitiesListByResourceGroup handles the response to the UserAssignedIdentitiesListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesListByResourceGroup(resp *http.Response) (result UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { - type page struct { - Values []Identity `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 UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// UserAssignedIdentitiesListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (UserAssignedIdentitiesListByResourceGroupCompleteResult, error) { - return c.UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx, id, IdentityOperationPredicate{}) -} - -// UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate IdentityOperationPredicate) (resp UserAssignedIdentitiesListByResourceGroupCompleteResult, err error) { - items := make([]Identity, 0) - - page, err := c.UserAssignedIdentitiesListByResourceGroup(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 := UserAssignedIdentitiesListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbysubscription.go new file mode 100644 index 000000000000..4b54e12ff858 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbysubscription.go @@ -0,0 +1,92 @@ +package managedidentities + +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 UserAssignedIdentitiesListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Identity +} + +type UserAssignedIdentitiesListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []Identity +} + +// UserAssignedIdentitiesListBySubscription ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities", 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 *[]Identity `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// UserAssignedIdentitiesListBySubscriptionComplete retrieves all the results into a single object +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (UserAssignedIdentitiesListBySubscriptionCompleteResult, error) { + return c.UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx, id, IdentityOperationPredicate{}) +} + +// UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate IdentityOperationPredicate) (result UserAssignedIdentitiesListBySubscriptionCompleteResult, err error) { + items := make([]Identity, 0) + + resp, err := c.UserAssignedIdentitiesListBySubscription(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 = UserAssignedIdentitiesListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbysubscription_autorest.go deleted file mode 100644 index 56809d47a15d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitieslistbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedidentities - -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 UserAssignedIdentitiesListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]Identity - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (UserAssignedIdentitiesListBySubscriptionOperationResponse, error) -} - -type UserAssignedIdentitiesListBySubscriptionCompleteResult struct { - Items []Identity -} - -func (r UserAssignedIdentitiesListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r UserAssignedIdentitiesListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// UserAssignedIdentitiesListBySubscription ... -func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForUserAssignedIdentitiesListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForUserAssignedIdentitiesListBySubscription prepares the UserAssignedIdentitiesListBySubscription request. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListBySubscription(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.ManagedIdentity/userAssignedIdentities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink prepares the UserAssignedIdentitiesListBySubscription request with the given nextLink token. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink(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)) -} - -// responderForUserAssignedIdentitiesListBySubscription handles the response to the UserAssignedIdentitiesListBySubscription request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesListBySubscription(resp *http.Response) (result UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { - type page struct { - Values []Identity `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 UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// UserAssignedIdentitiesListBySubscriptionComplete retrieves all of the results into a single object -func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (UserAssignedIdentitiesListBySubscriptionCompleteResult, error) { - return c.UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx, id, IdentityOperationPredicate{}) -} - -// UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate IdentityOperationPredicate) (resp UserAssignedIdentitiesListBySubscriptionCompleteResult, err error) { - items := make([]Identity, 0) - - page, err := c.UserAssignedIdentitiesListBySubscription(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 := UserAssignedIdentitiesListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesupdate.go new file mode 100644 index 000000000000..76fbac34d56e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesupdate.go @@ -0,0 +1,56 @@ +package managedidentities + +import ( + "context" + "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 UserAssignedIdentitiesUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Identity +} + +// UserAssignedIdentitiesUpdate ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input IdentityUpdate) (result UserAssignedIdentitiesUpdateOperationResponse, 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesupdate_autorest.go deleted file mode 100644 index 22cea8211ebd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2023-01-31/managedidentities/method_userassignedidentitiesupdate_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package managedidentities - -import ( - "context" - "net/http" - - "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 UserAssignedIdentitiesUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Identity -} - -// UserAssignedIdentitiesUpdate ... -func (c ManagedIdentitiesClient) UserAssignedIdentitiesUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input IdentityUpdate) (result UserAssignedIdentitiesUpdateOperationResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesUpdate prepares the UserAssignedIdentitiesUpdate request. -func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input IdentityUpdate) (*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)) -} - -// responderForUserAssignedIdentitiesUpdate handles the response to the UserAssignedIdentitiesUpdate request. The method always -// closes the http.Response Body. -func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesUpdate(resp *http.Response) (result UserAssignedIdentitiesUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 2a909ab7d570..05a35a9b4c06 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -157,7 +157,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20240118.1175416 +# github.com/hashicorp/go-azure-sdk v0.20240122.1052955 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview